Re: [PATCH 3/9] staging: unisys: visorinput: use kref ref-counting for device data struct

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

 



On Fri, Oct 16, 2015 at 10:06:48AM -0400, Benjamin Romer wrote:
> @@ -526,7 +549,8 @@ visorinput_channel_interrupt(struct visor_device *dev)
>  	int xmotion, ymotion, zmotion, button;
>  	int i;
>  
> -	struct visorinput_devdata *devdata = dev_get_drvdata(&dev->device);
> +	struct visorinput_devdata *devdata =
> +		devdata_get(dev_get_drvdata(&dev->device));
>  
>  	if (!devdata)
>  		return;
> @@ -616,6 +640,7 @@ visorinput_channel_interrupt(struct visor_device *dev)
>  		}
>  	}
>  out_locked:
> +	devdata_put(devdata);
>  	up_write(&devdata->lock_visor_dev);
>  }

Always release resources in the reverse order from how they were taken.
So we call devdata_put() after up_write().  Otherwise it looks like a
use after free or something.

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux