[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c8b56fabd1644b50dd7ca14d8e7e49aa92750a7.camel@perches.com>
Date: Tue, 17 Jul 2018 11:50:57 -0700
From: Joe Perches <joe@...ches.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Todd Poynor <toddpoynor@...il.com>
Cc: Rob Springer <rspringer@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Ben Chan <benchan@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, Zhongze Hu <frankhu@...omium.org>,
linux-kernel@...r.kernel.org, Simon Que <sque@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
Todd Poynor <toddpoynor@...gle.com>,
Dmitry Torokhov <dtor@...omium.org>
Subject: Re: [PATCH 16/32] staging: gasket: always allow root open for write
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
Powered by blists - more mailing lists