linux-stable/drivers
Julia Lawall 0643e4c6e4 drivers/char: Eliminate use after free
In each case, the first argument to send_control_msg or __send_control_msg,
respectively, has either not been successfully allocated or has been freed
at the point of the call.  In the first case, the first argument, port, is
only used to access the portdev and id fields, in order to call
__send_control_msg.  Thus it seems possible instead to call
__send_control_msg directly.  In the second case, the call to
__send_control_msg is moved up to a place where it seems like the first
argument, portdev, has been initialized sufficiently to make the call to
__send_control_msg meaningful.

This has only been compile tested.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@free@
expression E;
position p;
@@
kfree@p(E)

@@
expression free.E, subE<=free.E, E1;
position free.p;
@@

  kfree@p(E)
  ...
(
  subE = E1
|
* E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-05-19 22:15:51 +09:30
..
accessibility
acpi Merge branch 'x86-irq-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 09:15:57 -07:00
amba
ata pata_pcmcia / ide-cs: Fix bad hashes for Transcend and kingston IDs 2010-05-05 14:48:48 -04:00
atm
auxdisplay
base Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 07:22:37 -07:00
block virtio_blk: use virtqueue_xxx wrappers 2010-05-19 22:15:42 +09:30
bluetooth
cdrom
char drivers/char: Eliminate use after free 2010-05-19 22:15:51 +09:30
clocksource
connector
cpufreq Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 08:49:13 -07:00
cpuidle cpuidle: Fix incorrect optimization 2010-05-09 18:35:36 -07:00
crypto
dca
dio
dma Merge branch 'sh/for-2.6.34' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2010-05-06 08:37:39 -07:00
edac edac, mce: Fix wrong mask and macro usage 2010-04-30 10:15:39 -07:00
eisa
firewire
firmware
gpio it8761e_gpio: fix bug in gpio numbering 2010-05-11 17:33:41 -07:00
gpu drivers/gpu/drm/i915/i915_irq.c:i915_error_object_create(): use correct kmap-atomic slot 2010-05-11 17:33:42 -07:00
hid HID: fix suspend crash by moving initializations earlier 2010-05-07 23:33:52 +02:00
hwmon Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-05-11 17:38:04 -07:00
i2c i2c-core: Use per-adapter userspace device lists 2010-05-04 11:09:28 +02:00
ide pata_pcmcia / ide-cs: Fix bad hashes for Transcend and kingston IDs 2010-05-05 14:48:48 -04:00
idle
ieee1394
ieee802154
infiniband
input Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 08:17:35 -07:00
isdn
leds
lguest
macintosh
mca
md md: restore ability of spare drives to spin down. 2010-05-07 21:10:57 +10:00
media V4L/DVB: pxa_camera: move fifo reset direct before dma start 2010-05-06 19:20:52 -03:00
memstick
message
mfd mfd: Clean up after WM83xx AUXADC interrupt if it arrives late 2010-05-13 12:58:55 +02:00
misc Modify the VMware balloon driver for the new x86_hyper API 2010-05-09 01:13:42 -07:00
mmc mmc: at91_mci: modify cache flush routines 2010-05-15 12:48:10 -07:00
mtd [MTD] Remove zero-length files mtdbdi.c and internal.ho 2010-05-05 15:25:12 -04:00
net virtio_net: use virtqueue_xxx wrappers 2010-05-19 22:15:43 +09:30
nubus
of
oprofile oprofile: protect from not being in an IRQ context 2010-05-03 23:02:39 +02:00
parisc
parport
pci Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 07:22:37 -07:00
pcmcia Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6 2010-05-07 14:11:09 -07:00
platform
pnp Merge branches 'bugzilla-14337', 'bugzilla-14998', 'bugzilla-15407', 'bugzilla-15903' and 'misc-2.6.34' into release 2010-05-06 22:04:31 -04:00
power
pps
ps3
rapidio
regulator
rtc
s390 [S390] dasd: fix race between tasklet and dasd_sleep_on 2010-05-12 09:32:26 +02:00
sbus
scsi m68k: amiga - Zorro bus modalias support 2010-05-17 21:37:41 +02:00
serial serial: imx.c: fix CTS trigger level lower to avoid lost chars 2010-05-13 12:10:56 -07:00
sfi
sh
sn
spi
ssb
staging Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2010-04-30 13:04:14 -07:00
tc
telephony
thermal
uio
usb Fix the regression created by "set S_DEAD on unlink()..." commit 2010-05-15 07:16:33 -04:00
uwb
vhost vhost: fix barrier pairing 2010-05-12 18:04:04 +03:00
video m68k: amiga - Frame buffer platform device conversion 2010-05-17 21:37:43 +02:00
virtio virtio: add_buf_gfp 2010-05-19 22:15:46 +09:30
vlynq
w1
watchdog ARM: 6126/1: ARM mpcore_wdt: fix build failure and other fixes 2010-05-12 11:18:14 +01:00
xen stop_machine: reimplement using cpu_stop 2010-05-06 18:49:20 +02:00
zorro m68k: amiga - Zorro host bridge platform device conversion 2010-05-17 21:37:42 +02:00
Kconfig
Makefile virtio: initialize earlier 2010-05-07 14:01:17 -07:00