Re: [patch -next] HID: unlock on error path in hid_device_probe()

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

 



On Wed, 24 Aug 2011, Dan Carpenter wrote:

> We recently introduced locking into this function, but we missed an
> error path which needs an unlock.
> 
> Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 582be00..ed0cd09 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1643,8 +1643,10 @@ static int hid_device_probe(struct device *dev)
>  
>  	if (!hdev->driver) {
>  		id = hid_match_device(hdev, hdrv);
> -		if (id == NULL)
> -			return -ENODEV;
> +		if (id == NULL) {
> +			ret = -ENODEV;
> +			goto unlock;
> +		}
>  
>  		hdev->driver = hdrv;
>  		if (hdrv->probe) {
> @@ -1657,7 +1659,7 @@ static int hid_device_probe(struct device *dev)
>  		if (ret)
>  			hdev->driver = NULL;
>  	}
> -
> +unlock:
>  	up(&hdev->driver_lock);
>  	return ret;
>  }

Good catch Dan, thanks. Applied.

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-input" 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 Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux