In the Linux kernel, the following vulnerability has been resolved:
net: mediatek: Fix potential NULL pointer dereference in dummy net_device handling
Move the freeing of the dummy netdevice from mtkfreedev() to mtkremove().
Previously, if allocnetdevdummy() failed in mtkprobe(), eth->dummydev would be NULL. The error path would then call mtkfreedev(), which in turn called freenetdev() assuming dummydev was allocated (but it was not), potentially causing a NULL pointer dereference.
By moving freenetdev() to mtkremove(), we ensure it's only called when mtkprobe() has succeeded and dummydev is fully allocated. This addresses a potential NULL pointer dereference detected by Smatch[1].
[
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c",
"function": "mtk_free_dev"
},
"digest": {
"length": 385.0,
"function_hash": "326853414783718516941248878612749597983"
},
"id": "CVE-2024-42282-0eee6158",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@16f3a28cf5f876a7f3550d8f4c870a7b41bcfaef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c",
"function": "mtk_remove"
},
"digest": {
"length": 442.0,
"function_hash": "22662440852145054622791212156494205156"
},
"id": "CVE-2024-42282-1610d7cf",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af6bd5c9901b13a26eaf4d57d97a813297791596",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c",
"function": "mtk_remove"
},
"digest": {
"length": 442.0,
"function_hash": "22662440852145054622791212156494205156"
},
"id": "CVE-2024-42282-176de9ec",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@16f3a28cf5f876a7f3550d8f4c870a7b41bcfaef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"296507479798506932698506697457929870061",
"310412275052544163021658019168312362729",
"334364652614592765825922138755939920846",
"266456083456212874944126245267951341348",
"231462427427459334713229483178735397822",
"268965137942011616809539498560468026766",
"71262500426256659117904317770327668658",
"312403381450202109565992075861531199894"
]
},
"id": "CVE-2024-42282-381279cf",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@16f3a28cf5f876a7f3550d8f4c870a7b41bcfaef",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c"
},
"digest": {
"threshold": 0.9,
"line_hashes": [
"296507479798506932698506697457929870061",
"310412275052544163021658019168312362729",
"334364652614592765825922138755939920846",
"266456083456212874944126245267951341348",
"231462427427459334713229483178735397822",
"268965137942011616809539498560468026766",
"71262500426256659117904317770327668658",
"312403381450202109565992075861531199894"
]
},
"id": "CVE-2024-42282-7edf9833",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af6bd5c9901b13a26eaf4d57d97a813297791596",
"signature_version": "v1"
},
{
"deprecated": false,
"target": {
"file": "drivers/net/ethernet/mediatek/mtk_eth_soc.c",
"function": "mtk_free_dev"
},
"digest": {
"length": 385.0,
"function_hash": "326853414783718516941248878612749597983"
},
"id": "CVE-2024-42282-f3f1c4a8",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af6bd5c9901b13a26eaf4d57d97a813297791596",
"signature_version": "v1"
}
]