Skip to content

Commit 729e3d0

Browse files
committed
Merge tag 'ceph-for-5.9-rc5' of git://github.com/ceph/ceph-client
Pull ceph fix from Ilya Dryomov: "Add missing capability checks in rbd, marked for stable" * tag 'ceph-for-5.9-rc5' of git://github.com/ceph/ceph-client: rbd: require global CAP_SYS_ADMIN for mapping and unmapping
2 parents e9287bd + f44d04e commit 729e3d0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/block/rbd.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5120,6 +5120,9 @@ static ssize_t rbd_config_info_show(struct device *dev,
51205120
{
51215121
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
51225122

5123+
if (!capable(CAP_SYS_ADMIN))
5124+
return -EPERM;
5125+
51235126
return sprintf(buf, "%s\n", rbd_dev->config_info);
51245127
}
51255128

@@ -5231,6 +5234,9 @@ static ssize_t rbd_image_refresh(struct device *dev,
52315234
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
52325235
int ret;
52335236

5237+
if (!capable(CAP_SYS_ADMIN))
5238+
return -EPERM;
5239+
52345240
ret = rbd_dev_refresh(rbd_dev);
52355241
if (ret)
52365242
return ret;
@@ -7059,6 +7065,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
70597065
struct rbd_client *rbdc;
70607066
int rc;
70617067

7068+
if (!capable(CAP_SYS_ADMIN))
7069+
return -EPERM;
7070+
70627071
if (!try_module_get(THIS_MODULE))
70637072
return -ENODEV;
70647073

@@ -7209,6 +7218,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
72097218
bool force = false;
72107219
int ret;
72117220

7221+
if (!capable(CAP_SYS_ADMIN))
7222+
return -EPERM;
7223+
72127224
dev_id = -1;
72137225
opt_buf[0] = '\0';
72147226
sscanf(buf, "%d %5s", &dev_id, opt_buf);

0 commit comments

Comments
 (0)