* [PATCH net] l2tp: check ps->sock before running pppol2tp_session_ioctl()
@ 2017-10-13 17:22 Guillaume Nault
2017-10-15 1:39 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Nault @ 2017-10-13 17:22 UTC (permalink / raw)
To: netdev; +Cc: James Chapman, Tom Parkin
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>
---
net/l2tp/l2tp_ppp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index bc6e8bfc5be4..f50452b919d5 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -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) {
--
2.15.0.rc0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] l2tp: check ps->sock before running pppol2tp_session_ioctl()
2017-10-13 17:22 [PATCH net] l2tp: check ps->sock before running pppol2tp_session_ioctl() Guillaume Nault
@ 2017-10-15 1:39 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-15 1:39 UTC (permalink / raw)
To: g.nault; +Cc: netdev, jchapman, tparkin
From: Guillaume Nault <g.nault@alphalink.fr>
Date: Fri, 13 Oct 2017 19:22:35 +0200
> 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>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-15 1:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 17:22 [PATCH net] l2tp: check ps->sock before running pppol2tp_session_ioctl() Guillaume Nault
2017-10-15 1:39 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).