[PATCH] decnet: fix shutdown parameter checking

Subsystems: networking [general], the rest

STALE5106d

5 messages, 3 authors, 2012-09-05 · open the first message on its own page

[PATCH] decnet: fix shutdown parameter checking

From: Xi Wang <xi.wang@gmail.com>
Date: 2012-08-27 02:37:20

The allowed value of "how" is SHUT_RD/SHUT_WR/SHUT_RDWR (0/1/2),
rather than SHUTDOWN_MASK (3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 net/decnet/af_decnet.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 2ba1a28..307c322 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1313,10 +1313,10 @@ static int dn_shutdown(struct socket *sock, int how)
 	if (scp->state == DN_O)
 		goto out;
 
-	if (how != SHUTDOWN_MASK)
+	if (how != SHUT_RDWR)
 		goto out;
 
-	sk->sk_shutdown = how;
+	sk->sk_shutdown = SHUTDOWN_MASK;
 	dn_destroy_sock(sk);
 	err = 0;
 
-- 
1.7.9.5

Re: [PATCH] decnet: fix shutdown parameter checking

From: Steven Whitehouse <hidden>
Date: 2012-08-27 09:17:44

On Sun, 2012-08-26 at 22:37 -0400, Xi Wang wrote:
The allowed value of "how" is SHUT_RD/SHUT_WR/SHUT_RDWR (0/1/2),
rather than SHUTDOWN_MASK (3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Steven Whitehouse <redacted>

Although it could be argued that we should also continue to accept the
value 3 just in case there is any userland software out there which
sends that value,

Steve.
quoted hunk
---
 net/decnet/af_decnet.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 2ba1a28..307c322 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1313,10 +1313,10 @@ static int dn_shutdown(struct socket *sock, int how)
 	if (scp->state == DN_O)
 		goto out;
 
-	if (how != SHUTDOWN_MASK)
+	if (how != SHUT_RDWR)
 		goto out;
 
-	sk->sk_shutdown = how;
+	sk->sk_shutdown = SHUTDOWN_MASK;
 	dn_destroy_sock(sk);
 	err = 0;
 

Re: [PATCH] decnet: fix shutdown parameter checking

From: David Miller <davem@davemloft.net>
Date: 2012-08-31 19:57:23

From: Steven Whitehouse <redacted>
Date: Mon, 27 Aug 2012 10:16:41 +0100
On Sun, 2012-08-26 at 22:37 -0400, Xi Wang wrote:
quoted
The allowed value of "how" is SHUT_RD/SHUT_WR/SHUT_RDWR (0/1/2),
rather than SHUTDOWN_MASK (3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Steven Whitehouse <redacted>
Applied to net-next.
Although it could be argued that we should also continue to accept the
value 3 just in case there is any userland software out there which
sends that value,
True, but this is a rather standard BSD socket interface with a very
specific small set of legitimate input parameters.  Allowing
deviation, even for compatability for specific protocols, is largely
unwise.

Re: [PATCH] decnet: fix shutdown parameter checking

From: Steven Whitehouse <hidden>
Date: 2012-09-05 08:38:57

Hi,

On Fri, 2012-08-31 at 15:57 -0400, David Miller wrote:
From: Steven Whitehouse <redacted>
Date: Mon, 27 Aug 2012 10:16:41 +0100
quoted
On Sun, 2012-08-26 at 22:37 -0400, Xi Wang wrote:
quoted
The allowed value of "how" is SHUT_RD/SHUT_WR/SHUT_RDWR (0/1/2),
rather than SHUTDOWN_MASK (3).

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Acked-by: Steven Whitehouse <redacted>
Applied to net-next.
quoted
Although it could be argued that we should also continue to accept the
value 3 just in case there is any userland software out there which
sends that value,
True, but this is a rather standard BSD socket interface with a very
specific small set of legitimate input parameters.  Allowing
deviation, even for compatability for specific protocols, is largely
unwise.
Yes, I'd agree on the whole, and certainly if this was a recent
addition. However since this code has been around for somewhere close to
16 years now, I'd say that means that either (a) nobody calls shutdown
for DECnet or (b) existing users are buggy too.

We do have a precedent for this kind of compatibility, such as the AX.25
use of SOCK_SEQPACKET.

However, I'm not overly worried and we'll soon know if it will cause any
problems or not,

Steve.

Re: [PATCH] decnet: fix shutdown parameter checking

From: David Miller <davem@davemloft.net>
Date: 2012-09-05 17:00:25

From: Steven Whitehouse <redacted>
Date: Wed, 05 Sep 2012 09:37:56 +0100
However, I'm not overly worried and we'll soon know if it will cause any
problems or not,
You can be sure that if we get real bug reports due to this change, I will
revert it back to how it was before.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help