[PPPoX/E]: return ENOTTY on unknown ioctl requests
authorFlorian Zumbiehl <florz@florz.de>
Tue, 31 Jul 2007 00:48:23 +0000 (17:48 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 31 Jul 2007 09:28:22 +0000 (02:28 -0700)
here another patch for the PPPoX/E code that makes sure that ENOTTY is
returned for unknown ioctl requests rather than 0 (and removes another
unneeded initializer which I didn't bother creating a separate patch for).

Signed-off-by: Florian Zumbiehl <florz@florz.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pppoe.c
drivers/net/pppox.c

index 6f98834e6ace29bc892b54f63a03aa6ed799fd70..f75aeaaf861fde17172acc5122844f198e36bb87 100644 (file)
@@ -664,8 +664,8 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
 {
        struct sock *sk = sock->sk;
        struct pppox_sock *po = pppox_sk(sk);
-       int val = 0;
-       int err = 0;
+       int val;
+       int err;
 
        switch (cmd) {
        case PPPIOCGMRU:
@@ -754,8 +754,9 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
                err = 0;
                break;
 
-       default:;
-       };
+       default:
+               err = -ENOTTY;
+       }
 
        return err;
 }
index f3e47d0c2b3ce2cb253d96844e33ffb8b03b2552..25c52b55c38fb6cb11ddc369ce88f5b527f7cf20 100644 (file)
@@ -73,7 +73,7 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
        struct sock *sk = sock->sk;
        struct pppox_sock *po = pppox_sk(sk);
-       int rc = 0;
+       int rc;
 
        lock_sock(sk);
 
@@ -94,12 +94,9 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                break;
        }
        default:
-               if (pppox_protos[sk->sk_protocol]->ioctl)
-                       rc = pppox_protos[sk->sk_protocol]->ioctl(sock, cmd,
-                                                                 arg);
-
-               break;
-       };
+               rc = pppox_protos[sk->sk_protocol]->ioctl ?
+                       pppox_protos[sk->sk_protocol]->ioctl(sock, cmd, arg) : -ENOTTY;
+       }
 
        release_sock(sk);
        return rc;