diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2018-08-03 11:00:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-03 15:39:01 -0400 |
commit | f664e37dcc525768280cb94321424a09beb1c992 (patch) | |
tree | 6530e5e71d9a26b2ebd6313be7510ee1f0ae9088 /net/l2tp | |
parent | 60a01828f33051feec8bf74f74e980a163d5a208 (diff) |
l2tp: fix missing refcount drop in pppol2tp_tunnel_ioctl()
If 'session' is not NULL and is not a PPP pseudo-wire, then we fail to
drop the reference taken by l2tp_session_get().
Fixes: ecd012e45ab5 ("l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl()")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp')
-rw-r--r-- | net/l2tp/l2tp_ppp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index e398797878a9..cf6cca260e7b 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -1201,13 +1201,18 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel, | |||
1201 | l2tp_session_get(sock_net(sk), tunnel, | 1201 | l2tp_session_get(sock_net(sk), tunnel, |
1202 | stats.session_id); | 1202 | stats.session_id); |
1203 | 1203 | ||
1204 | if (session && session->pwtype == L2TP_PWTYPE_PPP) { | 1204 | if (!session) { |
1205 | err = pppol2tp_session_ioctl(session, cmd, | 1205 | err = -EBADR; |
1206 | arg); | 1206 | break; |
1207 | } | ||
1208 | if (session->pwtype != L2TP_PWTYPE_PPP) { | ||
1207 | l2tp_session_dec_refcount(session); | 1209 | l2tp_session_dec_refcount(session); |
1208 | } else { | ||
1209 | err = -EBADR; | 1210 | err = -EBADR; |
1211 | break; | ||
1210 | } | 1212 | } |
1213 | |||
1214 | err = pppol2tp_session_ioctl(session, cmd, arg); | ||
1215 | l2tp_session_dec_refcount(session); | ||
1211 | break; | 1216 | break; |
1212 | } | 1217 | } |
1213 | #ifdef CONFIG_XFRM | 1218 | #ifdef CONFIG_XFRM |