From: Zhao Hongjiang <zhaohongjiang37@gmail.com>
To: axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] block: change return values from -EACCES to -EPERM
Date: Sat, 22 Sep 2012 17:07:11 +0800 [thread overview]
Message-ID: <505D7FBF.1080505@gmail.com> (raw)
From: Zhao Hongjiang <zhaohongjiang@huawei.com>
Change return value from -EACCES to -EPERM when the permission check fails.
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
---
This patch is based on linux-next tree http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
---
block/compat_ioctl.c | 2 +-
block/ioctl.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index 7c668c8..a21bf98 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -725,7 +725,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
case BLKRASET: /* compatible, but no compat_ptr (!) */
case BLKFRASET:
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
bdi = blk_get_backing_dev_info(bdev);
if (bdi == NULL)
return -ENOTTY;
diff --git a/block/ioctl.c b/block/ioctl.c
index a31d91d..b7d6f07 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -21,7 +21,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
int partno;
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
if (copy_from_user(&a, arg, sizeof(struct blkpg_ioctl_arg)))
return -EFAULT;
if (copy_from_user(&p, a.data, sizeof(struct blkpg_partition)))
@@ -158,7 +158,7 @@ static int blkdev_reread_part(struct block_device *bdev)
if (!disk_part_scan_enabled(disk) || bdev != bdev->bd_contains)
return -EINVAL;
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
if (!mutex_trylock(&bdev->bd_mutex))
return -EBUSY;
res = rescan_partitions(disk, bdev);
@@ -282,7 +282,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
switch(cmd) {
case BLKFLSBUF:
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
if (!is_unrecognized_ioctl(ret))
@@ -297,7 +297,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
if (!is_unrecognized_ioctl(ret))
return ret;
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
if (get_user(n, (int __user *)(arg)))
return -EFAULT;
set_device_ro(bdev, n);
@@ -381,7 +381,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case BLKRASET:
case BLKFRASET:
if(!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
bdi = blk_get_backing_dev_info(bdev);
if (bdi == NULL)
return -ENOTTY;
@@ -390,7 +390,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
case BLKBSZSET:
/* set the logical block size */
if (!capable(CAP_SYS_ADMIN))
- return -EACCES;
+ return -EPERM;
if (!arg)
return -EINVAL;
if (get_user(n, (int __user *) arg))
-- 1.7.1
reply other threads:[~2012-09-22 9:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=505D7FBF.1080505@gmail.com \
--to=zhaohongjiang37@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox