Skip to content

Commit

Permalink
agp: remove uid comparison as security check
Browse files Browse the repository at this point in the history
In the face of containers and user namespaces, a uid==0 check for
security is not safe.  Switch to a capability check.

I'm not sure I picked the right capability, but this being AGP
CAP_SYS_RAWIO seemed to make sense.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
serue@us.ibm.com authored and Dave Airlie committed Feb 5, 2008
1 parent 1fa4db7 commit 62f29ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/char/agp/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ static int agp_open(struct inode *inode, struct file *file)
set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
priv->my_pid = current->pid;

if ((current->uid == 0) || (current->suid == 0)) {
if (capable(CAP_SYS_RAWIO)) {
/* Root priv, can be controller */
set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags);
}
Expand Down

0 comments on commit 62f29ba

Please sign in to comment.