Commit 83358160 authored by Jens Axboe's avatar Jens Axboe

Replace calls to suser() with capable(). Move those checks to be

as late as possible to avoid accounting overcharging processes with             
privilege usage.  Applies to 2.5.4-pre3                                         
-- steve.cameron@compaq.com
parent 0ce4eb3c
......@@ -372,21 +372,18 @@ static int cciss_open(struct inode *inode, struct file *filep)
if (ctlr > MAX_CTLR || hba[ctlr] == NULL)
return -ENXIO;
if (!suser() && hba[ctlr]->sizes[minor(inode->i_rdev)] == 0)
return -ENXIO;
/*
* Root is allowed to open raw volume zero even if its not configured
* so array config can still work. I don't think I really like this,
* but I'm already using way to many device nodes to claim another one
* for "raw controller".
*/
if (suser()
&& (hba[ctlr]->sizes[minor(inode->i_rdev)] == 0)
&& (minor(inode->i_rdev)!= 0))
if (hba[ctlr]->sizes[minor(inode->i_rdev)] == 0) {
if (minor(inode->i_rdev) != 0)
return -ENXIO;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
}
hba[ctlr]->drv[dsk].usage_count++;
hba[ctlr]->usage_count++;
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment