From: Sasha Levin Date: Sat, 5 Mar 2022 20:55:51 +0000 (-0500) Subject: Fixes for 4.9 X-Git-Tag: v4.9.305~41^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ec1c834b30301fde9f501741e88e44aed573bbe;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.9 Signed-off-by: Sasha Levin --- diff --git a/queue-4.9/net-chelsio-cxgb3-check-the-return-value-of-pci_find.patch b/queue-4.9/net-chelsio-cxgb3-check-the-return-value-of-pci_find.patch new file mode 100644 index 00000000000..8510280fc07 --- /dev/null +++ b/queue-4.9/net-chelsio-cxgb3-check-the-return-value-of-pci_find.patch @@ -0,0 +1,37 @@ +From 74492ec5f58f3ffdc81fc95b864bc402663d0285 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Feb 2022 04:37:27 -0800 +Subject: net: chelsio: cxgb3: check the return value of pci_find_capability() + +From: Jia-Ju Bai + +[ Upstream commit 767b9825ed1765894e569a3d698749d40d83762a ] + +The function pci_find_capability() in t3_prep_adapter() can fail, so its +return value should be checked. + +Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3") +Reported-by: TOTE Robot +Signed-off-by: Jia-Ju Bai +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +index a89721fad633..29220141e4e4 100644 +--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c ++++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +@@ -3677,6 +3677,8 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai, + MAC_STATS_ACCUM_SECS : (MAC_STATS_ACCUM_SECS * 10); + adapter->params.pci.vpd_cap_addr = + pci_find_capability(adapter->pdev, PCI_CAP_ID_VPD); ++ if (!adapter->params.pci.vpd_cap_addr) ++ return -ENODEV; + ret = get_vpd_params(adapter, &adapter->params.vpd); + if (ret < 0) + return ret; +-- +2.34.1 + diff --git a/queue-4.9/series b/queue-4.9/series index bd27751e2a4..764fcbac3e7 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -23,3 +23,5 @@ net-arcnet-com20020-fix-null-ptr-deref-in-com20020pci_probe.patch efivars-respect-block-flag-in-efivar_entry_set_safe.patch can-gs_usb-change-active_channels-s-type-from-atomic_t-to-u8.patch arm-9182-1-mmu-fix-returns-from-early_param-and-__setup-functions.patch +soc-fsl-qe-check-of-ioremap-return-value.patch +net-chelsio-cxgb3-check-the-return-value-of-pci_find.patch diff --git a/queue-4.9/soc-fsl-qe-check-of-ioremap-return-value.patch b/queue-4.9/soc-fsl-qe-check-of-ioremap-return-value.patch new file mode 100644 index 00000000000..633b5a088f0 --- /dev/null +++ b/queue-4.9/soc-fsl-qe-check-of-ioremap-return-value.patch @@ -0,0 +1,43 @@ +From 6932a6477b084455b7842e488a790b7fcbd7062a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Dec 2021 09:45:43 +0800 +Subject: soc: fsl: qe: Check of ioremap return value + +From: Jiasheng Jiang + +[ Upstream commit a222fd8541394b36b13c89d1698d9530afd59a9c ] + +As the possible failure of the ioremap(), the par_io could be NULL. +Therefore it should be better to check it and return error in order to +guarantee the success of the initiation. +But, I also notice that all the caller like mpc85xx_qe_par_io_init() in +`arch/powerpc/platforms/85xx/common.c` don't check the return value of +the par_io_init(). +Actually, par_io_init() needs to check to handle the potential error. +I will submit another patch to fix that. +Anyway, par_io_init() itsely should be fixed. + +Fixes: 7aa1aa6ecec2 ("QE: Move QE from arch/powerpc to drivers/soc") +Signed-off-by: Jiasheng Jiang +Signed-off-by: Li Yang +Signed-off-by: Sasha Levin +--- + drivers/soc/fsl/qe/qe_io.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c +index 7ae59abc7863..127a4a836e67 100644 +--- a/drivers/soc/fsl/qe/qe_io.c ++++ b/drivers/soc/fsl/qe/qe_io.c +@@ -41,6 +41,8 @@ int par_io_init(struct device_node *np) + if (ret) + return ret; + par_io = ioremap(res.start, resource_size(&res)); ++ if (!par_io) ++ return -ENOMEM; + + num_ports = of_get_property(np, "num-ports", NULL); + if (num_ports) +-- +2.34.1 +