In the Linux kernel, the following vulnerability has been resolved:
Bluetooth: Fix possible deadlock in rfcommskstate_change
syzbot reports a possible deadlock in rfcommskstatechange [1]. While rfcommsockconnect acquires the sk lock and waits for the rfcomm lock, rfcommsock_release could have the rfcomm lock and hit a deadlock for acquiring the sk lock. Here's a simplified flow:
rfcommsockconnect: locksock(sk) rfcommdlcopen: rfcommlock()
rfcommsockrelease: rfcommsockshutdown: rfcommlock() _rfcommdlcclose: rfcommkstatechange: locksock(sk)
This patch drops the sk lock before calling rfcommdlcopen to avoid the possible deadlock and holds sk's reference count to prevent use-after-free after rfcommdlcopen completes.
[
{
"signature_type": "Line",
"id": "CVE-2023-53016-43fd1db0",
"target": {
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@17511bd84871f4a6106cb335616e086880313f3f",
"digest": {
"threshold": 0.9,
"line_hashes": [
"293544482282652225814435047686839185495",
"241703222409203014918754212455343408980",
"41029236433386118443373130351392219876",
"255666877071186605727813374382108612107",
"125952738305689412782340243383706822781",
"197392869392223757689631258111201942592",
"292847244176492383467079947907746238411",
"139126654219527833759859258591639649916",
"272037162081119188664498511914131955463",
"184830193619140928247025310894043962235",
"22764728914122676010232525561974586877",
"126709691600343261641769681464745656824",
"296396582326643495265548785277344422190"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2023-53016-62976e32",
"target": {
"function": "rfcomm_sock_connect",
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@98aec50ff7f60cc6f2d6a4396b475c547e58b04d",
"digest": {
"function_hash": "75500296696873166781747932475475410779",
"length": 985.0
}
},
{
"signature_type": "Function",
"id": "CVE-2023-53016-78875ddd",
"target": {
"function": "rfcomm_sock_connect",
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@17511bd84871f4a6106cb335616e086880313f3f",
"digest": {
"function_hash": "75500296696873166781747932475475410779",
"length": 985.0
}
},
{
"signature_type": "Line",
"id": "CVE-2023-53016-d37fc671",
"target": {
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@98aec50ff7f60cc6f2d6a4396b475c547e58b04d",
"digest": {
"threshold": 0.9,
"line_hashes": [
"293544482282652225814435047686839185495",
"241703222409203014918754212455343408980",
"41029236433386118443373130351392219876",
"255666877071186605727813374382108612107",
"125952738305689412782340243383706822781",
"197392869392223757689631258111201942592",
"292847244176492383467079947907746238411",
"139126654219527833759859258591639649916",
"272037162081119188664498511914131955463",
"184830193619140928247025310894043962235",
"22764728914122676010232525561974586877",
"126709691600343261641769681464745656824",
"296396582326643495265548785277344422190"
]
}
},
{
"signature_type": "Function",
"id": "CVE-2023-53016-eda98e0b",
"target": {
"function": "rfcomm_sock_connect",
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1d80d57ffcb55488f0ec0b77928d4f82d16b6a90",
"digest": {
"function_hash": "75500296696873166781747932475475410779",
"length": 985.0
}
},
{
"signature_type": "Line",
"id": "CVE-2023-53016-f6ab9735",
"target": {
"file": "net/bluetooth/rfcomm/sock.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1d80d57ffcb55488f0ec0b77928d4f82d16b6a90",
"digest": {
"threshold": 0.9,
"line_hashes": [
"293544482282652225814435047686839185495",
"241703222409203014918754212455343408980",
"41029236433386118443373130351392219876",
"255666877071186605727813374382108612107",
"125952738305689412782340243383706822781",
"197392869392223757689631258111201942592",
"292847244176492383467079947907746238411",
"139126654219527833759859258591639649916",
"272037162081119188664498511914131955463",
"184830193619140928247025310894043962235",
"22764728914122676010232525561974586877",
"126709691600343261641769681464745656824",
"296396582326643495265548785277344422190"
]
}
}
]