In the Linux kernel, the following vulnerability has been resolved:
drivers: staging: rtl8723bs: Fix deadlock in rtwsurveydoneevent_callback()
There is a deadlock in rtwsurveydoneevent_callback(), which is shown below:
(Thread 1) | (Thread 2) | settimer() rtwsurveydoneeventcallback()| modtimer() spinlockbh() //(1) | (wait a time) ... | rtwscantimeouthandler() deltimersync() | spinlock_bh() //(2) (wait timer to stop) | ...
We hold pmlmepriv->lock in position (1) of thread 1 and use deltimersync() to wait timer to stop, but timer handler also need pmlmepriv->lock in position (2) of thread 2. As a result, rtwsurveydoneevent_callback() will block forever.
This patch extracts deltimersync() from the protection of spinlockbh(), which could let timer handler to obtain the needed lock. What`s more, we change spinlockbh() in rtwscantimeouthandler() to spinlockirq(). Otherwise, spinlock_bh() will also cause deadlock() in timer handler.
[
{
"digest": {
"length": 2589.0,
"function_hash": "310809330750696095400570024615857580425"
},
"target": {
"function": "rtw_surveydone_event_callback",
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c84e5c819600ee0628f61b33d145258ae0f3d7a7",
"deprecated": false,
"id": "CVE-2022-49309-00d234ef",
"signature_type": "Function"
},
{
"digest": {
"length": 2102.0,
"function_hash": "227987993867399723606256766544782090691"
},
"target": {
"function": "rtw_surveydone_event_callback",
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cc7ad0d77b51c872d629bcd98aea463a3c4109e7",
"deprecated": false,
"id": "CVE-2022-49309-0ce5cf9b",
"signature_type": "Function"
},
{
"digest": {
"length": 2102.0,
"function_hash": "248517558326306981007046265719679098503"
},
"target": {
"function": "rtw_surveydone_event_callback",
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f89f6c3ebf69623b8ea48200bd690e9e210335a1",
"deprecated": false,
"id": "CVE-2022-49309-2684effe",
"signature_type": "Function"
},
{
"digest": {
"line_hashes": [
"336699080564183556457662313499443101170",
"232545980508169634653404559279141156387",
"89525111463158145175814739572967967093",
"234222185174212721675251234304672422844",
"210514288437495400955133120548570002789",
"317941131252691142131625992504770655857",
"135187318786698267332540307970465192201",
"101136350406371793106962074930019299299",
"107297811829831772619750951260741910944",
"86767436825439343256853047719397744190",
"23525444825127553973209455287332362138"
],
"threshold": 0.9
},
"target": {
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c41f5c341853f84b7bc2f32605d4e2782e8c279",
"deprecated": false,
"id": "CVE-2022-49309-32a56bef",
"signature_type": "Line"
},
{
"digest": {
"line_hashes": [
"303234858451592671849466839219248624263",
"296771506333889654409700847546904083841",
"207760458547069806732334079941152748607",
"5466896967737277949091880945991446128",
"282636157119561080637403384371978067876",
"217336403815699562538831565280464539102",
"309342339773809492913437874816940576424",
"99333364759871739776482328923405015560",
"107297811829831772619750951260741910944",
"86767436825439343256853047719397744190",
"23525444825127553973209455287332362138"
],
"threshold": 0.9
},
"target": {
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c84e5c819600ee0628f61b33d145258ae0f3d7a7",
"deprecated": false,
"id": "CVE-2022-49309-f11d9e42",
"signature_type": "Line"
},
{
"digest": {
"length": 2102.0,
"function_hash": "248517558326306981007046265719679098503"
},
"target": {
"function": "rtw_surveydone_event_callback",
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c41f5c341853f84b7bc2f32605d4e2782e8c279",
"deprecated": false,
"id": "CVE-2022-49309-f2980afe",
"signature_type": "Function"
},
{
"digest": {
"line_hashes": [
"336699080564183556457662313499443101170",
"232545980508169634653404559279141156387",
"89525111463158145175814739572967967093",
"234222185174212721675251234304672422844",
"210514288437495400955133120548570002789",
"317941131252691142131625992504770655857",
"135187318786698267332540307970465192201",
"101136350406371793106962074930019299299",
"107297811829831772619750951260741910944",
"86767436825439343256853047719397744190",
"23525444825127553973209455287332362138"
],
"threshold": 0.9
},
"target": {
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f89f6c3ebf69623b8ea48200bd690e9e210335a1",
"deprecated": false,
"id": "CVE-2022-49309-fc3b81d8",
"signature_type": "Line"
},
{
"digest": {
"line_hashes": [
"336699080564183556457662313499443101170",
"232545980508169634653404559279141156387",
"89525111463158145175814739572967967093",
"234222185174212721675251234304672422844",
"210514288437495400955133120548570002789",
"317941131252691142131625992504770655857",
"135187318786698267332540307970465192201",
"101136350406371793106962074930019299299",
"107297811829831772619750951260741910944",
"86767436825439343256853047719397744190",
"23525444825127553973209455287332362138"
],
"threshold": 0.9
},
"target": {
"file": "drivers/staging/rtl8723bs/core/rtw_mlme.c"
},
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@cc7ad0d77b51c872d629bcd98aea463a3c4109e7",
"deprecated": false,
"id": "CVE-2022-49309-ff9dc54a",
"signature_type": "Line"
}
]