Re: [PATCH 16/32] staging: gasket: always allow root open for write

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

 



On Tue, 2018-07-17 at 13:22 +0300, Dan Carpenter wrote:
> On Mon, Jul 16, 2018 at 07:09:10PM -0700, Todd Poynor wrote:
> > --- a/drivers/staging/gasket/apex_driver.c
> > +++ b/drivers/staging/gasket/apex_driver.c
> > @@ -630,13 +630,10 @@ static bool is_gcb_in_reset(struct gasket_dev *gasket_dev)
> >  static uint apex_ioctl_check_permissions(struct file *filp, uint cmd)
> 
> This function name is a bit of out of date.
> 
> >  {
> >  	struct gasket_dev *gasket_dev = filp->private_data;
> > -	int root = capable(CAP_SYS_ADMIN);
> > -	int is_owner = gasket_dev->dev_info.ownership.is_owned &&
> > -		       current->tgid == gasket_dev->dev_info.ownership.owner;
> > +	fmode_t write;
> >  
> > -	if (root || is_owner)
> > -		return 1;
> > -	return 0;
> > +	write = filp->f_mode & FMODE_WRITE;
> > +	return write;
> 
> This doesn't match the comment because it returns 0x2 or zero.
> 
> 	return !!(filp->f_mode & FMODE_WRITE);

Or maybe change the functions to return bool

_______________________________________________
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