Staging: hv: remove ASSERT() in Channel.c
authorBill Pemberton <wfp5p@virginia.edu>
Wed, 5 May 2010 19:27:38 +0000 (15:27 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:36:13 +0000 (11:36 -0700)
VmbusChannelOpen() will now return -EINVAL if UserDataLen is too big.
Previously this was handled by an assert.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/Channel.c

index fdd441174f237b8ea5a0e3501dbf63c699384fce..bd1a33608fcf1ba097b66e5d8ac23a8f77f4ce12 100644 (file)
@@ -258,7 +258,11 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize,
                                                  PAGE_SHIFT;
        openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */
 
-       ASSERT(UserDataLen <= MAX_USER_DEFINED_BYTES);
+       if (UserDataLen > MAX_USER_DEFINED_BYTES) {
+               err = -EINVAL;
+               goto errorout;
+       }
+
        if (UserDataLen)
                memcpy(openMsg->UserData, UserData, UserDataLen);