Re: [PATCH v3] pps: Fix a use-after-free

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

 



On Tuesday 11/05 at 10:44 +0100, Greg Kroah-Hartman wrote:
> On Mon, Nov 04, 2024 at 11:56:19PM -0800, Calvin Owens wrote:
> > -	dev_info(pps->dev, "removed\n");
> > +	dev_info(&pps->dev, "removed\n");
> 
> Nit, when drivers work properly,  they are quiet, no need for these
> dev_info() calls.

I'll change these to dev_dbg().

> >  static int pps_cdev_release(struct inode *inode, struct file *file)
> >  {
> > -	struct pps_device *pps = container_of(inode->i_cdev,
> > -						struct pps_device, cdev);
> > -	kobject_put(&pps->dev->kobj);
> > +	struct pps_device *pps = file->private_data;
> > +
> > +	WARN_ON(pps->id != iminor(inode));
> 
> If this can happen, handle it and move on.  Don't just reboot the
> machine if it's something that could be triggered (remember about
> panic-on-warn systems.)

It's a fairly paranoid WARN(): it's a bug if it happens, and I don't
think it can happen. Should I remove it?

The test-robot found a couple *pps->dev dereferences I missed, I'll send
a v4 in the next day or two with those fixed as well.

Thanks,
Calvin

> thanks,
> 
> greg k-h




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux