[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>
This commit is contained in:
parent
8c8696553a
commit
e247a8f5d0
|
@ -1419,7 +1419,7 @@ exit:
|
||||||
/**
|
/**
|
||||||
* shutdown - shutdown socket connection
|
* shutdown - shutdown socket connection
|
||||||
* @sock: socket structure
|
* @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.
|
* 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;
|
struct sk_buff *buf;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
/* Could return -EINVAL for an invalid "how", but why bother? */
|
if (how != SHUT_RDWR)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (mutex_lock_interruptible(&tsock->lock))
|
if (mutex_lock_interruptible(&tsock->lock))
|
||||||
return -ERESTARTSYS;
|
return -ERESTARTSYS;
|
||||||
|
|
Loading…
Reference in New Issue