linux/drivers/block
Juergen Gross abf1fd5919 xen/blkfront: don't use gnttab_query_foreign_access() for mapped status
It isn't enough to check whether a grant is still being in use by
calling gnttab_query_foreign_access(), as a mapping could be realized
by the other side just after having called that function.

In case the call was done in preparation of revoking a grant it is
better to do so via gnttab_end_foreign_access_ref() and check the
success of that operation instead.

For the ring allocation use alloc_pages_exact() in order to avoid
high order pages in case of a multi-page ring.

If a grant wasn't unmapped by the backend without persistent grants
being used, set the device state to "error".

This is CVE-2022-23036 / part of XSA-396.

Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
V2:
- use gnttab_try_end_foreign_access()
V4:
- use alloc_pages_exact() and free_pages_exact()
- set state to error if backend didn't unmap (Roger Pau Monné)
2022-03-07 09:48:54 +01:00
..
aoe aoe: remove redundant assignment on variable n 2022-01-13 13:00:45 -07:00
drbd drbd: Use struct_group() to zero algs 2021-12-13 16:31:24 -07:00
mtip32xx block: fix surprise removal for drivers calling blk_set_queue_dying 2022-02-17 07:54:03 -07:00
null_blk block: null_blk: only set set->nr_maps as 3 if active poll_queues is > 0 2021-12-23 22:05:50 -07:00
paride Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
rnbd bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
xen-blkback block: remove GENHD_FL_CD 2021-11-29 06:35:21 -07:00
zram Merge branch 'akpm' (patches from Andrew) 2022-01-15 20:37:06 +02:00
amiflop.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
ataflop.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
brd.c brd: remove brd_devices_mutex mutex 2022-01-17 07:19:40 -07:00
floppy.c floppy: Add max size check for user space request 2021-12-03 06:32:40 -07:00
Kconfig block: remove the rsxx driver 2021-12-16 10:57:04 -07:00
loop.c block: loop:use kstatfs.f_bsize of backing file to set discard granularity 2022-02-11 15:10:49 -07:00
loop.h loop: revert "make autoclear operation asynchronous" 2022-02-11 05:51:23 -07:00
Makefile block: remove the rsxx driver 2021-12-16 10:57:04 -07:00
n64cart.c block: rename GENHD_FL_NO_PART_SCAN to GENHD_FL_NO_PART 2021-11-29 06:35:21 -07:00
nbd.c for-5.16/drivers-2021-11-09 2021-11-09 11:24:08 -08:00
pktcdvd.c pktcdvd: convert to use attribute groups 2022-01-03 21:24:34 -07:00
ps3disk.c ps3disk: add error handling support for add_disk() 2021-10-30 11:03:37 -06:00
ps3vram.c block: remove GENHD_FL_EXT_DEVT 2021-11-29 06:38:35 -07:00
rbd.c block: fix surprise removal for drivers calling blk_set_queue_dying 2022-02-17 07:54:03 -07:00
rbd_types.h libceph, rbd: replace zero-length array with flexible-array 2020-06-01 13:22:53 +02:00
sunvdc.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
swim.c block: remove GENHD_FL_EXT_DEVT 2021-11-29 06:38:35 -07:00
swim3.c block: remove GENHD_FL_EXT_DEVT 2021-11-29 06:38:35 -07:00
swim_asm.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
sx8.c block: remove the gendisk argument to blk_execute_rq 2021-11-29 06:41:29 -07:00
virtio_blk.c virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
xen-blkfront.c xen/blkfront: don't use gnttab_query_foreign_access() for mapped status 2022-03-07 09:48:54 +01:00
z2ram.c block: remove GENHD_FL_EXT_DEVT 2021-11-29 06:38:35 -07:00