2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 20:23:57 +08:00
linux-next/drivers/staging/hv
Julia Lawall fe3e593601 drivers/staging/hv/blkvsc_drv.c: eliminate NULL pointer dereference
In this code, blkvsc_req is allocated in the cache blkdev->request_pool,
but freed in the first case to the cache blkvsc_req->dev->request_pool.
blkvsc_req->dev is subsequently initialized to blkdev, making these the
same at the second call to kmem_cache_free.  But at the point of the first
call, blkvsc_req->dev is NULL.  The second call is changed too, for
uniformity.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,e,e1,e2,e3;
@@

x = \(kmem_cache_alloc\|kmem_cache_zalloc\)(e1,e2)
... when != x = e
(
kmem_cache_free(e1,x);
|
?-kmem_cache_free(e3,x);
+kmem_cache_free(e1,x);
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: KY Srinivasan <kys@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-02 16:12:49 -07:00
..
tools treewide: remove duplicate includes 2011-06-20 16:08:19 +02:00
blkvsc_drv.c drivers/staging/hv/blkvsc_drv.c: eliminate NULL pointer dereference 2011-08-02 16:12:49 -07:00
channel_mgmt.c Staging: hv: vmbus: Increase the timeout value in the vmbus driver 2011-07-05 08:59:23 -07:00
channel.c Staging: hv: vmbus: Increase the timeout value in the vmbus driver 2011-07-05 08:59:23 -07:00
connection.c Staging: hv: vmbus: Increase the timeout value in the vmbus driver 2011-07-05 08:59:23 -07:00
hv_kvp.c Staging: hv: vmbus_drv: Move the contents of vmbus_private.h to vmbus_hyperv.h 2011-05-17 12:27:04 -07:00
hv_kvp.h Fix common misspellings 2011-03-31 11:26:23 -03:00
hv_mouse.c Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6 2011-07-25 23:26:34 -07:00
hv_timesource.c Remove unneeded version.h include from drivers/staging/hv/hv_timesource.c 2011-07-05 09:10:47 -07:00
hv_util.c Staging: hv: Re-implement the synchronization for util channels 2011-05-17 13:36:50 -07:00
hv.c Staging: hv: vmbus: Cleanup error codes in hv.c 2011-06-07 13:46:06 -07:00
hyperv_net.h staging: hv: remove netvsc send buffer and related functions 2011-06-07 13:39:23 -07:00
hyperv_storage.h Staging: hv: Move the contents of storvsc_api.h to hyperv_storage.h 2011-05-17 12:27:06 -07:00
hyperv_vmbus.h Staging: hv: vmbus: Get rid of an unused function in connection.c 2011-06-07 13:46:01 -07:00
hyperv.h Staging: hv: vmbus: Embed the state needed to close the channel 2011-06-07 13:45:59 -07:00
Kconfig Staging: hv: Add the necessary dependencies to hyperv Kconfig 2011-05-06 09:27:34 -07:00
Makefile Staging: hv: Move the contents of blkvsc.c to blkvsc_drv.c 2011-04-04 21:50:44 -07:00
netvsc_drv.c staging: hv: fix some white spaces in netvsc driver 2011-07-05 09:10:47 -07:00
netvsc.c staging: hv: fix some white spaces in netvsc driver 2011-07-05 09:10:47 -07:00
ring_buffer.c Staging: hv: vmbus: Change the memory barrier in hv_ringbuffer_write() 2011-06-07 13:45:56 -07:00
rndis_filter.c Staging: hv: netvsc: Increase the timeout value in the netvsc driver 2011-07-05 08:59:23 -07:00
storvsc_drv.c Staging: hv: storvsc: Increase the timeout value in the storvsc driver 2011-07-05 08:59:24 -07:00
storvsc.c Staging: hv: storvsc: Increase the timeout value in the storvsc driver 2011-07-05 08:59:24 -07:00
TODO staging: hv: Convert vmbus driver interface function pointer table to constant 2010-09-14 16:27:12 -07:00
vmbus_drv.c Staging: hv: vmbus: Properly handle the error in hv_acpi_init() 2011-07-05 08:59:24 -07:00