ChangeSet 1.2259, 2005/03/31 08:36:12-08:00, [EMAIL PROTECTED]

        [PATCH] uml: fix hostfs special perm handling
        
        When opening devices nodes on hostfs, it does not make sense to call 
access(),
        since we are not going to open the file on the host.
        
        If the device node is owned by root, the root user in UML should 
succeed in
        opening it, even if UML won't be able to open the file.
        
        As reported by Rob Landley, UML currently does not follow this, so 
here's a
        fix.
        
        Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>
        CC: Rob Landley <[EMAIL PROTECTED]>
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 hostfs_kern.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)


diff -Nru a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
--- a/fs/hostfs/hostfs_kern.c   2005-03-31 10:17:20 -08:00
+++ b/fs/hostfs/hostfs_kern.c   2005-03-31 10:17:20 -08:00
@@ -806,15 +806,21 @@
        char *name;
        int r = 0, w = 0, x = 0, err;
 
-       if(desired & MAY_READ) r = 1;
-       if(desired & MAY_WRITE) w = 1;
-       if(desired & MAY_EXEC) x = 1;
+       if (desired & MAY_READ) r = 1;
+       if (desired & MAY_WRITE) w = 1;
+       if (desired & MAY_EXEC) x = 1;
        name = inode_name(ino, 0);
-       if(name == NULL) return(-ENOMEM);
-       err = access_file(name, r, w, x);
+       if (name == NULL) return(-ENOMEM);
+
+       if (S_ISCHR(ino->i_mode) || S_ISBLK(ino->i_mode) ||
+                       S_ISFIFO(ino->i_mode) || S_ISSOCK(ino->i_mode))
+               err = 0;
+       else
+               err = access_file(name, r, w, x);
        kfree(name);
-       if(!err) err = generic_permission(ino, desired, NULL);
-       return(err);
+       if(!err)
+               err = generic_permission(ino, desired, NULL);
+       return err;
 }
 
 int hostfs_setattr(struct dentry *dentry, struct iattr *attr)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to