netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allan Stephens <allan.stephens@windriver.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, allan.stephens@windriver.com
Subject: [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown()
Date: Thu,  6 Mar 2008 16:34:24 -0500	[thread overview]
Message-ID: <1204839269-30593-3-git-send-email-allan.stephens@windriver.com> (raw)
In-Reply-To: <1204839269-30593-1-git-send-email-allan.stephens@windriver.com>

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>
---
 net/tipc/socket.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 9ae8e9f..3220d5c 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;
-- 
1.5.3.2


  parent reply	other threads:[~2008-03-06 21:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 21:34 [PATCH 0/7 net-2.6.26] [TIPC]: Initial patch set for TIPC 1.6.3 Allan Stephens
2008-03-06 21:34 ` [PATCH 1/7 net-2.6.26] [TIPC]: Removal of message header option code Allan Stephens
2008-03-06 23:05   ` David Miller
2008-03-06 21:34 ` Allan Stephens [this message]
2008-03-06 23:05   ` [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown() David Miller
2008-03-06 21:34 ` [PATCH 3/7 net-2.6.26] [TIPC]: Eliminate "sparse" symbol warnings Allan Stephens
2008-03-06 23:06   ` David Miller
2008-03-06 21:34 ` [PATCH 4/7 net-2.6.26] [TIPC]: Minor cleanup of message header code Allan Stephens
2008-03-06 23:07   ` David Miller
2008-03-06 21:34 ` [PATCH 5/7 net-2.6.26] [TIPC]: Use correct bitmask when setting version Allan Stephens
2008-03-06 23:07   ` David Miller
2008-03-06 21:34 ` [PATCH 6/7 net-2.6.26] [TIPC]: Enhancements to message header writing Allan Stephens
2008-03-06 23:08   ` David Miller
2008-03-06 21:34 ` [PATCH 7/7 net-2.6.26] [TIPC]: Update version to 1.6.3 Allan Stephens
2008-03-06 23:08 ` [PATCH 0/7 net-2.6.26] [TIPC]: Initial patch set for TIPC 1.6.3 David Miller
  -- strict thread matches above, loose matches on Subject: below --
2008-03-04 21:20 Allan Stephens
2008-03-04 21:20 ` [PATCH 2/7 net-2.6.26] [TIPC]: Add argument validation for shutdown() Allan Stephens
2008-03-04 21:43   ` David Miller
2008-03-04 21:58     ` Stephens, Allan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204839269-30593-3-git-send-email-allan.stephens@windriver.com \
    --to=allan.stephens@windriver.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).