lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B00D6E2.9010404@np.css.fujitsu.com>
Date:	Mon, 16 Nov 2009 13:36:50 +0900
From:	Jin Dongming <jin.dongming@...css.fujitsu.com>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
CC:	pm list <linux-pm@...ts.linux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux PCI <linux-pci@...r.kernel.org>,
	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	Alan Stern <stern@...land.harvard.edu>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Matthew Garrett <mjg59@...f.ucam.org>,
	Oliver Neukum <oliver@...kum.org>,
	Shaohua Li <shaohua.li@...el.com>,
	Bjorn Helgaas <bjorn.helgaas@...com>
Subject: Re: [RFC][PATCH 9/10] PCI / ACPI PM: Platform support for PCI PME
 wake-up (rev. 3)

Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@...k.pl>
> +/**
> + * pci_acpi_add_pm_notifier - Register PM notifier for given device.
> + * @dev: ACPI device to add the notifier for.
> + * @pci_dev: PCI device to check for the PME status if an event is signaled.
> + * @pci_bus: PCI bus to walk (checking PME status) if an event is signaled.
> + *
> + * Check if there is a notifier object for @dev and if that is the case, add
> + * @pci_dev to it as the device whose PME status should be checked if a PM
> + * event is signaled for @dev.  Also, add @pci_bus to it as the bus to walk
> + * checking the PME status of all devices on it if a PM event is signaled for
> + * @dev.  Otherwise, create a new notifier object for @dev and add both
> + * @pci_dev and @pci_bus to it.
> + */
> +acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev,
> +				     struct pci_dev *pci_dev,
> +				     struct pci_bus *pci_bus)
> +{
> +	struct pci_acpi_notifier_block *nb;
> +	acpi_status status = AE_OK;
> +
> +	if (!dev->wakeup.flags.run_wake)
> +		return AE_BAD_PARAMETER;
> +
> +	mutex_lock(&pci_acpi_notifier_mtx);
> +
> +	list_for_each_entry(nb, &pci_acpi_runtime_notifiers, entry)
> +		if (nb->dev == dev) {
> +			if (nb->pci_dev || nb->pci_bus)
> +				goto out;
> +			else
> +				goto add;
> +		}
> +
> +	nb = new_notifier(dev);
> +	if (!nb) {
> +		status = AE_NO_MEMORY;
> +		goto out;
> +	}
> +	list_add_tail(&nb->entry, &pci_acpi_runtime_notifiers);
> +
> +	status = acpi_install_notify_handler(dev->handle, ACPI_SYSTEM_NOTIFY,
> +						pci_acpi_event_fn, nb);
> +	if (ACPI_FAILURE(status)) {
> +		list_del(&nb->entry);
> +		kfree(nb);
> +	}

I think when nb is freed, it should be go to "out:".

> +
> + add:
> +	nb->pci_dev = pci_dev;
> +	nb->pci_bus = pci_bus;
> +
> + out:
> +	mutex_unlock(&pci_acpi_notifier_mtx);
> +	return status;
> +}
> +
> +/**
> + * pci_acpi_remove_pm_notifier - Unregister PM notifier for given device.
> + * @dev: ACPI device to remove the notifier from.
> + *
> + * Find the notifier object for @dev and clear its @pci_dev and @pci_bus fields.
> + * If the notifier object is not necessary any more after that, remove it too.
> + */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ