]> git.baikalelectronics.ru Git - kernel.git/commit
net:socket: set msg_namelen to 0 if msg_name is passed as NULL in msghdr struct from...
authorAni Sinha <ani@arista.com>
Mon, 8 Sep 2014 21:49:59 +0000 (14:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Sep 2014 00:35:46 +0000 (17:35 -0700)
commitcbf26221e94a39a48aac5103b9a6c0f44f676548
treea66ecb7bbf576550a3865badf290d6015507d5ce
parentebd5e0bfd905efaf95a5b6c606e3f9b6d40185ae
net:socket: set msg_namelen to 0 if msg_name is passed as NULL in msghdr struct from userland.

Linux manpage for recvmsg and sendmsg calls does not explicitly mention setting msg_namelen to 0 when
msg_name passed set as NULL. When developers don't set msg_namelen member in msghdr, it might contain garbage
value which will fail the validation check and sendmsg and recvmsg calls from kernel will return EINVAL. This will
break old binaries and any code for which there is no access to source code.
To fix this, we set msg_namelen to 0 when msg_name is passed as NULL from userland.

Signed-off-by: Ani Sinha <ani@arista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/socket.c