~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to kernel/sysctl_binary.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1321
1321
        void __user *oldval, size_t oldlen, void __user *newval, size_t newlen)
1322
1322
{
1323
1323
        const struct bin_table *table = NULL;
1324
 
        struct nameidata nd;
1325
1324
        struct vfsmount *mnt;
1326
1325
        struct file *file;
1327
1326
        ssize_t result;
1328
1327
        char *pathname;
1329
1328
        int flags;
1330
 
        int acc_mode;
1331
1329
 
1332
1330
        pathname = sysctl_getname(name, nlen, &table);
1333
1331
        result = PTR_ERR(pathname);
1337
1335
        /* How should the sysctl be accessed? */
1338
1336
        if (oldval && oldlen && newval && newlen) {
1339
1337
                flags = O_RDWR;
1340
 
                acc_mode = MAY_READ | MAY_WRITE;
1341
1338
        } else if (newval && newlen) {
1342
1339
                flags = O_WRONLY;
1343
 
                acc_mode = MAY_WRITE;
1344
1340
        } else if (oldval && oldlen) {
1345
1341
                flags = O_RDONLY;
1346
 
                acc_mode = MAY_READ;
1347
1342
        } else {
1348
1343
                result = 0;
1349
1344
                goto out_putname;
1350
1345
        }
1351
1346
 
1352
1347
        mnt = current->nsproxy->pid_ns->proc_mnt;
1353
 
        result = vfs_path_lookup(mnt->mnt_root, mnt, pathname, 0, &nd);
1354
 
        if (result)
1355
 
                goto out_putname;
1356
 
 
1357
 
        result = may_open(&nd.path, acc_mode, flags);
1358
 
        if (result)
1359
 
                goto out_putpath;
1360
 
 
1361
 
        file = dentry_open(nd.path.dentry, nd.path.mnt, flags, current_cred());
 
1348
        file = file_open_root(mnt->mnt_root, mnt, pathname, flags);
1362
1349
        result = PTR_ERR(file);
1363
1350
        if (IS_ERR(file))
1364
1351
                goto out_putname;
1370
1357
        putname(pathname);
1371
1358
out:
1372
1359
        return result;
1373
 
 
1374
 
out_putpath:
1375
 
        path_put(&nd.path);
1376
 
        goto out_putname;
1377
1360
}
1378
1361
 
1379
1362