]> git.baikalelectronics.ru Git - kernel.git/commit
net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 20 Mar 2015 16:48:13 +0000 (16:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Mar 2015 20:31:09 +0000 (16:31 -0400)
commitc1cb2f48559b65c72602e55849084bbe854c1836
tree42508ea8f958c83cacba4a44efe46e096840a272
parent599af84aa0c3b24b2803857aa51177be25d1f444
net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour

Commit c0290abc1038 (net: clamp ->msg_namelen instead of returning an
error) introduced the clamping of msg_namelen when the unsigned value
was larger than sizeof(struct sockaddr_storage). This caused a
msg_namelen of -1 to be valid. The native code was subsequently fixed by
commit a76a001a8c90 (net: socket: error on a negative msg_namelen).

In addition, the native code sets msg_namelen to 0 when msg_name is
NULL. This was done in commit (632607542c26 net:socket: set msg_namelen
to 0 if msg_name is passed as NULL in msghdr struct from userland) and
subsequently updated by 54e8656212a9 (fold verify_iovec() into
copy_msghdr_from_user()).

This patch brings the get_compat_msghdr() in line with
copy_msghdr_from_user().

Fixes: c0290abc1038 (net: clamp ->msg_namelen instead of returning an error)
Cc: David S. Miller <davem@davemloft.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/compat.c