l2tp: Correctly return -EBADF from pppol2tp_getname.
authorphil.turnbull@oracle.com <phil.turnbull@oracle.com>
Tue, 26 Jul 2016 19:14:35 +0000 (15:14 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 20 Nov 2016 01:01:28 +0000 (01:01 +0000)
commit23080619fa2e68574c1308463c7f1b5c6b254554
tree0d0f7103cc75984fd64f577403e2665d04b27b63
parent0a81aea44891fc53d8dbb713a7300a73c66b83ac
l2tp: Correctly return -EBADF from pppol2tp_getname.

commit 4ac36a4adaf80013a60013d6f829f5863d5d0e05 upstream.

If 'tunnel' is NULL we should return -EBADF but the 'end_put_sess' path
unconditionally sets 'error' back to zero. Rework the error path so it
more closely matches pppol2tp_sendmsg.

Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/l2tp/l2tp_ppp.c