diff options
author | David S. Miller <davem@davemloft.net> | 2017-04-08 08:29:05 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-08 08:29:05 -0700 |
commit | 3aecfbb19ca746a62575de90957c14e03b9c5d23 (patch) | |
tree | 198566224a6c5b6a6408faafe8dfbfbcd960cbe9 | |
parent | cc663f4d4c97b7297fb45135ab23cfd508b35a77 (diff) | |
parent | 321a52a39189d5e4af542f7dcdc07bba4545cf5d (diff) |
Merge branch 'l2tp-sockopt-errors'
Guillaume Nault says:
====================
l2tp: fix error handling of PPPoL2TP socket options
Fix pppol2tp_[gs]etsockopt() so that they don't ignore errors returned
by their helper functions.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/l2tp/l2tp_ppp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 861b255a2d51..32ea0f3d868c 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -1383,8 +1383,6 @@ static int pppol2tp_setsockopt(struct socket *sock, int level, int optname, } else err = pppol2tp_session_setsockopt(sk, session, optname, val); - err = 0; - end_put_sess: sock_put(sk); end: @@ -1507,8 +1505,13 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname, err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); sock_put(ps->tunnel_sock); - } else + if (err) + goto end_put_sess; + } else { err = pppol2tp_session_getsockopt(sk, session, optname, &val); + if (err) + goto end_put_sess; + } err = -EFAULT; if (put_user(len, optlen)) |