linux/drivers
Jan Blunck 729d70f5df [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>
2005-08-27 11:22:27 -07:00
..
acorn [PATCH] ARM: switch fd1772.c from sleep_on to wait_event 2005-08-07 14:23:42 +01:00
acpi [PATCH] acpi_shutdown: Only prepare for power off on power_off 2005-08-27 10:11:40 -07:00
atm [ATM]: zatm: mailbox converted to pci_alloc_consistent() 2005-07-20 12:01:46 -07:00
base [PATCH] Fix manual binding infinite loop 2005-08-17 22:02:25 -07:00
block [PATCH] cfq-iosched.c: minor fixes 2005-08-24 10:22:44 -07:00
bluetooth [Bluetooth] Remove unused functions and cleanup symbol exports 2005-08-06 12:36:51 +02:00
cdrom [PATCH] Update CREDITS entry and listings in source files for Jesper Juhl 2005-07-27 16:26:20 -07:00
char [PATCH] Kconfig fix (sparc32 drivers/char dependencies) 2005-08-23 18:43:43 -07:00
cpufreq Here are two possible cleanups in cpufreq.c: 2005-07-28 09:43:56 -07:00
crypto [CRYPTO] Update IV correctly for Padlock CBC encryption 2005-07-06 13:54:09 -07:00
dio [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
eisa [PATCH] Driver Core: drivers/base - drivers/i2c/chips/adm1026.c: update device attribute callbacks 2005-06-20 15:15:32 -07:00
fc4 [SCSI] fc4 warning fix 2005-07-30 09:47:53 -05:00
firmware [PATCH] PCDP: if PCDP contains parity information, use it 2005-07-28 08:39:02 -07:00
hwmon [PATCH] I2C hwmon: kfree fixes 2005-08-26 19:37:12 -07:00
i2c [PATCH] Build fix for the Sibyte I2C driver 2005-08-09 12:08:21 -07:00
ide [PATCH] serverworks: add support for new southbridge IDE 2005-08-18 22:30:35 +02:00
ieee1394 [PATCH] late spinlock initialization in ieee1394/ohci 2005-08-26 16:30:30 -07:00
infiniband [PATCH] IB: fix use-after-free in user verbs cleanup 2005-08-26 19:37:12 -07:00
input [PATCH] ns558 list handling fix 2005-08-10 11:03:02 -07:00
isdn [PATCH] Fix capifs bug in initialization error path. 2005-08-27 10:11:40 -07:00
macintosh [PATCH] Kconfig fix (PMAC_BACKLIGHT on ppc64) 2005-08-23 18:43:40 -07:00
mca [PATCH] unexport mca_find_device_by_slot 2005-06-25 16:24:56 -07:00
md [PATCH] md: clear the 'recovery' flags when starting an md array. 2005-08-26 19:37:13 -07:00
media [PATCH] fix for race problem in DVB USB drivers (dibusb) 2005-08-27 11:03:45 -07:00
message [PATCH] I2O: added pci_request_regions() before using the controller 2005-08-09 17:59:52 -07:00
misc [PATCH] IBM_ASM Kconfig corrections 2005-07-12 16:01:02 -07:00
mmc [PATCH] wbsd version bump 2005-08-10 11:08:56 -07:00
mtd [PATCH] turn many #if $undefined_string into #ifdef $undefined_string 2005-07-27 16:26:08 -07:00
net Merge HEAD from master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6.git 2005-08-26 16:32:31 -07:00
nubus Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
oprofile [PATCH] clean up inline static vs static inline 2005-07-27 16:26:20 -07:00
parisc [PATCH] acpi bridge hotadd: ACPI based root bridge hot-add 2005-06-27 21:52:39 -07:00
parport [PATCH] Kconfig fix (parport_pc on m32r) 2005-08-23 18:43:41 -07:00
pci Ignore disabled ROM resources at setup 2005-08-26 10:49:22 -07:00
pcmcia [PATCH] missing include in pcmcia_resource.c 2005-08-23 18:43:43 -07:00
pnp [PATCH] broken error path in drivers/pnp/card.c 2005-08-18 08:43:59 -07:00
s390 [PATCH] bogus function type in qdio 2005-08-26 16:30:30 -07:00
sbus [SPARC]: envctrl: ERR_PTR() --> PTR_ERR() 2005-08-09 14:43:14 -07:00
scsi [PATCH] sg.c: fix a memory leak in devices seq_file implementation 2005-08-27 11:22:27 -07:00
serial [PATCH] m32r_sio gcc4 fixes 2005-08-23 18:43:44 -07:00
sh [PATCH] Driver Core: drivers/s390/net/qeth_sys.c - drivers/usb/gadget/pxa2xx_udc.c: update device attribute callbacks 2005-06-20 15:15:35 -07:00
sn [PATCH] ioc4: PCI bus speed detection 2005-06-21 18:46:32 -07:00
tc Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
telephony [PATCH] pcmcia: remove references to pcmcia/version.h 2005-07-07 18:24:07 -07:00
usb [PATCH] usbnet oops fix 2005-08-23 19:59:38 -07:00
video [PATCH] Kconfig fix (VGA console on arm/versatile) 2005-08-23 18:43:42 -07:00
w1 [PATCH] w1: more debug level decrease. 2005-08-12 12:55:02 -07:00
zorro [PATCH] Driver Core: drivers/usb/input/aiptek.c - drivers/zorro/zorro-sysfs.c: update device attribute callbacks 2005-06-20 15:15:35 -07:00
Kconfig Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6 2005-07-12 15:54:36 -07:00
Makefile [PATCH] I2C: Move hwmon drivers (1/3) 2005-07-11 14:14:31 -07:00