In the Linux kernel, the following vulnerability has been resolved:
can: j1939: prevent deadlock by changing j1939sockslock to rwlock
The following 3 locks would race against each other, causing the deadlock situation in the Syzbot bug report:
A reasonable fix is to change j1939sockslock to an rwlock, since in the rare situations where a write lock is required for the linked list that j1939sockslock is protecting, the code does not attempt to acquire any more locks. This would break the circular lock dependency, where, for example, the current thread already locks j1939sockslock and attempts to acquire sksessionqueuelock, and at the same time, another thread attempts to acquire j1939sockslock while holding sksessionqueuelock.
NOTE: This patch along does not fix the unregister_netdevice bug reported by Syzbot; instead, it solves a deadlock situation to prepare for one or more further patches to actually fix the Syzbot bug, which appears to be a reference counting problem within the j1939 codebase.
[mkl: remove unrelated newline change]
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@559b6322f9480bff68cfa98d108991e945a4f284",
"target": {
"file": "net/can/j1939/j1939-priv.h"
},
"deprecated": false,
"id": "CVE-2023-52638-04069b30",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23060175176192324642830760323651473277",
"335433028282977843382226151748144569185",
"288407086999481654732395812697203980904",
"254474307996308342959569170539333925480"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@26dfe112ec2e95fe0099681f6aec33da13c2dd8e",
"target": {
"file": "net/can/j1939/main.c"
},
"deprecated": false,
"id": "CVE-2023-52638-04400ccb",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23002876811545316022244208389902959869",
"97361688763757346544220005485514000565",
"338207965592451252908369765172726866283",
"260244320712865314826489695858010288938"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@26dfe112ec2e95fe0099681f6aec33da13c2dd8e",
"target": {
"file": "net/can/j1939/j1939-priv.h"
},
"deprecated": false,
"id": "CVE-2023-52638-1df697ee",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23060175176192324642830760323651473277",
"335433028282977843382226151748144569185",
"288407086999481654732395812697203980904",
"254474307996308342959569170539333925480"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6cdedc18ba7b9dacc36466e27e3267d201948c8d",
"target": {
"file": "net/can/j1939/main.c"
},
"deprecated": false,
"id": "CVE-2023-52638-40a5d6af",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23002876811545316022244208389902959869",
"97361688763757346544220005485514000565",
"338207965592451252908369765172726866283",
"260244320712865314826489695858010288938"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6cdedc18ba7b9dacc36466e27e3267d201948c8d",
"target": {
"file": "net/can/j1939/j1939-priv.h"
},
"deprecated": false,
"id": "CVE-2023-52638-4887128d",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23060175176192324642830760323651473277",
"335433028282977843382226151748144569185",
"288407086999481654732395812697203980904",
"254474307996308342959569170539333925480"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@26dfe112ec2e95fe0099681f6aec33da13c2dd8e",
"target": {
"file": "net/can/j1939/socket.c"
},
"deprecated": false,
"id": "CVE-2023-52638-4fb71eda",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"308575287514578297466380779543892041883",
"123141744162234062555150066523905788976",
"67984122624890743675778303914498324628",
"160639294088308031973231720836608463014",
"247904840271577917612893860970336758941",
"127461365671679886817871209502494294234",
"96957448181663010095270970903848914867",
"172696302800181603218762535810258190567",
"169762938084219511203858651665209574538",
"116497401694017472248695901885584974286",
"133115554602854078114310453867424758732",
"331174393683534802226384770907492628732",
"56034370210846383139587643579768098537",
"291140964111275483714026251212592449285",
"235389207458649175852753076166858521891",
"166959126883784059716345916806622705270",
"37166647219781176142192286245527723300",
"330225872057283455038707462970652592816",
"311565297619525554273072407006954443861",
"243294620735626707215224958930859765015",
"67266487097458936572559225434506073987",
"309727183814213786396218243887793441513",
"301676048791243976668319464723142197046",
"178387730789902434195983654806243574411",
"106460455820502059510095331362065736363",
"125203030932314556486991278010010509868",
"312197519978292248627738881244870150157",
"46172814084371023620750152669525000174",
"23085514960342076038282430658872252532",
"316282294556528521560443875515513183031",
"319108194407236138811299265048825547136",
"325432555708448809955666771295707058903",
"195882540588771579668502394348603436447",
"293833905459227304853174126701512464767",
"68317740330886342020022213004311370627",
"147716138332571808663345093941924816833",
"229479241721682207252366666578706687079",
"188092995256800348047364874165115408321",
"117126873931955911690666709766138512548",
"275721855703578298358453707490640582983",
"218878095596179274056552266983272136437",
"308439233649246103306846175486990234442",
"102311537040764917444724301281114552915",
"169921212966950191237820027460199383384",
"192530040872133946903804835869502947548",
"68734650223124737090908786983031477214",
"237782888337009923905477625857843623134"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@559b6322f9480bff68cfa98d108991e945a4f284",
"target": {
"file": "net/can/j1939/main.c"
},
"deprecated": false,
"id": "CVE-2023-52638-58274510",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23002876811545316022244208389902959869",
"97361688763757346544220005485514000565",
"338207965592451252908369765172726866283",
"260244320712865314826489695858010288938"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@aedda066d717a0b4335d7e0a00b2e3a61e40afcf",
"target": {
"file": "net/can/j1939/socket.c"
},
"deprecated": false,
"id": "CVE-2023-52638-5a66b07c",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"308575287514578297466380779543892041883",
"123141744162234062555150066523905788976",
"67984122624890743675778303914498324628",
"160639294088308031973231720836608463014",
"247904840271577917612893860970336758941",
"127461365671679886817871209502494294234",
"96957448181663010095270970903848914867",
"172696302800181603218762535810258190567",
"169762938084219511203858651665209574538",
"116497401694017472248695901885584974286",
"133115554602854078114310453867424758732",
"331174393683534802226384770907492628732",
"56034370210846383139587643579768098537",
"291140964111275483714026251212592449285",
"235389207458649175852753076166858521891",
"166959126883784059716345916806622705270",
"37166647219781176142192286245527723300",
"330225872057283455038707462970652592816",
"311565297619525554273072407006954443861",
"243294620735626707215224958930859765015",
"67266487097458936572559225434506073987",
"309727183814213786396218243887793441513",
"301676048791243976668319464723142197046",
"178387730789902434195983654806243574411",
"106460455820502059510095331362065736363",
"125203030932314556486991278010010509868",
"312197519978292248627738881244870150157",
"46172814084371023620750152669525000174",
"23085514960342076038282430658872252532",
"316282294556528521560443875515513183031",
"319108194407236138811299265048825547136",
"325432555708448809955666771295707058903",
"195882540588771579668502394348603436447",
"293833905459227304853174126701512464767",
"68317740330886342020022213004311370627",
"147716138332571808663345093941924816833",
"229479241721682207252366666578706687079",
"188092995256800348047364874165115408321",
"117126873931955911690666709766138512548",
"275721855703578298358453707490640582983",
"218878095596179274056552266983272136437",
"308439233649246103306846175486990234442",
"102311537040764917444724301281114552915",
"169921212966950191237820027460199383384",
"192530040872133946903804835869502947548",
"68734650223124737090908786983031477214",
"237782888337009923905477625857843623134"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@aedda066d717a0b4335d7e0a00b2e3a61e40afcf",
"target": {
"file": "net/can/j1939/main.c"
},
"deprecated": false,
"id": "CVE-2023-52638-6be8a6e2",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23002876811545316022244208389902959869",
"97361688763757346544220005485514000565",
"338207965592451252908369765172726866283",
"260244320712865314826489695858010288938"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@6cdedc18ba7b9dacc36466e27e3267d201948c8d",
"target": {
"file": "net/can/j1939/socket.c"
},
"deprecated": false,
"id": "CVE-2023-52638-71926e66",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"308575287514578297466380779543892041883",
"123141744162234062555150066523905788976",
"67984122624890743675778303914498324628",
"160639294088308031973231720836608463014",
"247904840271577917612893860970336758941",
"127461365671679886817871209502494294234",
"96957448181663010095270970903848914867",
"172696302800181603218762535810258190567",
"169762938084219511203858651665209574538",
"116497401694017472248695901885584974286",
"133115554602854078114310453867424758732",
"331174393683534802226384770907492628732",
"56034370210846383139587643579768098537",
"291140964111275483714026251212592449285",
"235389207458649175852753076166858521891",
"166959126883784059716345916806622705270",
"37166647219781176142192286245527723300",
"330225872057283455038707462970652592816",
"311565297619525554273072407006954443861",
"243294620735626707215224958930859765015",
"67266487097458936572559225434506073987",
"309727183814213786396218243887793441513",
"301676048791243976668319464723142197046",
"178387730789902434195983654806243574411",
"106460455820502059510095331362065736363",
"125203030932314556486991278010010509868",
"312197519978292248627738881244870150157",
"46172814084371023620750152669525000174",
"23085514960342076038282430658872252532",
"316282294556528521560443875515513183031",
"319108194407236138811299265048825547136",
"325432555708448809955666771295707058903",
"195882540588771579668502394348603436447",
"293833905459227304853174126701512464767",
"68317740330886342020022213004311370627",
"147716138332571808663345093941924816833",
"229479241721682207252366666578706687079",
"188092995256800348047364874165115408321",
"117126873931955911690666709766138512548",
"275721855703578298358453707490640582983",
"218878095596179274056552266983272136437",
"308439233649246103306846175486990234442",
"102311537040764917444724301281114552915",
"169921212966950191237820027460199383384",
"192530040872133946903804835869502947548",
"68734650223124737090908786983031477214",
"237782888337009923905477625857843623134"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03358aba991668d3bb2c65b3c82aa32c36851170",
"target": {
"file": "net/can/j1939/socket.c"
},
"deprecated": false,
"id": "CVE-2023-52638-9205347e",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"308575287514578297466380779543892041883",
"123141744162234062555150066523905788976",
"67984122624890743675778303914498324628",
"160639294088308031973231720836608463014",
"247904840271577917612893860970336758941",
"127461365671679886817871209502494294234",
"96957448181663010095270970903848914867",
"172696302800181603218762535810258190567",
"169762938084219511203858651665209574538",
"116497401694017472248695901885584974286",
"133115554602854078114310453867424758732",
"331174393683534802226384770907492628732",
"56034370210846383139587643579768098537",
"291140964111275483714026251212592449285",
"235389207458649175852753076166858521891",
"166959126883784059716345916806622705270",
"37166647219781176142192286245527723300",
"330225872057283455038707462970652592816",
"311565297619525554273072407006954443861",
"243294620735626707215224958930859765015",
"67266487097458936572559225434506073987",
"309727183814213786396218243887793441513",
"301676048791243976668319464723142197046",
"178387730789902434195983654806243574411",
"106460455820502059510095331362065736363",
"125203030932314556486991278010010509868",
"312197519978292248627738881244870150157",
"46172814084371023620750152669525000174",
"23085514960342076038282430658872252532",
"316282294556528521560443875515513183031",
"319108194407236138811299265048825547136",
"325432555708448809955666771295707058903",
"195882540588771579668502394348603436447",
"293833905459227304853174126701512464767",
"68317740330886342020022213004311370627",
"147716138332571808663345093941924816833",
"229479241721682207252366666578706687079",
"188092995256800348047364874165115408321",
"117126873931955911690666709766138512548",
"275721855703578298358453707490640582983",
"218878095596179274056552266983272136437",
"308439233649246103306846175486990234442",
"102311537040764917444724301281114552915",
"169921212966950191237820027460199383384",
"192530040872133946903804835869502947548",
"68734650223124737090908786983031477214",
"237782888337009923905477625857843623134"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03358aba991668d3bb2c65b3c82aa32c36851170",
"target": {
"file": "net/can/j1939/j1939-priv.h"
},
"deprecated": false,
"id": "CVE-2023-52638-c0baf5bf",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23060175176192324642830760323651473277",
"335433028282977843382226151748144569185",
"288407086999481654732395812697203980904",
"254474307996308342959569170539333925480"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@aedda066d717a0b4335d7e0a00b2e3a61e40afcf",
"target": {
"file": "net/can/j1939/j1939-priv.h"
},
"deprecated": false,
"id": "CVE-2023-52638-cf8f3de0",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23060175176192324642830760323651473277",
"335433028282977843382226151748144569185",
"288407086999481654732395812697203980904",
"254474307996308342959569170539333925480"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@559b6322f9480bff68cfa98d108991e945a4f284",
"target": {
"file": "net/can/j1939/socket.c"
},
"deprecated": false,
"id": "CVE-2023-52638-e96caa96",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"308575287514578297466380779543892041883",
"123141744162234062555150066523905788976",
"67984122624890743675778303914498324628",
"160639294088308031973231720836608463014",
"247904840271577917612893860970336758941",
"127461365671679886817871209502494294234",
"96957448181663010095270970903848914867",
"172696302800181603218762535810258190567",
"169762938084219511203858651665209574538",
"116497401694017472248695901885584974286",
"133115554602854078114310453867424758732",
"331174393683534802226384770907492628732",
"56034370210846383139587643579768098537",
"291140964111275483714026251212592449285",
"235389207458649175852753076166858521891",
"166959126883784059716345916806622705270",
"37166647219781176142192286245527723300",
"330225872057283455038707462970652592816",
"311565297619525554273072407006954443861",
"243294620735626707215224958930859765015",
"67266487097458936572559225434506073987",
"309727183814213786396218243887793441513",
"301676048791243976668319464723142197046",
"178387730789902434195983654806243574411",
"106460455820502059510095331362065736363",
"125203030932314556486991278010010509868",
"312197519978292248627738881244870150157",
"46172814084371023620750152669525000174",
"23085514960342076038282430658872252532",
"316282294556528521560443875515513183031",
"319108194407236138811299265048825547136",
"325432555708448809955666771295707058903",
"195882540588771579668502394348603436447",
"293833905459227304853174126701512464767",
"68317740330886342020022213004311370627",
"147716138332571808663345093941924816833",
"229479241721682207252366666578706687079",
"188092995256800348047364874165115408321",
"117126873931955911690666709766138512548",
"275721855703578298358453707490640582983",
"218878095596179274056552266983272136437",
"308439233649246103306846175486990234442",
"102311537040764917444724301281114552915",
"169921212966950191237820027460199383384",
"192530040872133946903804835869502947548",
"68734650223124737090908786983031477214",
"237782888337009923905477625857843623134"
]
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@03358aba991668d3bb2c65b3c82aa32c36851170",
"target": {
"file": "net/can/j1939/main.c"
},
"deprecated": false,
"id": "CVE-2023-52638-fc6f92b5",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"23002876811545316022244208389902959869",
"97361688763757346544220005485514000565",
"338207965592451252908369765172726866283",
"260244320712865314826489695858010288938"
]
}
}
]