Yang Yingliang
3a1cba8768
block: fix memleak when __blk_rq_map_user_iov() is failed
...
[ Upstream commit 3b7995a98ad76da5597b488fa84aa5a56d43b608 ]
When I doing fuzzy test, get the memleak report:
BUG: memory leak
unreferenced object 0xffff88837af80000 (size 4096):
comm "memleak", pid 3557, jiffies 4294817681 (age 112.499s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
20 00 00 00 10 01 00 00 00 00 00 00 01 00 00 00 ...............
backtrace:
[<000000001c894df8>] bio_alloc_bioset+0x393/0x590
[<000000008b139a3c>] bio_copy_user_iov+0x300/0xcd0
[<00000000a998bd8c>] blk_rq_map_user_iov+0x2f1/0x5f0
[<000000005ceb7f05>] blk_rq_map_user+0xf2/0x160
[<000000006454da92>] sg_common_write.isra.21+0x1094/0x1870
[<00000000064bb208>] sg_write.part.25+0x5d9/0x950
[<000000004fc670f6>] sg_write+0x5f/0x8c
[<00000000b0d05c7b>] __vfs_write+0x7c/0x100
[<000000008e177714>] vfs_write+0x1c3/0x500
[<0000000087d23f34>] ksys_write+0xf9/0x200
[<000000002c8dbc9d>] do_syscall_64+0x9f/0x4f0
[<00000000678d8e9a>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
If __blk_rq_map_user_iov() is failed in blk_rq_map_user_iov(),
the bio(s) which is allocated before this failing will leak. The
refcount of the bio(s) is init to 1 and increased to 2 by calling
bio_get(), but __blk_rq_unmap_user() only decrease it to 1, so
the bio cannot be freed. Fix it by calling blk_rq_unmap_user().
Reviewed-by: Bob Liu <bob.liu@oracle.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:43 +01:00
..
partitions
docs: admin-guide: add a series of orphaned documents
2019-07-15 11:03:02 -03:00
badblocks.c
bfq-cgroup.c
bfq: Add per-device weight
2019-09-06 14:33:52 -06:00
bfq-iosched.c
block, bfq: deschedule empty bfq_queues not referred by any process
2019-11-14 07:00:54 -07:00
bfq-iosched.h
bfq: Add per-device weight
2019-09-06 14:33:52 -06:00
bfq-wf2q.c
bfq: Fix the missing barrier in __bfq_entity_update_weight_prio
2019-09-06 14:33:48 -06:00
bio-integrity.c
block/bio-integrity: fix a memory leak bug
2019-07-11 20:01:21 -06:00
bio.c
block: add bio_truncate to fix guard_bio_eod
2020-01-09 10:19:54 +01:00
blk-cgroup.c
blkcg: make blkcg_print_stat() print stats only for online blkgs
2019-11-06 17:08:38 -07:00
blk-core.c
block: end bio with BLK_STS_AGAIN in case of non-mq devs and REQ_NOWAIT
2020-01-12 12:21:37 +01:00
blk-exec.c
blk-flush.c
block: Fix a lockdep complaint triggered by request queue flushing
2020-01-12 12:21:42 +01:00
blk-integrity.c
block: centralize PI remapping logic to the block layer
2019-09-17 20:03:49 -06:00
blk-ioc.c
blk-iocost.c
iocost: over-budget forced IOs should schedule async delay
2019-12-31 16:46:19 +01:00
blk-iolatency.c
blkcg: s/RQ_QOS_CGROUP/RQ_QOS_LATENCY/
2019-08-28 21:17:08 -06:00
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: Improve physical block alignment of split bios
2019-08-04 21:41:29 -06:00
blk-mq-cpumap.c
blk-mq: balance mapping between present CPUs and queues
2019-08-04 21:43:12 -06:00
blk-mq-debugfs-zoned.c
blk-mq-debugfs.c
for-5.3/block-20190708
2019-07-09 10:45:06 -07:00
blk-mq-debugfs.h
blk-mq: no need to check return value of debugfs_create functions
2019-06-13 03:00:30 -06:00
blk-mq-pci.c
block: Fix blk_mq_*_map_queues() kernel-doc headers
2019-05-31 15:12:34 -06:00
blk-mq-rdma.c
block: Fix blk_mq_*_map_queues() kernel-doc headers
2019-05-31 15:12:34 -06:00
blk-mq-sched.c
blk-mq: move lockdep_assert_held() into elevator_exit
2019-09-26 00:45:05 -06:00
blk-mq-sched.h
block: blk-mq: Remove blk_mq_sched_started_request and started_request
2019-07-23 07:25:09 -06:00
blk-mq-sysfs.c
blk-mq: make sure that line break can be printed
2019-12-17 19:56:53 +01:00
blk-mq-tag.c
blk-mq: introduce blk_mq_tagset_wait_completed_request()
2019-08-04 21:41:29 -06:00
blk-mq-tag.h
blk-mq-virtio.c
block: Fix blk_mq_*_map_queues() kernel-doc headers
2019-05-31 15:12:34 -06:00
blk-mq.c
blk-mq: apply normal plugging for HDD
2019-09-27 11:40:21 -06:00
blk-mq.h
block: Disable write plugging for zoned block devices
2019-07-10 14:18:01 -06:00
blk-pm.c
block: bypass blk_set_runtime_active for uninitialized q->dev
2019-09-12 07:11:56 -06:00
blk-pm.h
blk-rq-qos.c
blk-wbt: fix performance regression in wbt scale_up/scale_down
2019-10-06 09:26:41 -06:00
blk-rq-qos.h
blk-rq-qos: fix first node deletion of rq_qos_del()
2019-10-15 10:13:13 -06:00
blk-settings.c
dma-mapping updates for 5.4:
2019-09-19 13:27:23 -07:00
blk-softirq.c
blk-stat.c
blk-stat.h
blk-sysfs.c
rq-qos: get rid of redundant wbt_update_limits()
2019-09-27 01:13:10 -06:00
blk-throttle.c
block: make rq sector size accessible for block stats
2019-09-15 16:02:08 -06:00
blk-timeout.c
blk-wbt.c
blk-wbt: fix performance regression in wbt scale_up/scale_down
2019-10-06 09:26:41 -06:00
blk-wbt.h
block/rq_qos: implement rq_qos_ops->queue_depth_changed()
2019-08-28 21:17:07 -06:00
blk-zoned.c
blk-zoned: implement REQ_OP_ZONE_RESET_ALL
2019-08-04 21:41:29 -06:00
blk.h
block: Fix a lockdep complaint triggered by request queue flushing
2020-01-12 12:21:42 +01:00
bounce.c
bsg-lib.c
block: drop device references in bsg_queue_rq()
2019-09-23 11:17:24 -06: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
block: Fix elv_support_iosched()
2019-10-14 13:54:09 -06:00
genhd.c
block: Delay default elevator initialization
2019-09-05 19:52:34 -06:00
ioctl.c
ioprio.c
docs: block: convert to ReST
2019-07-15 09:20:27 -03:00
Kconfig
blkcg: implement blk-iocost
2019-08-28 21:17:12 -06:00
Kconfig.iosched
docs: block: convert to ReST
2019-07-15 09:20:27 -03:00
kyber-iosched.c
blk-mq: remove blk_mq_put_ctx()
2019-07-02 21:03:27 -06:00
Makefile
blkcg: implement blk-iocost
2019-08-28 21:17:12 -06:00
mq-deadline.c
block: Introduce elevator features
2019-09-05 19:52:33 -06:00
opal_proto.h
block: sed-opal: Removed duplicate OPAL_METHOD_LENGTH definition
2019-08-20 09:34:49 -06:00
partition-generic.c
scsi_ioctl.c
sed-opal.c
block: sed-opal: fix sparse warning: convert __be64 data
2019-10-03 14:21:32 -06:00
t10-pi.c
block: t10-pi: fix -Wswitch warning
2019-09-23 08:05:19 -06:00