Skip to content

Commit

Permalink
l2tp: fix missing refcount drop in pppol2tp_tunnel_ioctl()
Browse files Browse the repository at this point in the history
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: ecd012e ("l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl()")
Signed-off-by: Guillaume Nault <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Guillaume Nault authored and davem330 committed Aug 3, 2018
1 parent 60a0182 commit f664e37
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions net/l2tp/l2tp_ppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,13 +1201,18 @@ static int pppol2tp_tunnel_ioctl(struct l2tp_tunnel *tunnel,
l2tp_session_get(sock_net(sk), tunnel,
stats.session_id);

if (session && session->pwtype == L2TP_PWTYPE_PPP) {
err = pppol2tp_session_ioctl(session, cmd,
arg);
if (!session) {
err = -EBADR;
break;
}
if (session->pwtype != L2TP_PWTYPE_PPP) {
l2tp_session_dec_refcount(session);
} else {
err = -EBADR;
break;
}

err = pppol2tp_session_ioctl(session, cmd, arg);
l2tp_session_dec_refcount(session);
break;
}
#ifdef CONFIG_XFRM
Expand Down

0 comments on commit f664e37

Please sign in to comment.