CVE-2021-47580: scsi: scsi_debug: Fix type in min_t to avoid stack OOB

Published Jun 19, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

scsi: scsidebug: Fix type in mint to avoid stack OOB

Change mint() to use type "u32" instead of type "int" to avoid stack out of bounds. With mint() type "int" the values get sign extended and the larger value gets used causing stack out of bounds.

BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline] BUG: KASAN: stack-out-of-bounds in sgcopybuffer+0x1de/0x240 lib/scatterlist.c:976 Read of size 127 at addr ffff888072607128 by task syz-executor.7/18707

CPU: 1 PID: 18707 Comm: syz-executor.7 Not tainted 5.15.0-syzk #1 Hardware name: Red Hat KVM, BIOS 1.13.0-2 Call Trace: dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x89/0xb5 lib/dumpstack.c:106 printaddressdescription.constprop.9+0x28/0x160 mm/kasan/report.c:256 kasanreport mm/kasan/report.c:442 [inline] kasanreport.cold.14+0x7d/0x117 mm/kasan/report.c:459 checkregioninline mm/kasan/generic.c:183 [inline] kasancheckrange+0x1a3/0x210 mm/kasan/generic.c:189 memcpy+0x23/0x60 mm/kasan/shadow.c:65 memcpy include/linux/fortify-string.h:191 [inline] sgcopybuffer+0x1de/0x240 lib/scatterlist.c:976 sgcopyfrombuffer+0x33/0x40 lib/scatterlist.c:1000 fillfromdevbuffer.part.34+0x82/0x130 drivers/scsi/scsidebug.c:1162 fillfromdevbuffer drivers/scsi/scsidebug.c:1888 [inline] respreadcap16+0x365/0x3b0 drivers/scsi/scsidebug.c:1887 scheduleresp+0x4d8/0x1a70 drivers/scsi/scsidebug.c:5478 scsidebugqueuecommand+0x8c9/0x1ec0 drivers/scsi/scsidebug.c:7533 scsidispatchcmd drivers/scsi/scsilib.c:1520 [inline] scsiqueuerq+0x16b0/0x2d40 drivers/scsi/scsilib.c:1699 blkmqdispatchrqlist+0xb9b/0x2700 block/blk-mq.c:1639 blkmqscheddispatchrequests+0x28f/0x590 block/blk-mq-sched.c:325 blkmqscheddispatchrequests+0x105/0x190 block/blk-mq-sched.c:358 blkmqrunhwqueue+0xe5/0x150 block/blk-mq.c:1761 blkmqdelayrunhwqueue+0x4f8/0x5c0 block/blk-mq.c:1838 blkmqrunhwqueue+0x18d/0x350 block/blk-mq.c:1891 blkmqschedinsertrequest+0x3db/0x4e0 block/blk-mq-sched.c:474 blkexecuterqnowait+0x16b/0x1c0 block/blk-exec.c:62 sgcommonwrite.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:836 sgnewwrite.isra.19+0x570/0x8c0 drivers/scsi/sg.c:774 sgioctlcommon+0x14d6/0x2710 drivers/scsi/sg.c:939 sgioctl+0xa2/0x180 drivers/scsi/sg.c:1165 vfsioctl fs/ioctl.c:51 [inline] dosysioctl fs/ioctl.c:874 [inline] sesysioctl fs/ioctl.c:860 [inline] x64sysioctl+0x19d/0x220 fs/ioctl.c:860 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x3a/0x80 arch/x86/entry/common.c:80 entrySYSCALL64afterhwframe+0x44/0xae

Other sources

In the Linux kernel, the following vulnerability has been resolved:

scsi: scsidebug: Fix type in mint to avoid stack OOB

The Linux kernel CVE team has assigned CVE-2021-47580 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024061916-CVE-2021-47580-eac9@gregkh/T

— Red Hat

Affected Software

75 affected componentsFixes available
Linux Kernel
Linux Linux kernel<5.10.88
Linux Linux kernel>=5.11<5.15.11
Linux Linux kernel=5.16-rc1
Linux Linux kernel=5.16-rc2
ubuntu/linux-hwe-edge*
ubuntu/linux-aws-5.0*
ubuntu/linux-aws-5.3*
ubuntu/linux-azure*
ubuntu/linux-azure-5.3*
ubuntu/linux-azure-edge*
ubuntu/linux-gcp*
ubuntu/linux-gcp-5.3*
ubuntu/linux-gke-4.15*
ubuntu/linux-gke-5.4*
ubuntu/linux-gkeop-5.4*
ubuntu/linux-hwe*
ubuntu/linux-hwe-edge*
ubuntu/linux-oem*
ubuntu/linux-oracle-5.0*
ubuntu/linux-oracle-5.3*
ubuntu/linux-aws-5.11*
ubuntu/linux-aws-5.13*
ubuntu/linux-aws-5.8*
ubuntu/linux-azure-5.11*
ubuntu/linux-azure-5.13*
ubuntu/linux-azure-5.8*
ubuntu/linux-azure-fde*
ubuntu/linux-gcp-5.11*
ubuntu/linux-gcp-5.13*
ubuntu/linux-gcp-5.8*
ubuntu/linux-gke*
ubuntu/linux-gke-5.15*
ubuntu/linux-gkeop*
ubuntu/linux-hwe-5.11*
ubuntu/linux-hwe-5.13*
ubuntu/linux-hwe-5.8*
ubuntu/linux-intel-5.13*
ubuntu/linux-oem-5.10*
ubuntu/linux-oem-5.13*
ubuntu/linux-oem-5.6*
ubuntu/linux-oracle-5.11*
ubuntu/linux-oracle-5.13*
ubuntu/linux-oracle-5.8*
ubuntu/linux-raspi2*
ubuntu/linux-riscv*
ubuntu/linux-riscv-5.11*
ubuntu/linux-riscv-5.8*
ubuntu/linux-allwinner-5.19*
ubuntu/linux-aws-5.19*
ubuntu/linux-aws-6.2*
ubuntu/linux-azure-5.19*
ubuntu/linux-azure-6.2*
ubuntu/linux-azure-fde-5.19*
ubuntu/linux-azure-fde-6.2*
ubuntu/linux-gcp-5.19*
ubuntu/linux-gcp-6.2*
ubuntu/linux-hwe-5.19*
ubuntu/linux-hwe-6.2*
ubuntu/linux-intel-iot-realtime*
ubuntu/linux-lowlatency-hwe-5.19*
ubuntu/linux-lowlatency-hwe-6.2*
ubuntu/linux-nvidia-6.2*
ubuntu/linux-oem-5.17*
ubuntu/linux-oem-6.0*
ubuntu/linux-oem-6.1*
ubuntu/linux-realtime*
ubuntu/linux-riscv*
ubuntu/linux-riscv-5.19*
ubuntu/linux-starfive-5.19*
ubuntu/linux-starfive-6.2*
ubuntu/linux-raspi-realtime*
redhat/kernel<5.10.88
5.10.88
redhat/kernel<5.15.11
5.15.11
redhat/kernel<5.16
5.16

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.10.88
  2. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.15.11
  3. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 5.16
  4. Compensating control

    In the Linux kernel scsi_debug code, change min_t() to use type "u32" instead of "int" to avoid sign extension and stack out-of-bounds access.

Event History

Jun 19, 2024
CVE Published
via MITRE·02:53 PM
Data Sourced
via MITRE·02:53 PM
DescriptionSeverity
Data Sourced
via OSV·03:15 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jun 20, 2024
Data Sourced
via Red Hat·11:01 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2021-47580?

CVE-2021-47580 has been classified as a low-severity vulnerability.

2

How do I fix CVE-2021-47580?

To fix CVE-2021-47580, you should update your Linux kernel to the latest stable version where this vulnerability is resolved.

3

What software is affected by CVE-2021-47580?

CVE-2021-47580 affects the Linux kernel, specifically versions prior to the fix.

4

What does CVE-2021-47580 involve?

CVE-2021-47580 involves a fix to the scsi_debug module in the Linux kernel to prevent stack out-of-bounds issues.

5

Is CVE-2021-47580 exploitable in practice?

Due to its low severity and specific conditions, CVE-2021-47580 is considered less likely to be exploited in practical scenarios.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203