@@ -3945,6 +3945,9 @@ static ssize_t rbd_image_refresh(struct device *dev,
struct rbd_device *rbd_dev = dev_to_rbd_dev(dev);
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
ret = rbd_dev_refresh(rbd_dev);
if (ret)
return ret;
@@ -5404,6 +5407,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
bool read_only;
int rc;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
if (!try_module_get(THIS_MODULE))
return -ENODEV;
@@ -5548,6 +5554,9 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
bool already = false;
int ret;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
ret = kstrtoul(buf, 10, &ul);
if (ret)
return ret;