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

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

 



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.

>  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.)

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