Re: [Bug #14258] Memory leak in SCSI initialization

Tetsuo Handa
2009-10-15T02:30:20Z

I got below messages in 2.6.32-rc4 .

# dmesg | grep kmemleak
[ 7.612391] kmemleak: Kernel memory leak detector initialized
[ 7.615675] kmemleak: Automatic memory scanning thread started
[ 78.641096] kmemleak: 13 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xdac2c478 (size 32):
comm "swapper", pid 1, jiffies 4294894406
hex dump (first 32 bytes):
30 3a 30 3a 32 3a 30 00 5a 5a 5a 5a 5a 5a 5a 5a 0:0:2:0.ZZZZZZZZ
5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a a5 ZZZZZZZZZZZZZZZ.
backtrace:
[<c10d3944>] create_object+0xe4/0x220
[<c1322663>] kmemleak_alloc+0x83/0xd0
[<c10d01d4>] __kmalloc+0x1b4/0x220
[<c11ab450>] kvasprintf+0x30/0x60
[<c11a3131>] kobject_set_name_vargs+0x21/0x60
[<c11f8cd9>] dev_set_name+0x19/0x20
[<c122c2b3>] scsi_sysfs_device_initialize+0xc3/0x120
[<c1228ac4>] scsi_alloc_sdev+0x194/0x230
[<c1229b50>] scsi_probe_and_add_lun+0x320/0x340
[<c122a477>] __scsi_scan_target+0xb7/0x100
[<c122a5f6>] scsi_scan_channel+0x86/0xa0
[<c122a6f9>] scsi_scan_host_selected+0xe9/0x150
[<c122aabc>] do_scsi_scan_host+0x7c/0x80
[<c122ab6d>] scsi_scan_host+0x8d/0x90
[<c1520c75>] BusLogic_init+0x355/0x420
[<c100105c>] do_one_initcall+0x2c/0x1d0
(...snipped...)
unreferenced object 0xdac2cc58 (size 32):
comm "swapper", pid 1, jiffies 4294894414
hex dump (first 32 bytes):
30 3a 30 3a 31 35 3a 30 00 5a 5a 5a 5a 5a 5a 5a 0:0:15:0.ZZZZZZZ
5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a 5a a5 ZZZZZZZZZZZZZZZ.
backtrace:
[<c10d3944>] create_object+0xe4/0x220
[<c1322663>] kmemleak_alloc+0x83/0xd0
[<c10d01d4>] __kmalloc+0x1b4/0x220
[<c11ab450>] kvasprintf+0x30/0x60
[<c11a3131>] kobject_set_name_vargs+0x21/0x60
[<c11f8cd9>] dev_set_name+0x19/0x20
[<c122c2b3>] scsi_sysfs_device_initialize+0xc3/0x120
[<c1228ac4>] scsi_alloc_sdev+0x194/0x230
[<c1229b50>] scsi_probe_and_add_lun+0x320/0x340
[<c122a477>] __scsi_scan_target+0xb7/0x100
[<c122a5f6>] scsi_scan_channel+0x86/0xa0
[<c122a6f9>] scsi_scan_host_selected+0xe9/0x150
[<c122aabc>] do_scsi_scan_host+0x7c/0x80
[<c122ab6d>] scsi_scan_host+0x8d/0x90
[<c1520c75>] BusLogic_init+0x355/0x420
[<c100105c>] do_one_initcall+0x2c/0x1d0

In my environment, 0:0:0:0 and 0:0:1:0 are used by SCSI hard disks, 0:0:7:0 is
reserved. 0:0:X:0 (where X = 2-6, 8-15) are unused and reported as memory leak.

After applying http://patchwork.kernel.org/patch/51412/ , above messages
no longer appears. Please apply that patch to 2.6.32-rcX as well as 2.6.31.Y .

Regards.