]>
Commit | Line | Data |
---|---|---|
da1ce37e GKH |
1 | From 3cf521f7dc87c031617fd47e4b7aa2593c2f3daf Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sasha.levin@oracle.com> | |
3 | Date: Mon, 14 Jul 2014 17:02:31 -0700 | |
4 | Subject: net/l2tp: don't fall back on UDP [get|set]sockopt | |
5 | ||
6 | From: Sasha Levin <sasha.levin@oracle.com> | |
7 | ||
8 | commit 3cf521f7dc87c031617fd47e4b7aa2593c2f3daf upstream. | |
9 | ||
10 | The l2tp [get|set]sockopt() code has fallen back to the UDP functions | |
11 | for socket option levels != SOL_PPPOL2TP since day one, but that has | |
12 | never actually worked, since the l2tp socket isn't an inet socket. | |
13 | ||
14 | As David Miller points out: | |
15 | ||
16 | "If we wanted this to work, it'd have to look up the tunnel and then | |
17 | use tunnel->sk, but I wonder how useful that would be" | |
18 | ||
19 | Since this can never have worked so nobody could possibly have depended | |
20 | on that functionality, just remove the broken code and return -EINVAL. | |
21 | ||
22 | Reported-by: Sasha Levin <sasha.levin@oracle.com> | |
23 | Acked-by: James Chapman <jchapman@katalix.com> | |
24 | Acked-by: David Miller <davem@davemloft.net> | |
25 | Cc: Phil Turnbull <phil.turnbull@oracle.com> | |
26 | Cc: Vegard Nossum <vegard.nossum@oracle.com> | |
27 | Cc: Willy Tarreau <w@1wt.eu> | |
28 | Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> | |
29 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
30 | ||
31 | --- | |
32 | net/l2tp/l2tp_ppp.c | 4 ++-- | |
33 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
34 | ||
35 | --- a/net/l2tp/l2tp_ppp.c | |
36 | +++ b/net/l2tp/l2tp_ppp.c | |
37 | @@ -1368,7 +1368,7 @@ static int pppol2tp_setsockopt(struct so | |
38 | int err; | |
39 | ||
40 | if (level != SOL_PPPOL2TP) | |
41 | - return udp_prot.setsockopt(sk, level, optname, optval, optlen); | |
42 | + return -EINVAL; | |
43 | ||
44 | if (optlen < sizeof(int)) | |
45 | return -EINVAL; | |
46 | @@ -1494,7 +1494,7 @@ static int pppol2tp_getsockopt(struct so | |
47 | struct pppol2tp_session *ps; | |
48 | ||
49 | if (level != SOL_PPPOL2TP) | |
50 | - return udp_prot.getsockopt(sk, level, optname, optval, optlen); | |
51 | + return -EINVAL; | |
52 | ||
53 | if (get_user(len, optlen)) | |
54 | return -EFAULT; |