lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed,  8 Aug 2012 12:42:45 +0400
From:	Vladimir Gratinskiy <gratinskiy@...ras.ru>
To:	"Chao Xie" <chao.xie@...vell.com>
Cc:	Vladimir Gratinskiy <gratinskiy@...ras.ru>,
	"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	ldv-project@...ras.ru
Subject: [PATCH 2/2] usb_gadget: Use GFP_ATOMIC in dma_pool_alloc().

Calling memory allocation function from the context of interrupt:
request_irq(udc->irq, mv_udc_irq, IRQF_SHARED, driver_name, udc);
Function
mv_udc_irq(..) calls:
irq_process_tr_complete(..) that calls:
handle_setup_packet(..) that calls:
ch9setaddress(..) that calls:
udc_prime_status(..) that calls:
req_to_dtd(..) that calls:
build_dtd(..) that calls:
dma_pool_alloc(udc->dtd_pool, GFP_KERNEL, dma).
In the case of GFP_KERNEL flag, function execution can be preempted,
because a greater number of operations to find and allocate memory
blocks is executed.

The patch change GFP_KERNEL flag to GFP_ATOMIC.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Vladimir Gratinskiy <gratinskiy@...ras.ru>
---
 drivers/usb/gadget/mv_udc_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 75db2c3..ba91f7c 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -375,7 +375,7 @@ static struct mv_dtd *build_dtd(struct mv_req *req, unsigned *length,
 	 * Be careful that no _GFP_HIGHMEM is set,
 	 * or we can not use dma_to_virt
 	 */
-	dtd = dma_pool_alloc(udc->dtd_pool, GFP_KERNEL, dma);
+	dtd = dma_pool_alloc(udc->dtd_pool, GFP_ATOMIC, dma);
 	if (dtd == NULL)
 		return dtd;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists