aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Stephens2008-03-06 15:05:38 -0800
committerDavid S. Miller2008-03-06 15:05:38 -0800
commite247a8f5d018740220c66bd5df1928d21d277d63 (patch)
tree33b455ee1a445d2c00e7392593ed7d5ee9c7d7f1
parent8c8696553aa3895c2ad4289537e4af45a8877b62 (diff)
[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 <allan.stephens@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/tipc/socket.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 9ae8e9f74028..3220d5cb5b5d 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;