summaryrefslogtreecommitdiff
path: root/include/linux/dma_remapping.h
diff options
context:
space:
mode:
authorChen Zhongjin <chenzhongjin@huawei.com>2022-11-11 13:36:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-18 13:30:05 +0300
commitaa679eeae4a1dba98b657a41589b8d58c14a31cc (patch)
treeb5628d820eb0d82e9da9b48009e41441ae83366a /include/linux/dma_remapping.h
parente20127661c0c7a0c6073a2692874a695e89a11c5 (diff)
downloadlinux-aa679eeae4a1dba98b657a41589b8d58c14a31cc.tar.xz
perf: Fix possible memleak in pmu_dev_alloc()
[ Upstream commit e8d7a90c08ce963c592fb49845f2ccc606a2ac21 ] In pmu_dev_alloc(), when dev_set_name() failed, it will goto free_dev and call put_device(pmu->dev) to release it. However pmu->dev->release is assigned after this, which makes warning and memleak. Call dev_set_name() after pmu->dev->release = pmu_dev_release to fix it. Device '(null)' does not have a release() function... WARNING: CPU: 2 PID: 441 at drivers/base/core.c:2332 device_release+0x1b9/0x240 ... Call Trace: <TASK> kobject_put+0x17f/0x460 put_device+0x20/0x30 pmu_dev_alloc+0x152/0x400 perf_pmu_register+0x96b/0xee0 ... kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak) unreferenced object 0xffff888014759000 (size 2048): comm "modprobe", pid 441, jiffies 4294931444 (age 38.332s) backtrace: [<0000000005aed3b4>] kmalloc_trace+0x27/0x110 [<000000006b38f9b8>] pmu_dev_alloc+0x50/0x400 [<00000000735f17be>] perf_pmu_register+0x96b/0xee0 [<00000000e38477f1>] 0xffffffffc0ad8603 [<000000004e162216>] do_one_initcall+0xd0/0x4e0 ... Fixes: abe43400579d ("perf: Sysfs enumeration") Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20221111103653.91058-1-chenzhongjin@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/linux/dma_remapping.h')
0 files changed, 0 insertions, 0 deletions