Re: [PATCH 1/3] usb: phy: get phy driver's module if phy is acquired

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

 



On Thu, 23 Aug 2012, Marc Kleine-Budde wrote:

> Otherwise the module's refcount is 0 and it's possible to unload the module,
> even if the phy is in use.

> @@ -139,8 +140,10 @@ EXPORT_SYMBOL(devm_usb_put_phy);
>   */
>  void usb_put_phy(struct usb_phy *x)
>  {
> -	if (x)
> +	if (x) {
>  		put_device(x->dev);
> +		module_put(x->dev->driver->owner);
> +	}

You musn't dereference x->dev after calling put_device().  Instead, 
save x->dev->driver->owner beforehand.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux