提交 e247a8f5 编写于 作者: A Allan Stephens 提交者: David S. Miller

[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: NAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8c869655
......@@ -1419,7 +1419,7 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
/**
* 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册