In the Linux kernel, the following vulnerability has been resolved:
serial: 8250: Fix PM usage_count for console handover
When console is enabled, univ8250consolesetup() calls serial8250consolesetup() before .dev is set to uartport. Therefore, it will not call pmruntimegetsync(). Later, when the actual driver is going to take over univ8250consoleexit() is called. As .dev is already set, serial8250consoleexit() makes pmruntimeputsync() call with usage count being zero triggering PM usage count warning (extra debug for univ8250consolesetup(), univ8250consoleexit(), and serial8250register_ports()):
[ 0.068987] univ8250consolesetup ttyS0 nodev [ 0.499670] printk: console [ttyS0] enabled [ 0.717955] printk: console [ttyS0] printing thread started [ 1.960163] serial8250registerports assigned dev for ttyS0 [ 1.976830] printk: console [ttyS0] disabled [ 1.976888] printk: console [ttyS0] printing thread stopped [ 1.977073] univ8250consoleexit ttyS0 usage:0 [ 1.977075] serial8250 serial8250: Runtime PM usage count underflow! [ 1.977429] dw-apb-uart.6: ttyS0 at MMIO 0x4010006000 (irq = 33, basebaud = 115200) is a 16550A [ 1.977812] univ8250console_setup ttyS0 usage:2 [ 1.978167] printk: console [ttyS0] printing thread started [ 1.978203] printk: console [ttyS0] enabled
To fix the issue, call pmruntimegetsync() in serial8250registerports() as soon as .dev is set for an uartport if it has console enabled.
This problem became apparent only recently because 82586a721595 ("PM: runtime: Avoid device usage count underflows") added the warning printout. I confirmed this problem also occurs with v5.18 (w/o the warning printout, obviously).
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49613.json",
"cna_assigner": "Linux"
}"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-49613.json"
[
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"74345190094473787931971397900074983788",
"299085146414910850422095829812601217662",
"213910313490591732004082116159085985382"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9b11229b79c0fb2100b5bb4628a101b1d37fbf6",
"signature_type": "Line",
"id": "CVE-2022-49613-01601124",
"target": {
"file": "include/linux/serial_core.h"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"function_hash": "44092630552138577450389387636400464790",
"length": 338.0
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5df66302f03f87ae8953785a882d78e911f00c55",
"signature_type": "Function",
"id": "CVE-2022-49613-01aebf26",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c",
"function": "serial8250_register_ports"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"329576258534766900382005145761881336287",
"192886738217580084378684868549466543625",
"15056402193473899690707920799042677579",
"124183064683943524380342394234951144642",
"256114514330618907496396100119806100063",
"21256339421991162589559792241071076440",
"211519808998914062619586427551897927837"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9b11229b79c0fb2100b5bb4628a101b1d37fbf6",
"signature_type": "Line",
"id": "CVE-2022-49613-3841e178",
"target": {
"file": "drivers/tty/serial/serial_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"75430539218512615187374622909197123399",
"122565414961747101894903148526684062227",
"53727731833702197679273943293981258126",
"328004840619302125945272390177070202529",
"210558236474633448211520695356183813859",
"303530656128161099445358644692916883307",
"61982455518335134724633776283143318722"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9b11229b79c0fb2100b5bb4628a101b1d37fbf6",
"signature_type": "Line",
"id": "CVE-2022-49613-41356514",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"329576258534766900382005145761881336287",
"192886738217580084378684868549466543625",
"15056402193473899690707920799042677579",
"124183064683943524380342394234951144642",
"256114514330618907496396100119806100063",
"21256339421991162589559792241071076440",
"211519808998914062619586427551897927837"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9cb6fabc90102f9e61fe35bd0160db88f4f53b4",
"signature_type": "Line",
"id": "CVE-2022-49613-57994a49",
"target": {
"file": "drivers/tty/serial/serial_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"function_hash": "44092630552138577450389387636400464790",
"length": 338.0
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9b11229b79c0fb2100b5bb4628a101b1d37fbf6",
"signature_type": "Function",
"id": "CVE-2022-49613-580a6253",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c",
"function": "serial8250_register_ports"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"74345190094473787931971397900074983788",
"299085146414910850422095829812601217662",
"213910313490591732004082116159085985382"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5df66302f03f87ae8953785a882d78e911f00c55",
"signature_type": "Line",
"id": "CVE-2022-49613-6723cb1f",
"target": {
"file": "include/linux/serial_core.h"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"75430539218512615187374622909197123399",
"122565414961747101894903148526684062227",
"53727731833702197679273943293981258126",
"328004840619302125945272390177070202529",
"210558236474633448211520695356183813859",
"303530656128161099445358644692916883307",
"61982455518335134724633776283143318722"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5df66302f03f87ae8953785a882d78e911f00c55",
"signature_type": "Line",
"id": "CVE-2022-49613-6b65e9cd",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"329576258534766900382005145761881336287",
"192886738217580084378684868549466543625",
"15056402193473899690707920799042677579",
"124183064683943524380342394234951144642",
"256114514330618907496396100119806100063",
"21256339421991162589559792241071076440",
"211519808998914062619586427551897927837"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@190ce5cdc55d1b66ea582ac2be6fd5a72e3cc486",
"signature_type": "Line",
"id": "CVE-2022-49613-7693e5ff",
"target": {
"file": "drivers/tty/serial/serial_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"75430539218512615187374622909197123399",
"122565414961747101894903148526684062227",
"53727731833702197679273943293981258126",
"328004840619302125945272390177070202529",
"210558236474633448211520695356183813859",
"303530656128161099445358644692916883307",
"61982455518335134724633776283143318722"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@190ce5cdc55d1b66ea582ac2be6fd5a72e3cc486",
"signature_type": "Line",
"id": "CVE-2022-49613-7fffa33a",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"function_hash": "44092630552138577450389387636400464790",
"length": 338.0
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9cb6fabc90102f9e61fe35bd0160db88f4f53b4",
"signature_type": "Function",
"id": "CVE-2022-49613-98088d3e",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c",
"function": "serial8250_register_ports"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"function_hash": "44092630552138577450389387636400464790",
"length": 338.0
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@190ce5cdc55d1b66ea582ac2be6fd5a72e3cc486",
"signature_type": "Function",
"id": "CVE-2022-49613-9a6acff6",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c",
"function": "serial8250_register_ports"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"329576258534766900382005145761881336287",
"192886738217580084378684868549466543625",
"15056402193473899690707920799042677579",
"124183064683943524380342394234951144642",
"256114514330618907496396100119806100063",
"21256339421991162589559792241071076440",
"211519808998914062619586427551897927837"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5df66302f03f87ae8953785a882d78e911f00c55",
"signature_type": "Line",
"id": "CVE-2022-49613-9eb64f7b",
"target": {
"file": "drivers/tty/serial/serial_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"75430539218512615187374622909197123399",
"122565414961747101894903148526684062227",
"53727731833702197679273943293981258126",
"328004840619302125945272390177070202529",
"210558236474633448211520695356183813859",
"303530656128161099445358644692916883307",
"61982455518335134724633776283143318722"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9cb6fabc90102f9e61fe35bd0160db88f4f53b4",
"signature_type": "Line",
"id": "CVE-2022-49613-a9e88630",
"target": {
"file": "drivers/tty/serial/8250/8250_core.c"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"74345190094473787931971397900074983788",
"299085146414910850422095829812601217662",
"213910313490591732004082116159085985382"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d9cb6fabc90102f9e61fe35bd0160db88f4f53b4",
"signature_type": "Line",
"id": "CVE-2022-49613-db28e584",
"target": {
"file": "include/linux/serial_core.h"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"74345190094473787931971397900074983788",
"299085146414910850422095829812601217662",
"213910313490591732004082116159085985382"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@190ce5cdc55d1b66ea582ac2be6fd5a72e3cc486",
"signature_type": "Line",
"id": "CVE-2022-49613-ed2a0837",
"target": {
"file": "include/linux/serial_core.h"
}
}
]