Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5bec3f1 authored by Guillaume Nault's avatar Guillaume Nault Committed by Greg Kroah-Hartman
Browse files

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: 309795f4 ("l2tp: Add netlink control API for L2TP")
Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54bcfd5d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1017,6 +1017,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
		 session->name, cmd, arg);

	sk = ps->sock;
	if (!sk)
		return -EBADR;

	sock_hold(sk);

	switch (cmd) {