aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-03-06 18:05:38 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-06 18:05:38 -0500
commite247a8f5d018740220c66bd5df1928d21d277d63 (patch)
tree33b455ee1a445d2c00e7392593ed7d5ee9c7d7f1 /net
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>
Diffstat (limited to '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:
1419/** 1419/**
1420 * shutdown - shutdown socket connection 1420 * shutdown - shutdown socket connection
1421 * @sock: socket structure 1421 * @sock: socket structure
1422 * @how: direction to close (unused; always treated as read + write) 1422 * @how: direction to close (must be SHUT_RDWR)
1423 * 1423 *
1424 * Terminates connection (if necessary), then purges socket's receive queue. 1424 * Terminates connection (if necessary), then purges socket's receive queue.
1425 * 1425 *
@@ -1432,7 +1432,8 @@ static int shutdown(struct socket *sock, int how)
1432 struct sk_buff *buf; 1432 struct sk_buff *buf;
1433 int res; 1433 int res;
1434 1434
1435 /* Could return -EINVAL for an invalid "how", but why bother? */ 1435 if (how != SHUT_RDWR)
1436 return -EINVAL;
1436 1437
1437 if (mutex_lock_interruptible(&tsock->lock)) 1438 if (mutex_lock_interruptible(&tsock->lock))
1438 return -ERESTARTSYS; 1439 return -ERESTARTSYS;