android_kernel_motorola_sm6225/block
Ming Lei f198e0a1af BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool
refcount_inc_not_zero() in bt_tags_iter() still may read one freed
request.

Fix the issue by the following approach:

1) hold a per-tags spinlock when reading ->rqs[tag] and calling
refcount_inc_not_zero in bt_tags_iter()

2) clearing stale request referred via ->rqs[tag] before freeing
request pool, the per-tags spinlock is held for clearing stale
->rq[tag]

So after we cleared stale requests, bt_tags_iter() won't observe
freed request any more, also the clearing will wait for pending
request reference.

The idea of clearing ->rqs[] is borrowed from John Garry's previous
patch and one recent David's patch.

Tested-by: John Garry <john.garry@huawei.com>
Reviewed-by: David Jeffery <djeffery@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>

Bug: 197804811
Change-Id: If49478d7b05d3f5b0a26966ddf9ae764cf2fb6b0
(cherry picked from commit bd63141d585bef14f4caf111f6d0e27fe2300ec6)
[ refactored to avoid breaking KMI ]
Signed-off-by: Pradeep P V K <pragalla@codeaurora.org>
Signed-off-by: Todd Kjos <tkjos@google.com>
(cherry picked from commit bb96e7f45dc6ac1d6ec12190f1f286e3014fb068)
Signed-off-by: Lee Jones <joneslee@google.com>
2023-04-03 10:25:13 +00:00
..
partitions
badblocks.c
bfq-cgroup.c block, bfq: fix overwrite of bfq_group pointer in bfq_find_set_group() 2020-03-25 08:06:08 +01:00
bfq-iosched.c block, bfq: protect 'bfqd->queued' by 'bfqd->lock' 2022-11-10 17:46:54 +01:00
bfq-iosched.h block, bfq: fix use after free in bfq_bfqq_expire 2021-12-29 12:20:43 +01:00
bfq-wf2q.c block, bfq: fix use after free in bfq_bfqq_expire 2021-12-29 12:20:43 +01:00
bio-crypt-ctx.c ANDROID: dm: add dm-default-key target for metadata encryption 2020-01-24 10:49:09 -08:00
bio-integrity.c block: bio-integrity: Copy flags when bio_integrity_payload is cloned 2023-03-11 16:31:33 +01:00
bio.c This is the 4.19.246 stable release 2022-06-06 11:03:49 +02:00
blk-cgroup.c bdi: use bdi_dev_name() to get device name 2021-08-08 08:54:29 +02:00
blk-core.c This is the 4.19.272 stable release 2023-02-06 08:16:47 +01:00
blk-crypto-fallback.c ANDROID: block: require drivers to declare supported crypto key type(s) 2020-04-07 17:57:33 +00:00
blk-crypto-internal.h ANDROID: block: make blk_crypto_start_using_mode() properly check for support 2020-04-07 17:57:24 +00:00
blk-crypto.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-05-14 15:44:27 -07:00
blk-exec.c
blk-flush.c block: Fix fsync always failed if once failed 2022-03-08 19:04:08 +01:00
blk-integrity.c
blk-ioc.c block: Fix use-after-free issue accessing struct io_cq 2020-04-17 10:48:41 +02:00
blk-iolatency.c This is the 4.19.247 stable release 2022-06-14 17:16:36 +02:00
blk-lib.c block: fix 32 bit overflow in __blkdev_issue_discard() 2020-02-01 09:37:12 +00:00
blk-map.c block: fix memleak when __blk_rq_map_user_iov() is failed 2020-01-12 12:17:22 +01:00
blk-merge.c ANDROID: GKI: fix crc issue with commit 6281beee5b ("block: don't merge across cgroup boundaries if blkcg is enabled") 2022-04-19 16:15:29 +02:00
blk-mq-cpumap.c
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c block, scsi: Change the preempt-only flag into a counter 2019-08-04 09:30:57 +02:00
blk-mq-debugfs.h
blk-mq-pci.c
blk-mq-rdma.c
blk-mq-sched.c blk-mq: remove stale comment for blk_mq_sched_mark_restart_hctx 2023-03-11 16:31:33 +01:00
blk-mq-sched.h
blk-mq-sysfs.c This is the 4.19.270 stable release 2023-01-18 12:02:44 +00:00
blk-mq-tag.c BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2023-04-03 10:25:13 +00:00
blk-mq-tag.h BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2023-04-03 10:25:13 +00:00
blk-mq-virtio.c ANDROID: modularize BLK_MQ_VIRTIO 2020-01-31 16:11:59 -08:00
blk-mq.c BACKPORT: blk-mq: clear stale request in tags->rq[] before freeing one request pool 2023-04-03 10:25:13 +00:00
blk-mq.h blk-mq: free hw queue's resource in hctx's release handler 2019-09-16 08:22:13 +02:00
blk-rq-qos.c blk-wbt: fix performance regression in wbt scale_up/scale_down 2019-10-17 13:45:16 -07:00
blk-rq-qos.h blk-rq-qos: fix first node deletion of rq_qos_del() 2019-10-29 09:20:09 +01:00
blk-settings.c blk-settings: align max_sectors on "logical_block_size" boundary 2021-03-04 09:39:51 +01:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c This is the 4.19.238 stable release 2022-04-18 09:57:50 +02:00
blk-tag.c
blk-throttle.c blk-throttle: fix UAF by deleteing timer in blk_throtl_exit() 2021-09-26 13:39:49 +02:00
blk-timeout.c
blk-wbt.c blk-wbt: make sure throttle is enabled properly 2021-07-20 16:15:48 +02:00
blk-wbt.h blk-wbt: introduce a new disable state to prevent false positive by rwb_enabled() 2021-07-20 16:15:48 +02:00
blk-zoned.c blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN 2021-09-22 11:47:57 +02:00
blk.h Revert "block: split .sysfs_lock into two locks" 2021-03-05 07:01:53 +01:00
bounce.c BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series 2020-01-13 07:11:38 -08:00
bsg-lib.c
bsg.c
cfq-iosched.c ANDROID: block/cfq-iosched: make group_idle per io cgroup tunable 2019-05-08 21:48:28 +00:00
cmdline-parser.c
compat_ioctl.c block/compat_ioctl: fix range check in BLKGETSIZE 2022-04-27 13:39:45 +02:00
deadline-iosched.c
elevator.c This is the 4.19.231 stable release 2022-02-23 12:16:23 +01:00
genhd.c Merge 4.19.184 into android-4.19-stable 2021-04-07 11:44:22 +02:00
ioctl.c
ioprio.c block: fix ioprio_get(IOPRIO_WHO_PGRP) vs setuid(2) 2021-12-14 10:18:07 +01:00
Kconfig ANDROID: modularize BLK_MQ_VIRTIO 2020-01-31 16:11:59 -08:00
Kconfig.iosched
keyslot-manager.c ANDROID: block: backport the ability to specify max_dun_bytes 2020-05-14 15:44:27 -07:00
kyber-iosched.c
Makefile BACKPORT: FROMLIST: Update Inline Encryption from v5 to v6 of patch series 2020-01-13 07:11:38 -08:00
mq-deadline.c block: mq-deadline: Fix queue restart handling 2019-10-07 18:57:19 +02:00
noop-iosched.c
opal_proto.h
OWNERS ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS 2021-04-03 14:09:44 +00:00
partition-generic.c block: unhash blkdev part inode when the part is deleted 2023-01-18 11:29:59 +01:00
scsi_ioctl.c
sed-opal.c block: sed-opal: kmalloc the cmd/resp buffers 2022-11-25 17:40:23 +01:00
t10-pi.c