Ming Lei
7fe0d300ab
BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
...
Grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter(), and
this way will prevent the request from being re-used when ->fn is
running. The approach is same as what we do during handling timeout.
Fix request use-after-free(UAF) related with completion race or queue
releasing:
- If one rq is referred before rq->q is frozen, then queue won't be
frozen before the request is released during iteration.
- If one rq is referred after rq->q is frozen, refcount_inc_not_zero()
will return false, and we won't iterate over this request.
However, still one request UAF not covered: refcount_inc_not_zero() may
read one freed request, and it will be handled in next patch.
Tested-by: John Garry <[email protected] >
Reviewed-by: Christoph Hellwig <[email protected] >
Reviewed-by: Bart Van Assche <[email protected] >
Signed-off-by: Ming Lei <[email protected] >.
Bug: 197804811
Change-Id: I0e431a8361d1412aaca3f7c0310780d9a9ad0db8
[Upstream: cherry picked from commit 2e315dc07df009c3e29d6926871f62a30cfae394]
[Pradeep: Resolved conflicts in block/blk-mq-tag.c]
Git-commit: a5d38e7c26
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Pradeep P V K <[email protected] >
2021-09-03 05:17:29 -07:00
..
partitions
badblocks.c
bfq-cgroup.c
bfq: fix blkio cgroup leakage v4
2020-09-03 11:26:54 +02:00
bfq-iosched.c
block: only call sched requeue_request() for scheduled requests
2020-09-23 12:40:37 +02:00
bfq-iosched.h
bfq: fix blkio cgroup leakage v4
2020-09-03 11:26:54 +02:00
bfq-wf2q.c
bfq: fix blkio cgroup leakage v4
2020-09-03 11:26:54 +02:00
bio-crypt-ctx.c
ANDROID: dm: add dm-default-key target for metadata encryption
2020-01-24 10:52:54 -08:00
bio-integrity.c
block: release bip in a right way in error path
2020-07-16 08:16:36 +02:00
bio.c
Merge android11-5.4.86+ ( 75c93eb) into msm-5.4
2021-04-22 09:44:51 +05:30
blk-cgroup.c
blk-cgroup: Pre-allocate tree node on blkg_conf_prep
2020-11-10 12:37:30 +01:00
blk-core.c
This is the 5.4.73 stable release
2020-10-29 11:38:08 +01:00
blk-crypto-fallback.c
ANDROID: block: require drivers to declare supported crypto key type(s)
2020-04-07 17:58:49 +00:00
blk-crypto-internal.h
ANDROID: block: make blk_crypto_start_using_mode() properly check for support
2020-04-07 17:58:39 +00:00
blk-crypto.c
ANDROID: block: backport the ability to specify max_dun_bytes
2020-05-15 22:01:33 +00:00
blk-exec.c
blk-flush.c
blk-mq: insert passthrough request into hctx->dispatch directly
2020-03-21 08:11:52 +01:00
blk-integrity.c
blk-ioc.c
block: Fix use-after-free issue accessing struct io_cq
2020-04-17 10:50:04 +02:00
blk-iocost.c
blk-iocost: ioc_pd_free() shouldn't assume irq disabled
2020-09-09 19:12:35 +02:00
blk-iolatency.c
blk-lib.c
blk-map.c
block: fix memleak when __blk_rq_map_user_iov() is failed
2020-01-12 12:21:43 +01:00
blk-merge.c
block: fix get_max_io_size()
2020-09-28 02:54:35 -07:00
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
blk-mq-debugfs: update blk_queue_flag_name[] accordingly for new flags
2020-07-22 09:32:52 +02:00
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c
blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART
2020-09-03 11:27:01 +02:00
blk-mq-sched.h
block: only call sched requeue_request() for scheduled requests
2020-09-23 12:40:37 +02:00
blk-mq-sysfs.c
blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue
2020-10-29 09:57:34 +01:00
blk-mq-tag.c
BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
2021-09-03 05:17:29 -07:00
blk-mq-tag.h
blk-mq-virtio.c
ANDROID: modularize BLK_MQ_VIRTIO
2020-01-31 16:27:30 -08:00
blk-mq.c
BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
2021-09-03 05:17:29 -07:00
blk-mq.h
BACKPORT: blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
2021-09-03 05:17:29 -07:00
blk-pm.c
block: Fix a race in the runtime power management code
2020-08-20 12:17:49 +08:00
blk-pm.h
blk-rq-qos.c
blk-rq-qos.h
blk-settings.c
block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
2020-04-17 10:50:01 +02:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c
blk-mq: move cancel of hctx->run_work to the front of blk_exit_queue
2020-10-29 09:57:34 +01:00
blk-throttle.c
blk-timeout.c
blk-wbt.c
blk-wbt.h
blk-zoned.c
block: Simplify REQ_OP_ZONE_RESET_ALL handling
2020-12-30 11:50:54 +01:00
blk.h
block: fix memleak of bio integrity data
2020-01-26 10:01:09 +01:00
bounce.c
BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series
2020-01-13 18:46:44 +00:00
bsg-lib.c
block: Fix the type of 'sts' in bsg_queue_rq()
2020-01-23 08:22:44 +01:00
bsg.c
cmdline-parser.c
compat_ioctl.c
compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
2020-01-09 10:19:58 +01:00
elevator.c
Revert "block: Enable BFQ io scheduler as default"
2021-06-27 07:09:30 -07:00
genhd.c
ioctl.c
block: simplify blkdev_nr_zones
2020-01-07 16:02:49 -08:00
ioprio.c
Kconfig
ANDROID: modularize BLK_MQ_VIRTIO
2020-01-31 16:27:30 -08:00
Kconfig.iosched
keyslot-manager.c
ANDROID: block: backport the ability to specify max_dun_bytes
2020-05-15 22:01:33 +00:00
kyber-iosched.c
Makefile
BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series
2020-01-13 18:46:44 +00:00
mq-deadline.c
opal_proto.h
OWNERS
ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS
2021-04-01 13:45:14 +00:00
partition-generic.c
block: Remove partition support for zoned block devices
2020-01-07 16:02:46 -08:00
scsi_ioctl.c
sed-opal.c
t10-pi.c