Skip to content

Commit fe27b5c

Browse files
committed
Merge: PCI: Avoid potential out-of-bounds read in pci_dev_for_each_resource() [CVE-2023-52466]
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3806 ``` JIRA: https://issues.redhat.com/browse/RHEL-26742 CVE: CVE-2023-52466 Signed-off-by: Myron Stowe <mstowe@redhat.com> ``` Approved-by: David Arcari <darcari@redhat.com> Approved-by: Prarit Bhargava <prarit@redhat.com> Approved-by: John W. Linville <linville@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 28a4791 + 02a2073 commit fe27b5c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/linux/pci.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,14 +2157,14 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma);
21572157
(pci_resource_end((dev), (bar)) ? \
21582158
resource_size(pci_resource_n((dev), (bar))) : 0)
21592159

2160-
#define __pci_dev_for_each_res0(dev, res, ...) \
2161-
for (unsigned int __b = 0; \
2162-
res = pci_resource_n(dev, __b), __b < PCI_NUM_RESOURCES; \
2160+
#define __pci_dev_for_each_res0(dev, res, ...) \
2161+
for (unsigned int __b = 0; \
2162+
__b < PCI_NUM_RESOURCES && (res = pci_resource_n(dev, __b)); \
21632163
__b++)
21642164

2165-
#define __pci_dev_for_each_res1(dev, res, __b) \
2166-
for (__b = 0; \
2167-
res = pci_resource_n(dev, __b), __b < PCI_NUM_RESOURCES; \
2165+
#define __pci_dev_for_each_res1(dev, res, __b) \
2166+
for (__b = 0; \
2167+
__b < PCI_NUM_RESOURCES && (res = pci_resource_n(dev, __b)); \
21682168
__b++)
21692169

21702170
#define pci_dev_for_each_resource(dev, res, ...) \

0 commit comments

Comments
 (0)