super.c (6967963d6d5cac40a091d075326f0e3ccb95c58a) | super.c (dae7b665cf6d6e6e733f1c9c16cf55547dd37e33) |
---|---|
1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 621 unchanged lines hidden (view full) --- 630{ 631 struct btrfs_ioctl_vol_args *vol; 632 struct btrfs_fs_devices *fs_devices; 633 int ret = -ENOTTY; 634 635 if (!capable(CAP_SYS_ADMIN)) 636 return -EPERM; 637 | 1/* 2 * Copyright (C) 2007 Oracle. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public 6 * License v2 as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, --- 621 unchanged lines hidden (view full) --- 630{ 631 struct btrfs_ioctl_vol_args *vol; 632 struct btrfs_fs_devices *fs_devices; 633 int ret = -ENOTTY; 634 635 if (!capable(CAP_SYS_ADMIN)) 636 return -EPERM; 637 |
638 vol = kmalloc(sizeof(*vol), GFP_KERNEL); 639 if (!vol) 640 return -ENOMEM; | 638 vol = memdup_user((void __user *)arg, sizeof(*vol)); 639 if (IS_ERR(vol)) 640 return PTR_ERR(vol); |
641 | 641 |
642 if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) { 643 ret = -EFAULT; 644 goto out; 645 } 646 | |
647 switch (cmd) { 648 case BTRFS_IOC_SCAN_DEV: 649 ret = btrfs_scan_one_device(vol->name, FMODE_READ, 650 &btrfs_fs_type, &fs_devices); 651 break; 652 } | 642 switch (cmd) { 643 case BTRFS_IOC_SCAN_DEV: 644 ret = btrfs_scan_one_device(vol->name, FMODE_READ, 645 &btrfs_fs_type, &fs_devices); 646 break; 647 } |
653out: | 648 |
654 kfree(vol); 655 return ret; 656} 657 658static int btrfs_freeze(struct super_block *sb) 659{ 660 struct btrfs_root *root = btrfs_sb(sb); 661 mutex_lock(&root->fs_info->transaction_kthread_mutex); --- 111 unchanged lines hidden --- | 649 kfree(vol); 650 return ret; 651} 652 653static int btrfs_freeze(struct super_block *sb) 654{ 655 struct btrfs_root *root = btrfs_sb(sb); 656 mutex_lock(&root->fs_info->transaction_kthread_mutex); --- 111 unchanged lines hidden --- |