Bug 9096 - [ANCK 5.10] md: kmemleak of rdev->serial
Summary: [ANCK 5.10] md: kmemleak of rdev->serial
Status: RESOLVED FIXED
Alias: None
Product: ANCK 5.10 Dev
Classification: ANCK
Component: drivers (show other bugs) drivers
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Joseph Qi
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-21 19:46 UTC by zeroc
Modified: 2024-06-05 16:58 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zeroc 2024-05-21 19:46:00 UTC
Description of problem:

If kobject_add() is fail in bind_rdev_to_array(), 'rdev->serial' will be
alloc not be freed, and kmemleak occurs.

Actual results:

unreferenced object 0xffff88815a350000 (size 49152):
  comm "mdadm", pid 789, jiffies 4294716910
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace (crc f773277a):
    [<0000000058b0a453>] kmemleak_alloc+0x61/0xe0
    [<00000000366adf14>] __kmalloc_large_node+0x15e/0x270
    [<000000002e82961b>] __kmalloc_node.cold+0x11/0x7f
    [<00000000f206d60a>] kvmalloc_node+0x74/0x150
    [<0000000034bf3363>] rdev_init_serial+0x67/0x170
    [<0000000010e08fe9>] mddev_create_serial_pool+0x62/0x220
    [<00000000c3837bf0>] bind_rdev_to_array+0x2af/0x630
    [<0000000073c28560>] md_add_new_disk+0x400/0x9f0
    [<00000000770e30ff>] md_ioctl+0x15bf/0x1c10
    [<000000006cfab718>] blkdev_ioctl+0x191/0x3f0
    [<0000000085086a11>] vfs_ioctl+0x22/0x60
    [<0000000018b656fe>] __x64_sys_ioctl+0xba/0xe0
    [<00000000e54e675e>] do_syscall_64+0x71/0x150
    [<000000008b0ad622>] entry_SYSCALL_64_after_hwframe+0x6c/0x74
Comment 1 小龙 admin 2024-05-21 19:47:19 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3240
Comment 2 小龙 admin 2024-05-21 20:05:30 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3242
Comment 3 小龙 admin 2024-05-21 21:08:45 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3244
Comment 4 小龙 admin 2024-05-28 19:36:03 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3283
Comment 5 小龙 admin 2024-05-28 20:28:11 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3284
Comment 6 小龙 admin 2024-06-04 19:08:14 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3317
Comment 7 小龙 admin 2024-06-05 10:01:09 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3318
Comment 8 Joseph Qi alibaba_cloud_group 2024-06-05 16:58:00 UTC
(In reply to 小龙 from comment #7)
> The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3318

merged