From: Allan Stephens Date: Thu, 6 Mar 2008 23:05:38 +0000 (-0800) Subject: [TIPC]: Add argument validation for shutdown() X-Git-Tag: v2.6.26-rc1~1138^2~467 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e247a8f5d018740220c66bd5df1928d21d277d63;p=linux-2.6 [TIPC]: Add argument validation for shutdown() This patch validates that the "how" argument to shutdown() is SHUT_RDWR, since this is the only form that TIPC supports. Signed-off-by: Allan Stephens Signed-off-by: David S. Miller --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9ae8e9f740..3220d5cb5b 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1419,7 +1419,7 @@ exit: /** * shutdown - shutdown socket connection * @sock: socket structure - * @how: direction to close (unused; always treated as read + write) + * @how: direction to close (must be SHUT_RDWR) * * Terminates connection (if necessary), then purges socket's receive queue. * @@ -1432,7 +1432,8 @@ static int shutdown(struct socket *sock, int how) struct sk_buff *buf; int res; - /* Could return -EINVAL for an invalid "how", but why bother? */ + if (how != SHUT_RDWR) + return -EINVAL; if (mutex_lock_interruptible(&tsock->lock)) return -ERESTARTSYS;