pppoatm: allow assign only on a connected socket
authorKrzysztof Mazur <krzysiek@podlesie.net>
Tue, 6 Nov 2012 22:16:58 +0000 (23:16 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 28 Nov 2012 00:37:02 +0000 (00:37 +0000)
The pppoatm does not check if used vcc is in connected state,
causing an Oops in pppoatm_send() when vcc->send() is called
on not fully connected socket.

Now pppoatm can be assigned only on connected sockets; otherwise
-EINVAL error is returned.

Signed-off-by: Krzysztof Mazur <krzysiek@podlesie.net>
Cc: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
net/atm/pppoatm.c

index 226dca9894487fd7fc1b391e827acef905a44d90..f27a07a3c546ee3adeabd51460ed4331eddbb309 100644 (file)
@@ -406,6 +406,8 @@ static int pppoatm_ioctl(struct socket *sock, unsigned int cmd,
                        return -ENOIOCTLCMD;
                if (!capable(CAP_NET_ADMIN))
                        return -EPERM;
+               if (sock->state != SS_CONNECTED)
+                       return -EINVAL;
                return pppoatm_assign_vcc(atmvcc, argp);
                }
        case PPPIOCGCHAN: