[PATCH] mtrr: s/suser/capable/

From: Arnaldo Carvalho de Melo (acme@conectiva.com.br)
Date: Wed Aug 30 2000 - 18:56:07 EST


Hi,

                Please consider applying.

                        - Arnaldo

--- linux-2.4.0-test8-pre1/arch/i386/kernel/mtrr.c Thu Jul 13 01:58:41 2000
+++ linux-2.4.0-test8-pre1.acme/arch/i386/kernel/mtrr.c Wed Aug 30 20:52:48 2000
@@ -1427,7 +1427,7 @@
     char *ptr;
     char line[LINE_SIZE];
 
- if ( !suser () ) return -EPERM;
+ if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
     /* Can't seek (pwrite) on this device */
     if (ppos != &file->f_pos) return -ESPIPE;
     memset (line, 0, LINE_SIZE);
@@ -1487,28 +1487,28 @@
       default:
         return -ENOIOCTLCMD;
       case MTRRIOC_ADD_ENTRY:
- if ( !suser () ) return -EPERM;
+ if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
         if ( copy_from_user (&sentry, (void *) arg, sizeof sentry) )
             return -EFAULT;
         err = mtrr_file_add (sentry.base, sentry.size, sentry.type, 1, file);
         if (err < 0) return err;
         break;
       case MTRRIOC_SET_ENTRY:
- if ( !suser () ) return -EPERM;
+ if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
         if ( copy_from_user (&sentry, (void *) arg, sizeof sentry) )
             return -EFAULT;
         err = mtrr_add (sentry.base, sentry.size, sentry.type, 0);
         if (err < 0) return err;
         break;
       case MTRRIOC_DEL_ENTRY:
- if ( !suser () ) return -EPERM;
+ if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
         if ( copy_from_user (&sentry, (void *) arg, sizeof sentry) )
             return -EFAULT;
         err = mtrr_file_del (sentry.base, sentry.size, file);
         if (err < 0) return err;
         break;
       case MTRRIOC_KILL_ENTRY:
- if ( !suser () ) return -EPERM;
+ if ( !capable(CAP_SYS_ADMIN) ) return -EPERM;
         if ( copy_from_user (&sentry, (void *) arg, sizeof sentry) )
             return -EFAULT;
         err = mtrr_del (-1, sentry.base, sentry.size);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:26 EST