linux/drivers/net/ppp
Gavrilov Ilia dc34ebd5c0 pppoe: Fix memory leak in pppoe_sendmsg()
syzbot reports a memory leak in pppoe_sendmsg [1].

The problem is in the pppoe_recvmsg() function that handles errors
in the wrong order. For the skb_recv_datagram() function, check
the pointer to skb for NULL first, and then check the 'error' variable,
because the skb_recv_datagram() function can set 'error'
to -EAGAIN in a loop but return a correct pointer to socket buffer
after a number of attempts, though 'error' remains set to -EAGAIN.

skb_recv_datagram
      __skb_recv_datagram          // Loop. if (err == -EAGAIN) then
                                   // go to the next loop iteration
          __skb_try_recv_datagram  // if (skb != NULL) then return 'skb'
                                   // else if a signal is received then
                                   // return -EAGAIN

Found by InfoTeCS on behalf of Linux Verification Center
(linuxtesting.org) with Syzkaller.

Link: https://syzkaller.appspot.com/bug?extid=6bdfd184eac7709e5cc9 [1]

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: syzbot+6bdfd184eac7709e5cc9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6bdfd184eac7709e5cc9
Signed-off-by: Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://lore.kernel.org/r/20240214085814.3894917-1-Ilia.Gavrilov@infotecs.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-02-15 07:50:32 -08:00
..
bsd_comp.c net: ppp: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
Kconfig net/pppoe: fix a typo for the PPPOE_HASH_BITS_1 definition 2023-06-06 13:28:30 +02:00
Makefile
ppp_async.c ppp_async: limit MRU to 64K 2024-02-06 18:45:52 -08:00
ppp_deflate.c ppp: deflate: Remove useless call "zlib_inflateEnd" 2021-03-30 16:59:30 -07:00
ppp_generic.c drivers/net/ppp: use standard array-copy-function 2023-11-08 09:40:19 +00:00
ppp_mppe.c
ppp_mppe.h
ppp_synctty.c ppp: limit MRU to 64K 2023-11-13 11:09:20 +00:00
pppoe.c pppoe: Fix memory leak in pppoe_sendmsg() 2024-02-15 07:50:32 -08:00
pppox.c
pptp.c net: ppp: Remove unnecessary (void*) conversions 2023-07-18 19:00:47 -07:00