[<prev] [next>] [day] [month] [year] [list]
Message-ID: <AF1602CB2550CE4381C0C75118A7856B0246C88F@ala-mail02.corp.ad.wrs.com>
Date: Fri, 22 Feb 2008 11:59:06 -0800
From: "Stephens, Allan" <allan.stephens@...driver.com>
To: <netdev@...r.kernel.org>
Subject: [PATCH 02/08] [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@...driver.com>
---
net/tipc/socket.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2290903..e5a6983 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1419,20 +1419,25 @@ 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.
*
* Returns 0 on success, errno otherwise
*/
+#ifndef SHUT_RDWR
+#define SHUT_RDWR 2
+#endif
+
static int shutdown(struct socket *sock, int how)
{
struct tipc_sock* tsock = tipc_sk(sock->sk);
struct sk_buff *buf;
int res;
- /* Could return -EINVAL for an invalid "how", but why bother? */
+ if (how != SHUT_RDWR)
+ return -EINVAL;
if (down_interruptible(&tsock->sem))
return -ERESTARTSYS;
--
1.5.3.2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists