mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
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: 309795f4be
("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>
This commit is contained in:
parent
09001b03f7
commit
5903f59493
@ -988,6 +988,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) {
|
||||
|
Loading…
Reference in New Issue
Block a user