In the Linux kernel, the following vulnerability has been resolved:
igc: Reinstate IGC_REMOVED logic and implement it properly
The initially merged version of the igc driver code (via commit 146740f9abc4, "igc: Add support for PF") contained the following IGCREMOVED checks in the igcrd32/wr32() MMIO accessors:
u32 igc_rd32(struct igc_hw *hw, u32 reg)
{
u8 __iomem *hw_addr = READ_ONCE(hw->hw_addr);
u32 value = 0;
if (IGC_REMOVED(hw_addr))
return ~value;
value = readl(&hw_addr[reg]);
/* reads should not return all F's */
if (!(~value) && (!reg || !(~readl(hw_addr))))
hw->hw_addr = NULL;
return value;
}
And:
#define wr32(reg, val) \
do { \
u8 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
if (!IGC_REMOVED(hw_addr)) \
writel((val), &hw_addr[(reg)]); \
} while (0)
E.g. igb has similar checks in its MMIO accessors, and has a similar macro E1000_REMOVED, which is implemented as follows:
#define E1000_REMOVED(h) unlikely(!(h))
These checks serve to detect and take note of an 0xffffffff MMIO read return from the device, which can be caused by a PCIe link flap or some other kind of PCI bus error, and to avoid performing MMIO reads and writes from that point onwards.
However, the IGC_REMOVED macro was not originally implemented:
#ifndef IGC_REMOVED
#define IGC_REMOVED(a) (0)
#endif /* IGC_REMOVED */
This led to the IGCREMOVED logic to be removed entirely in a subsequent commit (commit 3c215fb18e70, "igc: remove IGCREMOVED function"), with the rationale that such checks matter only for virtualization and that igc does not support virtualization -- but a PCIe device can become detached even without virtualization being in use, and without proper checks, a PCIe bus error affecting an igc adapter will lead to various NULL pointer dereferences, as the first access after the error will set hw->hw_addr to NULL, and subsequent accesses will blindly dereference this now-NULL pointer.
This patch reinstates the IGCREMOVED checks in igcrd32/wr32(), and implements IGCREMOVED the way it is done for igb, by checking for the unlikely() case of hwaddr being NULL. This change prevents the oopses seen when a PCIe link flap occurs on an igc adapter.
[
{
"id": "CVE-2022-49605-03306b04",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"255901005877124612690530619387513672205",
"148447149916807643611891951291499888688",
"272850795293922626402789801662177263980",
"198285767118675981254204351128531523179"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@77836dbe35382aaf8108489060c5c89530c77494",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_regs.h"
}
},
{
"id": "CVE-2022-49605-1534b938",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"255901005877124612690530619387513672205",
"148447149916807643611891951291499888688",
"272850795293922626402789801662177263980",
"198285767118675981254204351128531523179"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c1ddcee5311f3315096217881d2dbe47cc683f9",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_regs.h"
}
},
{
"id": "CVE-2022-49605-2bdfae5a",
"signature_type": "Function",
"signature_version": "v1",
"digest": {
"length": 517.0,
"function_hash": "33063669169191454738615702637276938921"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c1ddcee5311f3315096217881d2dbe47cc683f9",
"target": {
"function": "igc_rd32",
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-5497668b",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"176460911432945149977784333411862978820",
"141274228294736719723885946717886695260",
"12683682272747805991246376409881415416"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c1ddcee5311f3315096217881d2dbe47cc683f9",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-59a2a329",
"signature_type": "Function",
"signature_version": "v1",
"digest": {
"length": 517.0,
"function_hash": "33063669169191454738615702637276938921"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@77836dbe35382aaf8108489060c5c89530c77494",
"target": {
"function": "igc_rd32",
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-5efebe86",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"176460911432945149977784333411862978820",
"141274228294736719723885946717886695260",
"12683682272747805991246376409881415416"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@70965b6e5c03aa70cc754af1226b9f9cde0c4bf3",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-5fe9221b",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"255901005877124612690530619387513672205",
"148447149916807643611891951291499888688",
"272850795293922626402789801662177263980",
"198285767118675981254204351128531523179"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@70965b6e5c03aa70cc754af1226b9f9cde0c4bf3",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_regs.h"
}
},
{
"id": "CVE-2022-49605-6ec70d01",
"signature_type": "Function",
"signature_version": "v1",
"digest": {
"length": 517.0,
"function_hash": "33063669169191454738615702637276938921"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e75b73081f1ec169518773626c2ff3950476660b",
"target": {
"function": "igc_rd32",
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-7030b199",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"176460911432945149977784333411862978820",
"141274228294736719723885946717886695260",
"12683682272747805991246376409881415416"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@77836dbe35382aaf8108489060c5c89530c77494",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-97e48b5a",
"signature_type": "Function",
"signature_version": "v1",
"digest": {
"length": 517.0,
"function_hash": "33063669169191454738615702637276938921"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@70965b6e5c03aa70cc754af1226b9f9cde0c4bf3",
"target": {
"function": "igc_rd32",
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
},
{
"id": "CVE-2022-49605-c8f4abf6",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"255901005877124612690530619387513672205",
"148447149916807643611891951291499888688",
"272850795293922626402789801662177263980",
"198285767118675981254204351128531523179"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e75b73081f1ec169518773626c2ff3950476660b",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_regs.h"
}
},
{
"id": "CVE-2022-49605-fabc25a6",
"signature_type": "Line",
"signature_version": "v1",
"digest": {
"line_hashes": [
"176460911432945149977784333411862978820",
"141274228294736719723885946717886695260",
"12683682272747805991246376409881415416"
],
"threshold": 0.9
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e75b73081f1ec169518773626c2ff3950476660b",
"target": {
"file": "drivers/net/ethernet/intel/igc/igc_main.c"
}
}
]