In the Linux kernel, the following vulnerability has been resolved:
net: dsa: lantiq_gswip: don't use devres for mdiobus
As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slavemiibus using devres")
mdiobusfree() will panic when called from devmmdiobusfree() <- devresreleaseall() <- _devicereleasedriver(), and that mdiobus was not previously unregistered.
The GSWIP switch is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here.
If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and devicelinksunbind_consumers() will unbind the GSWIP switch driver on shutdown.
So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all.
The gswip driver has the code structure in place for orderly mdiobus removal, so just replace devmmdiobusalloc() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus.
{ "vanir_signatures": [ { "signature_version": "v1", "digest": { "length": 429.0, "function_hash": "170329641908675948590876715782799474142" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e177d2e85ebcd3008c4b2abc293f4118e04eedef", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_remove" }, "signature_type": "Function", "id": "CVE-2022-48812-11dd66f8" }, { "signature_version": "v1", "digest": { "length": 2669.0, "function_hash": "139877796109209585112125122163024274793" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0d120dfb5d67edc5bcd1804e167dba2b30809afd", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_probe" }, "signature_type": "Function", "id": "CVE-2022-48812-27edb31e" }, { "signature_version": "v1", "digest": { "length": 632.0, "function_hash": "96730017608033888441913164998371461498" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e177d2e85ebcd3008c4b2abc293f4118e04eedef", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_mdio" }, "signature_type": "Function", "id": "CVE-2022-48812-2811c1f4" }, { "signature_version": "v1", "digest": { "length": 2669.0, "function_hash": "139877796109209585112125122163024274793" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2443ba2fe396bdde187a2fdfa6a57375643ae93c", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_probe" }, "signature_type": "Function", "id": "CVE-2022-48812-4a1803dc" }, { "signature_version": "v1", "digest": { "length": 632.0, "function_hash": "96730017608033888441913164998371461498" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0d120dfb5d67edc5bcd1804e167dba2b30809afd", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_mdio" }, "signature_type": "Function", "id": "CVE-2022-48812-936c19fd" }, { "signature_version": "v1", "digest": { "threshold": 0.9, "line_hashes": [ "149947293352453308415914284224957544158", "312087621675449370992849850779596066243", "313093489064340872225578775567978095703", "255625506610195040158704565428057967280", "72340868919128208500986685434712646387", "241473608930832608666800619000336363330", "329802262471271122607046953351180340889", "140121862155831761646538499884080554886", "102938626405535547581175163107815896280", "63028485553913004037180853960090131358", "218555978078543789127235843926436981755", "223471859341406704481269779769461793552", "303321300439178638013149746421247177266", "58064371621715390636153836351167270390", "254155837574345592420057708752808917846", "94423635000645630573559282739086890366", "206367568301294184087549704377794874230", "229263394641608795939602932352169551636" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5652bc50dde7b84e93dfb25479b64b817e377c1", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c" }, "signature_type": "Line", "id": "CVE-2022-48812-9d940f15" }, { "signature_version": "v1", "digest": { "length": 481.0, "function_hash": "128386158841411029526816529585631631213" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2443ba2fe396bdde187a2fdfa6a57375643ae93c", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_remove" }, "signature_type": "Function", "id": "CVE-2022-48812-a0b05e33" }, { "signature_version": "v1", "digest": { "length": 481.0, "function_hash": "128386158841411029526816529585631631213" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5652bc50dde7b84e93dfb25479b64b817e377c1", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_remove" }, "signature_type": "Function", "id": "CVE-2022-48812-a56b3f58" }, { "signature_version": "v1", "digest": { "threshold": 0.9, "line_hashes": [ "149947293352453308415914284224957544158", "312087621675449370992849850779596066243", "313093489064340872225578775567978095703", "255625506610195040158704565428057967280", "72340868919128208500986685434712646387", "241473608930832608666800619000336363330", "329802262471271122607046953351180340889", "140121862155831761646538499884080554886", "102938626405535547581175163107815896280", "63028485553913004037180853960090131358", "218555978078543789127235843926436981755", "223471859341406704481269779769461793552", "303321300439178638013149746421247177266", "58064371621715390636153836351167270390", "254155837574345592420057708752808917846", "94423635000645630573559282739086890366", "206367568301294184087549704377794874230", "229263394641608795939602932352169551636" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e177d2e85ebcd3008c4b2abc293f4118e04eedef", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c" }, "signature_type": "Line", "id": "CVE-2022-48812-ad1a1e57" }, { "signature_version": "v1", "digest": { "length": 632.0, "function_hash": "96730017608033888441913164998371461498" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2443ba2fe396bdde187a2fdfa6a57375643ae93c", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_mdio" }, "signature_type": "Function", "id": "CVE-2022-48812-b21995d4" }, { "signature_version": "v1", "digest": { "length": 481.0, "function_hash": "128386158841411029526816529585631631213" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0d120dfb5d67edc5bcd1804e167dba2b30809afd", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_remove" }, "signature_type": "Function", "id": "CVE-2022-48812-b44b2e81" }, { "signature_version": "v1", "digest": { "length": 2190.0, "function_hash": "298819590009274490505256671796440988589" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e177d2e85ebcd3008c4b2abc293f4118e04eedef", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_probe" }, "signature_type": "Function", "id": "CVE-2022-48812-bb28181d" }, { "signature_version": "v1", "digest": { "threshold": 0.9, "line_hashes": [ "149947293352453308415914284224957544158", "312087621675449370992849850779596066243", "313093489064340872225578775567978095703", "255625506610195040158704565428057967280", "72340868919128208500986685434712646387", "241473608930832608666800619000336363330", "329802262471271122607046953351180340889", "140121862155831761646538499884080554886", "102938626405535547581175163107815896280", "63028485553913004037180853960090131358", "218555978078543789127235843926436981755", "223471859341406704481269779769461793552", "303321300439178638013149746421247177266", "58064371621715390636153836351167270390", "254155837574345592420057708752808917846", "94423635000645630573559282739086890366", "206367568301294184087549704377794874230", "229263394641608795939602932352169551636" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2443ba2fe396bdde187a2fdfa6a57375643ae93c", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c" }, "signature_type": "Line", "id": "CVE-2022-48812-bb87aff1" }, { "signature_version": "v1", "digest": { "length": 632.0, "function_hash": "96730017608033888441913164998371461498" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5652bc50dde7b84e93dfb25479b64b817e377c1", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_mdio" }, "signature_type": "Function", "id": "CVE-2022-48812-bdb3dd6b" }, { "signature_version": "v1", "digest": { "threshold": 0.9, "line_hashes": [ "149947293352453308415914284224957544158", "312087621675449370992849850779596066243", "313093489064340872225578775567978095703", "255625506610195040158704565428057967280", "72340868919128208500986685434712646387", "241473608930832608666800619000336363330", "329802262471271122607046953351180340889", "140121862155831761646538499884080554886", "102938626405535547581175163107815896280", "63028485553913004037180853960090131358", "218555978078543789127235843926436981755", "223471859341406704481269779769461793552", "303321300439178638013149746421247177266", "58064371621715390636153836351167270390", "254155837574345592420057708752808917846", "94423635000645630573559282739086890366", "206367568301294184087549704377794874230", "229263394641608795939602932352169551636" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@0d120dfb5d67edc5bcd1804e167dba2b30809afd", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c" }, "signature_type": "Line", "id": "CVE-2022-48812-cd7a0ba3" }, { "signature_version": "v1", "digest": { "length": 2630.0, "function_hash": "188034889008497335131997822918236354557" }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b5652bc50dde7b84e93dfb25479b64b817e377c1", "deprecated": false, "target": { "file": "drivers/net/dsa/lantiq_gswip.c", "function": "gswip_probe" }, "signature_type": "Function", "id": "CVE-2022-48812-e1435dab" } ] }