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] [day] [month] [year] [list]
Message-ID: <20200614134207.GA17297@rowland.harvard.edu>
Date:   Sun, 14 Jun 2020 09:42:07 -0400
From:   Alan Stern <stern@...land.harvard.edu>
To:     Aditya Pakki <pakki001@....edu>
Cc:     kjlu@....edu, wu000273@....edu,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Eugeniu Rosca <erosca@...adit-jv.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Mathias Nyman <mathias.nyman@...ux.intel.com>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        "Lee, Chiasheng" <chiasheng.lee@...el.com>,
        David Heinzelmann <heinzelmann.david@...il.com>,
        Hardik Gajjar <hgajjar@...adit-jv.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: core: fix reference count leak in usb_port_resume

On Sat, Jun 13, 2020 at 10:33:53PM -0500, Aditya Pakki wrote:
> usb_port_resume() calls pm_runtime_get_sync() that increments
> the reference counter. In case of failure, decrement the reference
> count and return the error.
> 
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
>  drivers/usb/core/hub.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index b1e14beaac5f..a9231f27144e 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3542,6 +3542,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
>  		if (status < 0) {
>  			dev_dbg(&udev->dev, "can't resume usb port, status %d\n",
>  					status);
> +			pm_runtime_put_sync(&port_dev->dev);

This is wrong; you need to do test_and_clear_bit(port1, 
hub->child_usage_bits) before calling pm_runtime_put_sync().  Otherwise 
the child_usage_bits value will get out of sync with the port's runtime 
status.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ