android_kernel_google_msm/block
Roland Dreier 0ef4c881e4 block: Don't access request after it might be freed
commit 893d290f1d upstream.

After we've done __elv_add_request() and __blk_run_queue() in
blk_execute_rq_nowait(), the request might finish and be freed
immediately.  Therefore checking if the type is REQ_TYPE_PM_RESUME
isn't safe afterwards, because if it isn't, rq might be gone.
Instead, check beforehand and stash the result in a temporary.

This fixes crashes in blk_execute_rq_nowait() I get occasionally when
running with lots of memory debugging options enabled -- I think this
race is usually harmless because the window for rq to be reallocated
is so small.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[xr: Backported to 3.4: adjust context]
Signed-off-by: Rui Xiang <rui.xiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-11 16:10:06 -07:00
..
partitions
blk-cgroup.c
blk-cgroup.h
blk-core.c blk-core: Fix memory corruption if blkcg_init_queue fails 2013-12-08 07:29:43 -08:00
blk-exec.c block: Don't access request after it might be freed 2014-03-11 16:10:06 -07:00
blk-flush.c
blk-integrity.c
blk-ioc.c
blk-iopoll.c
blk-lib.c block: add cond_resched() to potentially long running ioctl discard loop 2014-02-22 10:32:46 -08:00
blk-map.c
blk-merge.c
blk-settings.c block: properly stack underlying max_segment_size to DM device 2013-11-29 10:50:36 -08:00
blk-softirq.c
blk-sysfs.c block: avoid using uninitialized value in from queue_var_store 2013-04-12 09:38:46 -07:00
blk-tag.c
blk-throttle.c
blk-timeout.c block: fix race between request completion and timeout handling 2013-11-29 10:50:35 -08:00
blk.h
bsg-lib.c
bsg.c
cfq-iosched.c
cfq.h
compat_ioctl.c
deadline-iosched.c
elevator.c elevator: acquire q->sysfs_lock in elevator_change() 2013-12-08 07:29:43 -08:00
genhd.c block: do not pass disk names as format strings 2013-07-13 11:03:41 -07:00
ioctl.c
Kconfig
Kconfig.iosched
Makefile
noop-iosched.c
partition-generic.c block: fix ext_devt_idr handling 2013-03-04 06:06:40 +08:00
scsi_ioctl.c scsi: Silence unnecessary warnings about ioctl to partition 2012-12-03 11:47:11 -08:00