decnet: fix shutdown parameter checking
authorXi Wang <xi.wang@gmail.com>
Sun, 26 Aug 2012 16:37:07 +0000 (16:37 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Aug 2012 19:55:37 +0000 (15:55 -0400)
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 <swhiteho@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/decnet/af_decnet.c

index 2ba1a2814c24e2260592c985706c5cbc58e45fdc..307c322d53bb889540aa3d302a69b13646f0cda3 100644 (file)
@@ -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;