From: Krzysztof Mazur Date: Tue, 6 Nov 2012 22:16:58 +0000 (+0100) Subject: pppoatm: allow assign only on a connected socket X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b1a914595f3f9beb9e38ff3ddc7bdafa092ba22;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git pppoatm: allow assign only on a connected socket 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 Cc: Chas Williams - CONTRACTOR Signed-off-by: David Woodhouse --- diff --git a/net/atm/pppoatm.c b/net/atm/pppoatm.c index 226dca989448..f27a07a3c546 100644 --- a/net/atm/pppoatm.c +++ b/net/atm/pppoatm.c @@ -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: