l2tp: check ps->sock before running pppol2tp_session_ioctl()
authorGuillaume Nault <g.nault@alphalink.fr>
Fri, 13 Oct 2017 17:22:35 +0000 (19:22 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:50:58 +0000 (20:50 +0000)
commit95de39762794bf55dc17ee33b6d1502923f1ad18
tree5ca79b87ca8c7856cdf6bd61797b04e4a26169aa
parent05941cd73c7e50d4b4488668b53d91b8d81fc2ad
l2tp: check ps->sock before running pppol2tp_session_ioctl()

commit 5903f594935a3841137c86b9d5b75143a5b7121c upstream.

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: 309795f4bec2 ("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: Ben Hutchings <ben@decadent.org.uk>
net/l2tp/l2tp_ppp.c