diff options
| author | Gavrilov Ilia <Ilia.Gavrilov@infotecs.ru> | 2024-02-14 09:01:50 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-19 06:04:27 +0200 |
| commit | 5fbbd952e7c395eb6cf7fbc617888874740906bf (patch) | |
| tree | cbeae40d7058a46f08b42ab99136769662b20a20 /samples | |
| parent | 84c176fbecd1523a1d16650ed232c8bc99eddd11 (diff) | |
| download | linux-5fbbd952e7c395eb6cf7fbc617888874740906bf.tar.gz linux-5fbbd952e7c395eb6cf7fbc617888874740906bf.tar.bz2 linux-5fbbd952e7c395eb6cf7fbc617888874740906bf.zip | |
pppoe: Fix memory leak in pppoe_sendmsg()
[ Upstream commit dc34ebd5c018b0edf47f39d11083ad8312733034 ]
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: 1da177e4c3f4 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions
