summaryrefslogtreecommitdiff
path: root/drivers/s390/scsi/zfcp_def.h
diff options
context:
space:
mode:
authorJan Blunck <j.blunck@tu-harburg.de>2005-08-27 11:07:52 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-27 11:22:27 -0700
commit729d70f5dfd663b44bca68a4479c96bde7e535d6 (patch)
treef92ee98a709264984ef6e3e8d6c3ee4f3462797f /drivers/s390/scsi/zfcp_def.h
parent8126fdbc76351bdf99c6737ef4fecf88a22fa538 (diff)
downloadlinux-3.10-729d70f5dfd663b44bca68a4479c96bde7e535d6.tar.gz
linux-3.10-729d70f5dfd663b44bca68a4479c96bde7e535d6.tar.bz2
linux-3.10-729d70f5dfd663b44bca68a4479c96bde7e535d6.zip
[PATCH] sg.c: fix a memory leak in devices seq_file implementation
I know that scsi procfs is legacy code but this is a fix for a memory leak. While reading through sg.c I realized that the implementation of /proc/scsi/sg/devices with seq_file is leaking memory due to freeing the pointer returned by the next() iterator method. Since next() might return NULL or an error this is wrong. This patch fixes it through using the seq_files private field for holding the reference to the iterator object. Here is a small bash script to trigger the leak. Use slabtop to watch the size-32 usage grow and grow. #!/bin/sh while true; do cat /proc/scsi/sg/devices > /dev/null done Signed-off-by: Jan Blunck <j.blunck@tu-harburg.de> Acked-by: James Bottomley <James.Bottomley@steeleye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
0 files changed, 0 insertions, 0 deletions