Commit 5903f594 authored by Guillaume Nault's avatar Guillaume Nault Committed by David S. Miller

l2tp: check ps->sock before running pppol2tp_session_ioctl()

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>
parent 09001b03
...@@ -988,6 +988,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session, ...@@ -988,6 +988,9 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
session->name, cmd, arg); session->name, cmd, arg);
sk = ps->sock; sk = ps->sock;
if (!sk)
return -EBADR;
sock_hold(sk); sock_hold(sk);
switch (cmd) { switch (cmd) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment