kernel-hacking-2024-linux-s.../drivers/s390/cio
Christian Borntraeger 05d419b11f [S390] Fix memory leak in /proc/cio_ignore
There is a memory leak in /proc/cio_ignore. The iterator is allocated
in cio_ignore_proc_seq_start, but never freed in
cio_ignore_proc_seq_stop, because we cannot use the iterator
that was passed by seqfile. The seqfile interface passes the last
seen iterator to the stop function and not the first one. Since our
next function will return NULL at the end, the iter passed to
cio_ignore_proc_seq_stop is NULL. The original iter has leaked.
The solution is to use seq_open_private.

Found with kmemleak:
unreferenced object 0x1c720580 (size 32):
  comm "head", pid 973, jiffies 4294958302
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 04 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:
    [<0000000000203154>] kmem_cache_alloc+0x190/0x19c
    [<00000000003fb462>] cio_ignore_proc_seq_start+0x5e/0x128
    [<0000000000231018>] seq_read+0xc8/0x4bc
    [<0000000000273954>] proc_reg_read+0xa8/0xf4
    [<000000000020e3d8>] vfs_read+0xac/0x1a4
    [<000000000020e5c6>] SyS_read+0x52/0xa8
    [<000000000011836e>] sysc_noemu+0x10/0x16
    [<0000004690b7936c>] 0x4690b7936c

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2009-10-06 10:35:07 +02:00
..
airq.c
blacklist.c [S390] Fix memory leak in /proc/cio_ignore 2009-10-06 10:35:07 +02:00
blacklist.h
ccwgroup.c
chp.c [S390] cio: channel path memory leak 2009-10-06 10:35:06 +02:00
chp.h
chsc.c
chsc.h [S390] cio: move scsw helper functions to header file 2009-09-11 10:29:36 +02:00
chsc_sch.c
chsc_sch.h
cio.c [S390] cio: remove subchannel init_name 2009-09-11 10:29:40 +02:00
cio.h [S390] cio: remove ccw_device init_name 2009-09-11 10:29:41 +02:00
cio_debug.h
cmf.c
crw.c
css.c [S390] cio: introduce consistent subchannel scanning 2009-09-22 22:58:42 +02:00
css.h [S390] cio: idset use actual number of ssids 2009-09-22 22:58:42 +02:00
device.c [S390] cio: introduce css_settle 2009-09-22 22:58:41 +02:00
device.h [S390] cio: merge init calls 2009-09-22 22:58:41 +02:00
device_fsm.c [S390] cio: failing set online/offline processing. 2009-09-11 10:29:38 +02:00
device_id.c
device_ops.c
device_pgid.c
device_status.c
fcx.c
idset.c [S390] cio: introduce consistent subchannel scanning 2009-09-22 22:58:42 +02:00
idset.h [S390] cio: introduce consistent subchannel scanning 2009-09-22 22:58:42 +02:00
io_sch.h
ioasm.h
isc.c
itcw.c
Makefile [S390] cio: move scsw helper functions to header file 2009-09-11 10:29:36 +02:00
qdio.h [S390] qdio: remove limited number of debugfs entries 2009-09-11 10:29:39 +02:00
qdio_debug.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
qdio_debug.h
qdio_main.c [S390] qdio: change state of all primed input buffers 2009-09-22 22:58:43 +02:00
qdio_perf.c const: constify remaining file_operations 2009-10-01 16:11:11 -07:00
qdio_perf.h
qdio_setup.c
qdio_thinint.c [S390] qdio: merge AI tasklet into interrupt handler 2009-06-22 12:08:20 +02:00