* [PATCH net 1/2] l2tp: don't mask errors in pppol2tp_setsockopt()
2017-04-06 16:31 [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options Guillaume Nault
@ 2017-04-06 16:31 ` Guillaume Nault
2017-04-06 16:31 ` [PATCH net 2/2] l2tp: don't mask errors in pppol2tp_getsockopt() Guillaume Nault
2017-04-08 15:29 ` [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Guillaume Nault @ 2017-04-06 16:31 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
pppol2tp_setsockopt() unconditionally overwrites the error value
returned by pppol2tp_tunnel_setsockopt() or
pppol2tp_session_setsockopt(), thus hiding errors from userspace.
Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_ppp.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 861b255a2d51..973a9185b276 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:
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] l2tp: don't mask errors in pppol2tp_getsockopt()
2017-04-06 16:31 [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options Guillaume Nault
2017-04-06 16:31 ` [PATCH net 1/2] l2tp: don't mask errors in pppol2tp_setsockopt() Guillaume Nault
@ 2017-04-06 16:31 ` Guillaume Nault
2017-04-08 15:29 ` [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Guillaume Nault @ 2017-04-06 16:31 UTC (permalink / raw)
To: netdev; +Cc: James Chapman
pppol2tp_getsockopt() doesn't take into account the error code returned
by pppol2tp_tunnel_getsockopt() or pppol2tp_session_getsockopt(). If
error occurs there, pppol2tp_getsockopt() continues unconditionally and
reports erroneous values.
Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
---
net/l2tp/l2tp_ppp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 973a9185b276..32ea0f3d868c 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1505,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))
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options
2017-04-06 16:31 [PATCH net 0/2] l2tp: fix error handling of PPPoL2TP socket options Guillaume Nault
2017-04-06 16:31 ` [PATCH net 1/2] l2tp: don't mask errors in pppol2tp_setsockopt() Guillaume Nault
2017-04-06 16:31 ` [PATCH net 2/2] l2tp: don't mask errors in pppol2tp_getsockopt() Guillaume Nault
@ 2017-04-08 15:29 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-08 15:29 UTC (permalink / raw)
To: g.nault; +Cc: netdev, jchapman
From: Guillaume Nault <g.nault@alphalink.fr>
Date: Thu, 6 Apr 2017 18:31:18 +0200
> Fix pppol2tp_[gs]etsockopt() so that they don't ignore errors returned
> by their helper functions.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread