Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f661848b authored by Jiang Liu's avatar Jiang Liu Committed by Matthew Garrett
Browse files

eeepc-laptop: fix device reference count leakage in eeepc_rfkill_hotplug()



Fix a device reference count leakage issue in function
eeepc_rfkill_hotplug().

Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
parent 3f5449bf
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -610,12 +610,12 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)


		if (!bus) {
		if (!bus) {
			pr_warn("Unable to find PCI bus 1?\n");
			pr_warn("Unable to find PCI bus 1?\n");
			goto out_unlock;
			goto out_put_dev;
		}
		}


		if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) {
		if (pci_bus_read_config_dword(bus, 0, PCI_VENDOR_ID, &l)) {
			pr_err("Unable to read PCI config space?\n");
			pr_err("Unable to read PCI config space?\n");
			goto out_unlock;
			goto out_put_dev;
		}
		}


		absent = (l == 0xffffffff);
		absent = (l == 0xffffffff);
@@ -627,7 +627,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
				absent ? "absent" : "present");
				absent ? "absent" : "present");
			pr_warn("skipped wireless hotplug as probably "
			pr_warn("skipped wireless hotplug as probably "
				"inappropriate for this model\n");
				"inappropriate for this model\n");
			goto out_unlock;
			goto out_put_dev;
		}
		}


		if (!blocked) {
		if (!blocked) {
@@ -635,7 +635,7 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
			if (dev) {
			if (dev) {
				/* Device already present */
				/* Device already present */
				pci_dev_put(dev);
				pci_dev_put(dev);
				goto out_unlock;
				goto out_put_dev;
			}
			}
			dev = pci_scan_single_device(bus, 0);
			dev = pci_scan_single_device(bus, 0);
			if (dev) {
			if (dev) {
@@ -650,6 +650,8 @@ static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle)
				pci_dev_put(dev);
				pci_dev_put(dev);
			}
			}
		}
		}
out_put_dev:
		pci_dev_put(port);
	}
	}


out_unlock:
out_unlock: