linux-stable/drivers/block
Ilya Dryomov af4a889949 rbd: require global CAP_SYS_ADMIN for mapping and unmapping
commit f44d04e696 upstream.

It turns out that currently we rely only on sysfs attribute
permissions:

  $ ll /sys/bus/rbd/{add*,remove*}
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/add
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/add_single_major
  --w------- 1 root root 4096 Sep  3 20:37 /sys/bus/rbd/remove
  --w------- 1 root root 4096 Sep  3 20:38 /sys/bus/rbd/remove_single_major

This means that images can be mapped and unmapped (i.e. block devices
can be created and deleted) by a UID 0 process even after it drops all
privileges or by any process with CAP_DAC_OVERRIDE in its user namespace
as long as UID 0 is mapped into that user namespace.

Be consistent with other virtual block devices (loop, nbd, dm, md, etc)
and require CAP_SYS_ADMIN in the initial user namespace for mapping and
unmapping, and also for dumping the configuration string and refreshing
the image header.

Cc: stable@vger.kernel.org
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-23 10:46:30 +02:00
..
aoe
drbd signal: Allow cifs and drbd to receive their terminating signals 2020-01-27 14:46:43 +01:00
mtip32xx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
paride cdrom: do not call check_disk_change() inside cdrom_open() 2018-05-30 07:52:34 +02:00
rsxx rsxx: add missed destroy_workqueue calls in remove 2019-12-17 20:37:30 +01:00
xen-blkback xen/blkback: Avoid unmapping unmapped grant pages 2020-01-09 10:17:59 +01:00
zram block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h> 2020-09-09 19:03:12 +02:00
amiflop.c amiflop: clean up on errors during setup 2019-12-01 09:13:26 +01:00
ataflop.c ataflop: fix error handling during setup 2018-11-13 11:14:51 -08:00
brd.c block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h> 2020-09-09 19:03:12 +02:00
cryptoloop.c
DAC960.c
DAC960.h
floppy.c floppy: check FDC index for errors before assigning it 2020-02-28 16:36:10 +01:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
loop.c loop: replace kill_bdev with invalidate_bdev 2020-06-30 15:38:02 -04:00
loop.h Revert "block/loop: Use global lock for ioctl() operation." 2019-05-02 09:40:33 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
nbd.c nbd: Fix memory leak in nbd_add_socket 2020-07-22 09:22:17 +02:00
null_blk.c block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h> 2020-09-09 19:03:12 +02:00
pktcdvd.c pktcdvd: remove warning on attempting to register non-passthrough dev 2019-10-07 18:55:13 +02:00
ps3disk.c ps3disk: use the default segment boundary 2020-06-25 15:41:49 +02:00
ps3vram.c
rbd.c rbd: require global CAP_SYS_ADMIN for mapping and unmapping 2020-09-23 10:46:30 +02:00
rbd_types.h
skd_main.c skd: fixup usage of legacy IO API 2019-12-01 09:13:20 +01:00
skd_s1120.h skd: Use __packed only when needed 2017-08-18 08:45:29 -06:00
smart1,2.h
sunvdc.c sunvdc: Do not spin in an infinite loop when vio_ldc_send() returns EAGAIN 2019-02-12 19:46:00 +01:00
swim.c swim: fix cleanup on setup error 2018-11-13 11:14:52 -08:00
swim3.c block/swim3: Fix -EBUSY error when re-opening device after unmount 2019-02-12 19:46:09 +01:00
swim_asm.S
sx8.c
umem.c
umem.h
virtio_blk.c virtio-blk: free vblk-vqs in error path of virtblk_probe() 2020-07-09 09:36:31 +02:00
xen-blkfront.c xen/blkfront: Adjust indentation in xlvbd_alloc_gendisk 2020-01-23 08:20:35 +01:00
xsysace.c xsysace: Fix error handling in ace_setup 2019-05-08 07:20:51 +02:00
z2ram.c