net: socket: error on a negative msg_namelen
authorMatthew Leach <matthew.leach@arm.com>
Tue, 11 Mar 2014 11:58:27 +0000 (11:58 +0000)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 May 2014 05:54:16 +0000 (07:54 +0200)
commita452ae0af4da31194e70c76b070bc60a31b985c6
tree9a6ca267624acf77e34c9c02209da8b5cf62a35e
parent3c3e5e546a2a8fe6b2d5d5e5e3385430999ce585
net: socket: error on a negative msg_namelen

[ Upstream commit dbb490b96584d4e958533fb637f08b557f505657 ]

When copying in a struct msghdr from the user, if the user has set the
msg_namelen parameter to a negative value it gets clamped to a valid
size due to a comparison between signed and unsigned values.

Ensure the syscall errors when the user passes in a negative value.

Signed-off-by: Matthew Leach <matthew.leach@arm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/socket.c