Skip to content

Commit 196f475

Browse files
Guillaume Naultgregkh
authored andcommitted
l2tp: check ps->sock before running pppol2tp_session_ioctl()
[ Upstream commit 5903f594935a3841137c86b9d5b75143a5b7121c ] 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 71c4a0f commit 196f475

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
@@ -1015,6 +1015,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
10151015
session->name, cmd, arg);
10161016

10171017
sk = ps->sock;
1018+
if (!sk)
1019+
return -EBADR;
1020+
10181021
sock_hold(sk);
10191022

10201023
switch (cmd) {

0 commit comments

Comments
 (0)