Patch "ixgbe: fix pci device refcount leak" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ixgbe: fix pci device refcount leak

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ixgbe-fix-pci-device-refcount-leak.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From b93fb4405fcb5112c5739c5349afb52ec7f15c07 Mon Sep 17 00:00:00 2001
From: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date: Tue, 29 Nov 2022 09:57:48 +0800
Subject: ixgbe: fix pci device refcount leak

From: Yang Yingliang <yangyingliang@xxxxxxxxxx>

commit b93fb4405fcb5112c5739c5349afb52ec7f15c07 upstream.

As the comment of pci_get_domain_bus_and_slot() says, it
returns a PCI device with refcount incremented, when finish
using it, the caller must decrement the reference count by
calling pci_dev_put().

In ixgbe_get_first_secondary_devfn() and ixgbe_x550em_a_has_mii(),
pci_dev_put() is called to avoid leak.

Fixes: 8fa10ef01260 ("ixgbe: register a mdiobus")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Tested-by: Gurucharan G <gurucharanx.g@xxxxxxxxx> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c
@@ -851,9 +851,11 @@ static struct pci_dev *ixgbe_get_first_s
 	rp_pdev = pci_get_domain_bus_and_slot(0, 0, devfn);
 	if (rp_pdev && rp_pdev->subordinate) {
 		bus = rp_pdev->subordinate->number;
+		pci_dev_put(rp_pdev);
 		return pci_get_domain_bus_and_slot(0, bus, 0);
 	}
 
+	pci_dev_put(rp_pdev);
 	return NULL;
 }
 
@@ -870,6 +872,7 @@ static bool ixgbe_x550em_a_has_mii(struc
 	struct ixgbe_adapter *adapter = hw->back;
 	struct pci_dev *pdev = adapter->pdev;
 	struct pci_dev *func0_pdev;
+	bool has_mii = false;
 
 	/* For the C3000 family of SoCs (x550em_a) the internal ixgbe devices
 	 * are always downstream of root ports @ 0000:00:16.0 & 0000:00:17.0
@@ -880,15 +883,16 @@ static bool ixgbe_x550em_a_has_mii(struc
 	func0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x16, 0));
 	if (func0_pdev) {
 		if (func0_pdev == pdev)
-			return true;
-		else
-			return false;
+			has_mii = true;
+		goto out;
 	}
 	func0_pdev = ixgbe_get_first_secondary_devfn(PCI_DEVFN(0x17, 0));
 	if (func0_pdev == pdev)
-		return true;
+		has_mii = true;
 
-	return false;
+out:
+	pci_dev_put(func0_pdev);
+	return has_mii;
 }
 
 /**


Patches currently in stable-queue which might be from yangyingliang@xxxxxxxxxx are

queue-5.4/mips-vpe-cmp-fix-possible-memory-leak-while-module-e.patch
queue-5.4/regulator-core-fix-resource-leak-in-regulator_regist.patch
queue-5.4/mips-vpe-mt-fix-possible-memory-leak-while-module-ex.patch
queue-5.4/mmc-vub300-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/mailbox-zynq-ipi-fix-error-handling-while-device_reg.patch
queue-5.4/mmc-moxart-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/bluetooth-hci_qca-don-t-call-kfree_skb-under-spin_lo.patch
queue-5.4/powerpc-83xx-mpc832x_rdb-call-platform_device_put-in.patch
queue-5.4/bluetooth-rfcomm-don-t-call-kfree_skb-under-spin_loc.patch
queue-5.4/hsi-omap_ssi_core-fix-possible-memory-leak-in-ssi_pr.patch
queue-5.4/ethernet-s2io-don-t-call-dev_kfree_skb-under-spin_lo.patch
queue-5.4/net-amd-lance-don-t-call-dev_kfree_skb-under-spin_lo.patch
queue-5.4/mmc-via-sdmmc-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/edac-i10nm-fix-refcount-leak-in-pci_get_dev_wrapper.patch
queue-5.4/mmc-alcor-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/scsi-hpsa-fix-error-handling-in-hpsa_add_sas_host.patch
queue-5.4/misdn-hfcpci-don-t-call-dev_kfree_skb-kfree_skb-unde.patch
queue-5.4/rapidio-fix-possible-uaf-when-kfifo_alloc-fails.patch
queue-5.4/usb-roles-fix-of-node-refcount-leak-in-usb_role_swit.patch
queue-5.4/mmc-pxamci-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/bluetooth-hci_h5-don-t-call-kfree_skb-under-spin_loc.patch
queue-5.4/i2c-mux-reg-check-return-value-after-calling-platfor.patch
queue-5.4/net-emaclite-don-t-call-dev_kfree_skb-under-spin_loc.patch
queue-5.4/scsi-hpsa-fix-possible-memory-leak-in-hpsa_add_sas_d.patch
queue-5.4/mmc-mxcmmc-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/scsi-mpt3sas-fix-possible-resource-leaks-in-mpt3sas_.patch
queue-5.4/scsi-fcoe-fix-possible-name-leak-when-device_registe.patch
queue-5.4/mmc-rtsx_usb_sdmmc-fix-return-value-check-of-mmc_add.patch
queue-5.4/fbdev-pm2fb-fix-missing-pci_disable_device.patch
queue-5.4/misdn-hfcmulti-don-t-call-dev_kfree_skb-kfree_skb-un.patch
queue-5.4/misdn-hfcsusb-don-t-call-dev_kfree_skb-kfree_skb-und.patch
queue-5.4/net-apple-mace-don-t-call-dev_kfree_skb-under-spin_l.patch
queue-5.4/powerpc-xive-add-missing-iounmap-in-error-path-in-xi.patch
queue-5.4/cxl-fix-possible-null-ptr-deref-in-cxl_guest_init_af.patch
queue-5.4/genirq-irqdesc-don-t-try-to-remove-non-existing-sysf.patch
queue-5.4/mmc-toshsd-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/mmc-wbsd-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/ixgbe-fix-pci-device-refcount-leak.patch
queue-5.4/rapidio-devices-fix-missing-put_device-in-mport_cdev.patch
queue-5.4/regulator-core-fix-module-refcount-leak-in-set_suppl.patch
queue-5.4/bluetooth-hci_core-don-t-call-kfree_skb-under-spin_l.patch
queue-5.4/hsi-omap_ssi_core-fix-unbalanced-pm_runtime_disable.patch
queue-5.4/macintosh-fix-possible-memory-leak-in-macio_add_one_.patch
queue-5.4/mmc-omap_hsmmc-fix-return-value-check-of-mmc_add_hos.patch
queue-5.4/mmc-mmci-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/cxl-fix-possible-null-ptr-deref-in-cxl_pci_init_afu-.patch
queue-5.4/hamradio-don-t-call-dev_kfree_skb-under-spin_lock_ir.patch
queue-5.4/drivers-dio-fix-possible-memory-leak-in-dio_init.patch
queue-5.4/bluetooth-hci_bcsp-don-t-call-kfree_skb-under-spin_l.patch
queue-5.4/chardev-fix-error-handling-in-cdev_device_add.patch
queue-5.4/net-ethernet-dnet-don-t-call-dev_kfree_skb-under-spi.patch
queue-5.4/misc-ocxl-fix-possible-name-leak-in-ocxl_file_regist.patch
queue-5.4/regulator-core-fix-unbalanced-of-node-refcount-in-re.patch
queue-5.4/mmc-atmel-mci-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/pnp-fix-name-memory-leak-in-pnp_alloc_dev.patch
queue-5.4/media-solo6x10-fix-possible-memory-leak-in-solo_sysf.patch
queue-5.4/usb-typec-tcpci-fix-of-node-refcount-leak-in-tcpci_r.patch
queue-5.4/mcb-mcb-parse-fix-error-handing-in-chameleon_parse_g.patch
queue-5.4/mmc-meson-gx-fix-return-value-check-of-mmc_add_host.patch
queue-5.4/net-apple-bmac-don-t-call-dev_kfree_skb-under-spin_l.patch
queue-5.4/class-fix-possible-memory-leak-in-__class_register.patch
queue-5.4/bluetooth-btusb-don-t-call-kfree_skb-under-spin_lock.patch
queue-5.4/iommu-amd-fix-pci-device-refcount-leak-in-ppr_notifi.patch
queue-5.4/rapidio-rio-fix-possible-name-leak-in-rio_register_m.patch
queue-5.4/rapidio-fix-possible-name-leaks-when-rio_add_device-.patch
queue-5.4/bluetooth-hci_ll-don-t-call-kfree_skb-under-spin_loc.patch
queue-5.4/mmc-wmt-sdmmc-fix-return-value-check-of-mmc_add_host.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux