In the Linux kernel, the following vulnerability has been resolved:
nfc: pn533: Fix use-after-free bugs caused by pn532cmdtimeout
When the pn532 uart device is detaching, the pn532uartremove() is called. But there are no functions in pn532uartremove() that could delete the cmd_timeout timer, which will cause use-after-free bugs. The process is shown below:
(thread 1) | (thread 2)
| pn532_uart_send_frame
pn532uartremove | modtimer(&pn532->cmdtimeout,...) ... | (wait a time) kfree(pn532) //FREE | pn532cmdtimeout | pn532uartsend_frame | pn532->... //USE
This patch adds deltimersync() in pn532uartremove() in order to prevent the use-after-free bugs. What's more, the pn53xunregisternfc() is well synchronized, it sets nfcdev->shuttingdown to true and there are no syscalls could restart the cmd_timeout timer.
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50403ee6daddf0d7a14e9d3b51a377c39a08ec8c",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"88619933688473618601352440553021032392",
"253263083140660518877230065828378900439",
"190131959274673970392783829298598515050",
"242139340830483650609202003611833987715"
]
},
"target": {
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-0a0d6d17",
"signature_version": "v1",
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f1e941dbf80a9b8bab0bffbc4cbe41cc7f4c6fb6",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"88619933688473618601352440553021032392",
"253263083140660518877230065828378900439",
"190131959274673970392783829298598515050",
"242139340830483650609202003611833987715"
]
},
"target": {
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-102cdfa2",
"signature_version": "v1",
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@50403ee6daddf0d7a14e9d3b51a377c39a08ec8c",
"deprecated": false,
"digest": {
"function_hash": "334885566728348843486370018583808618662",
"length": 203.0
},
"target": {
"function": "pn532_uart_remove",
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-355fdf81",
"signature_version": "v1",
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f1e941dbf80a9b8bab0bffbc4cbe41cc7f4c6fb6",
"deprecated": false,
"digest": {
"function_hash": "334885566728348843486370018583808618662",
"length": 203.0
},
"target": {
"function": "pn532_uart_remove",
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-72a599d6",
"signature_version": "v1",
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9c34c33893db7a80d0e4b55c23d3b65e29609cfb",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"88619933688473618601352440553021032392",
"253263083140660518877230065828378900439",
"190131959274673970392783829298598515050",
"242139340830483650609202003611833987715"
]
},
"target": {
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-9fa5f95c",
"signature_version": "v1",
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9c34c33893db7a80d0e4b55c23d3b65e29609cfb",
"deprecated": false,
"digest": {
"function_hash": "334885566728348843486370018583808618662",
"length": 203.0
},
"target": {
"function": "pn532_uart_remove",
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-b3ed40d6",
"signature_version": "v1",
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c71f5d55a86fd5969428abf525c1ae6b1c7b0f5",
"deprecated": false,
"digest": {
"function_hash": "334885566728348843486370018583808618662",
"length": 203.0
},
"target": {
"function": "pn532_uart_remove",
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-b7e8cb0b",
"signature_version": "v1",
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2c71f5d55a86fd5969428abf525c1ae6b1c7b0f5",
"deprecated": false,
"digest": {
"threshold": 0.9,
"line_hashes": [
"88619933688473618601352440553021032392",
"253263083140660518877230065828378900439",
"190131959274673970392783829298598515050",
"242139340830483650609202003611833987715"
]
},
"target": {
"file": "drivers/nfc/pn533/uart.c"
},
"id": "CVE-2022-50005-f2d83545",
"signature_version": "v1",
"signature_type": "Line"
}
]