> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Friday, October 16, 2015 9:03 PM
> To: Romer, Benjamin M
> Cc: gre...@linuxfoundation.org; *S-Par-Maintainer; driverdev-
> de...@linuxdriverproject.org; Sell, Timothy C
> Subject: Re: [PATCH 3/9] staging: unisys: visorinput: use kref ref-counting
> for device data struct
> 
> 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

Good point; thanks.  I generally follow that rule, but somehow missed it this
time.  We'll re-submit this patch with those lines reversed, as you suggest.

Tim Sell

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to