Bug 1227917 (CVE-2021-47622) - VUL-0: CVE-2021-47622: kernel: scsi: ufs: Fix a deadlock in the error handler
Summary: VUL-0: CVE-2021-47622: kernel: scsi: ufs: Fix a deadlock in the error handler
Status: NEW
Alias: CVE-2021-47622
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Kernel Bugs
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/414205/
Whiteboard: CVSSv3.1:SUSE:CVE-2021-47622:4.7:(AV:...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-16 12:24 UTC by SMASH SMASH
Modified: 2024-07-16 12:25 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SMASH SMASH 2024-07-16 12:24:23 UTC
Description
===========

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

scsi: ufs: Fix a deadlock in the error handler

The following deadlock has been observed on a test setup:

 - All tags allocated

 - The SCSI error handler calls ufshcd_eh_host_reset_handler()

 - ufshcd_eh_host_reset_handler() queues work that calls
   ufshcd_err_handler()

 - ufshcd_err_handler() locks up as follows:

Workqueue: ufs_eh_wq_0 ufshcd_err_handler.cfi_jt
Call trace:
 __switch_to+0x298/0x5d8
 __schedule+0x6cc/0xa94
 schedule+0x12c/0x298
 blk_mq_get_tag+0x210/0x480
 __blk_mq_alloc_request+0x1c8/0x284
 blk_get_request+0x74/0x134
 ufshcd_exec_dev_cmd+0x68/0x640
 ufshcd_verify_dev_init+0x68/0x35c
 ufshcd_probe_hba+0x12c/0x1cb8
 ufshcd_host_reset_and_restore+0x88/0x254
 ufshcd_reset_and_restore+0xd0/0x354
 ufshcd_err_handler+0x408/0xc58
 process_one_work+0x24c/0x66c
 worker_thread+0x3e8/0xa4c
 kthread+0x150/0x1b4
 ret_from_fork+0x10/0x30

Fix this lockup by making ufshcd_exec_dev_cmd() allocate a reserved
request.

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


Affected and fixed versions
===========================

	Fixed in 5.15.25 with commit 493c9e850677
	Fixed in 5.16.11 with commit d69d98d8edf9
	Fixed in 5.17 with commit 945c3cca05d7

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2021-47622
will be updated if fixes are backported, please check that for the most
up to date information about this issue.


Affected files
==============

The file(s) affected by this issue are:
	drivers/scsi/ufs/ufshcd.c
	drivers/scsi/ufs/ufshcd.h


Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/493c9e850677df8b4eda150c2364b1c1a72ed724
	https://git.kernel.org/stable/c/d69d98d8edf90e25e4e09930dd36dd6d09dd6768
	https://git.kernel.org/stable/c/945c3cca05d78351bba29fa65d93834cb7934c7b

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-47622
https://git.kernel.org/pub/scm/linux/security/vulns.git/plain/cve/published/2021/CVE-2021-47622.mbox
https://git.kernel.org/stable/c/493c9e850677df8b4eda150c2364b1c1a72ed724
https://git.kernel.org/stable/c/d69d98d8edf90e25e4e09930dd36dd6d09dd6768
https://git.kernel.org/stable/c/945c3cca05d78351bba29fa65d93834cb7934c7b