Skip to content

Commit 9075216

Browse files
Guillaume Naultgregkh
authored andcommitted
l2tp: check ps->sock before running pppol2tp_session_ioctl()
[ Upstream commit 5903f59 ] When pppol2tp_session_ioctl() is called by pppol2tp_tunnel_ioctl(), the session may be unconnected. That is, it was created by pppol2tp_session_create() and hasn't been connected with pppol2tp_connect(). In this case, ps->sock is NULL, so we need to check for this case in order to avoid dereferencing a NULL pointer. Fixes: 309795f ("l2tp: Add netlink control API for L2TP") Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e12c42c commit 9075216

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/l2tp/l2tp_ppp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
993993
session->name, cmd, arg);
994994

995995
sk = ps->sock;
996+
if (!sk)
997+
return -EBADR;
998+
996999
sock_hold(sk);
9971000

9981001
switch (cmd) {

0 commit comments

Comments
 (0)