From: Xi Wang Date: Wed, 6 Mar 2013 21:32:25 +0000 (-0500) Subject: Staging: bcm: avoid use-after-free in bcm_char_ioctl() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=075dd9b83da5bc54b53b23f6e315c19b54f2d800;p=linux-beck.git Staging: bcm: avoid use-after-free in bcm_char_ioctl() Free pBulkBuffer (pvBuffer) after pBulkBuffer->Register. Signed-off-by: Xi Wang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c index 491e2bfbc464..35641e529396 100644 --- a/drivers/staging/bcm/Bcmchar.c +++ b/drivers/staging/bcm/Bcmchar.c @@ -1148,8 +1148,8 @@ cntrlEnd: if (((ULONG)pBulkBuffer->Register & 0x0F000000) != 0x0F000000 || ((ULONG)pBulkBuffer->Register & 0x3)) { - kfree(pvBuffer); BCM_DEBUG_PRINT (Adapter, DBG_TYPE_PRINTK, 0, 0, "WRM Done On invalid Address : %x Access Denied.\n", (int)pBulkBuffer->Register); + kfree(pvBuffer); Status = -EINVAL; break; }