CVE-2021-47219
Severity CVSS v4.0:
Pending analysis
Type:
CWE-125
Out-of-bounds Read
Publication date:
10/04/2024
Last modified:
03/03/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
scsi: scsi_debug: Fix out-of-bound read in resp_report_tgtpgs()<br />
<br />
The following issue was observed running syzkaller:<br />
<br />
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]<br />
BUG: KASAN: slab-out-of-bounds in sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831<br />
Read of size 2132 at addr ffff8880aea95dc8 by task syz-executor.0/9815<br />
<br />
CPU: 0 PID: 9815 Comm: syz-executor.0 Not tainted 4.19.202-00874-gfc0fe04215a9 #2<br />
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014<br />
Call Trace:<br />
__dump_stack lib/dump_stack.c:77 [inline]<br />
dump_stack+0xe4/0x14a lib/dump_stack.c:118<br />
print_address_description+0x73/0x280 mm/kasan/report.c:253<br />
kasan_report_error mm/kasan/report.c:352 [inline]<br />
kasan_report+0x272/0x370 mm/kasan/report.c:410<br />
memcpy+0x1f/0x50 mm/kasan/kasan.c:302<br />
memcpy include/linux/string.h:377 [inline]<br />
sg_copy_buffer+0x150/0x1c0 lib/scatterlist.c:831<br />
fill_from_dev_buffer+0x14f/0x340 drivers/scsi/scsi_debug.c:1021<br />
resp_report_tgtpgs+0x5aa/0x770 drivers/scsi/scsi_debug.c:1772<br />
schedule_resp+0x464/0x12f0 drivers/scsi/scsi_debug.c:4429<br />
scsi_debug_queuecommand+0x467/0x1390 drivers/scsi/scsi_debug.c:5835<br />
scsi_dispatch_cmd+0x3fc/0x9b0 drivers/scsi/scsi_lib.c:1896<br />
scsi_request_fn+0x1042/0x1810 drivers/scsi/scsi_lib.c:2034<br />
__blk_run_queue_uncond block/blk-core.c:464 [inline]<br />
__blk_run_queue+0x1a4/0x380 block/blk-core.c:484<br />
blk_execute_rq_nowait+0x1c2/0x2d0 block/blk-exec.c:78<br />
sg_common_write.isra.19+0xd74/0x1dc0 drivers/scsi/sg.c:847<br />
sg_write.part.23+0x6e0/0xd00 drivers/scsi/sg.c:716<br />
sg_write+0x64/0xa0 drivers/scsi/sg.c:622<br />
__vfs_write+0xed/0x690 fs/read_write.c:485<br />
kill_bdev:block_device:00000000e138492c<br />
vfs_write+0x184/0x4c0 fs/read_write.c:549<br />
ksys_write+0x107/0x240 fs/read_write.c:599<br />
do_syscall_64+0xc2/0x560 arch/x86/entry/common.c:293<br />
entry_SYSCALL_64_after_hwframe+0x49/0xbe<br />
<br />
We get &#39;alen&#39; from command its type is int. If userspace passes a large<br />
length we will get a negative &#39;alen&#39;.<br />
<br />
Switch n, alen, and rlen to u32.
Impact
Base Score 3.x
7.10
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10.82 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.5 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/66523553fa62c7878fc5441dc4e82be71934eb77
- https://git.kernel.org/stable/c/8440377e1a5644779b4c8d013aa2a917f5fc83c3
- https://git.kernel.org/stable/c/f347c26836c270199de1599c3cd466bb7747caa9
- https://git.kernel.org/stable/c/66523553fa62c7878fc5441dc4e82be71934eb77
- https://git.kernel.org/stable/c/8440377e1a5644779b4c8d013aa2a917f5fc83c3
- https://git.kernel.org/stable/c/f347c26836c270199de1599c3cd466bb7747caa9



