Linux: avoid oops in memcpy_toiovec

With ADAPT_PMTU enabled, kernel_recvmsg can be called to receive
errors.  The call is made with no iovec supplied (we pass a NULL
pointer), but with a size of 256.  In the kernel, the memcpy_toiovec
function tests for size > 0, and proceeds to check iovec->iov_len,
which causes an oops.  Fix by setting the size to 0.

Change-Id: I3c672c2e67d0aa5af2bd54d0c14aaeae3bb3c530
Reviewed-on: http://gerrit.openafs.org/2546
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Marc Dionne 2010-08-12 16:33:04 -04:00 committed by Derrick Brashear
parent 08552ad8a9
commit 90b75531ad

View File

@ -110,7 +110,7 @@ handle_socket_error(osi_socket so)
msg.msg_controllen = 256;
msg.msg_flags = 0;
code = kernel_recvmsg(sop, &msg, NULL, 0, 256,
code = kernel_recvmsg(sop, &msg, NULL, 0, 0,
MSG_ERRQUEUE|MSG_DONTWAIT|MSG_TRUNC);
if (code < 0 || !(msg.msg_flags & MSG_ERRQUEUE))