Patch "net: 6pack: fix slab-out-of-bounds in decode_data" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: 6pack: fix slab-out-of-bounds in decode_data

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-6pack-fix-slab-out-of-bounds-in-decode_data.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c4e142995ccb88ba02d01f92a9cd9c4eee8c38dd
Author: Pavel Skripkin <paskripkin@xxxxxxxxx>
Date:   Fri Aug 13 18:14:33 2021 +0300

    net: 6pack: fix slab-out-of-bounds in decode_data
    
    [ Upstream commit 19d1532a187669ce86d5a2696eb7275310070793 ]
    
    Syzbot reported slab-out-of bounds write in decode_data().
    The problem was in missing validation checks.
    
    Syzbot's reproducer generated malicious input, which caused
    decode_data() to be called a lot in sixpack_decode(). Since
    rx_count_cooked is only 400 bytes and noone reported before,
    that 400 bytes is not enough, let's just check if input is malicious
    and complain about buffer overrun.
    
    Fail log:
    ==================================================================
    BUG: KASAN: slab-out-of-bounds in drivers/net/hamradio/6pack.c:843
    Write of size 1 at addr ffff888087c5544e by task kworker/u4:0/7
    
    CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.6.0-rc3-syzkaller #0
    ...
    Workqueue: events_unbound flush_to_ldisc
    Call Trace:
     __dump_stack lib/dump_stack.c:77 [inline]
     dump_stack+0x197/0x210 lib/dump_stack.c:118
     print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
     __kasan_report.cold+0x1b/0x32 mm/kasan/report.c:506
     kasan_report+0x12/0x20 mm/kasan/common.c:641
     __asan_report_store1_noabort+0x17/0x20 mm/kasan/generic_report.c:137
     decode_data.part.0+0x23b/0x270 drivers/net/hamradio/6pack.c:843
     decode_data drivers/net/hamradio/6pack.c:965 [inline]
     sixpack_decode drivers/net/hamradio/6pack.c:968 [inline]
    
    Reported-and-tested-by: syzbot+fc8cd9a673d4577fb2e4@xxxxxxxxxxxxxxxxxxxxxxxxx
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Pavel Skripkin <paskripkin@xxxxxxxxx>
    Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 71d6629e65c9..da13683d52d1 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -839,6 +839,12 @@ static void decode_data(struct sixpack *sp, unsigned char inbyte)
 		return;
 	}
 
+	if (sp->rx_count_cooked + 2 >= sizeof(sp->cooked_buf)) {
+		pr_err("6pack: cooked buffer overrun, data loss\n");
+		sp->rx_count = 0;
+		return;
+	}
+
 	buf = sp->raw_buf;
 	sp->cooked_buf[sp->rx_count_cooked++] =
 		buf[0] | ((buf[1] << 2) & 0xc0);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux