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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221215123112.20553-1-jiasheng@iscas.ac.cn>
Date:   Thu, 15 Dec 2022 20:31:12 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     gregkh@...uxfoundation.org
Cc:     neal_liu@...eedtech.com, joel@....id.au, andrew@...id.au,
        sumit.semwal@...aro.org, christian.koenig@....com,
        linux-aspeed@...ts.ozlabs.org, linux-usb@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-media@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        linaro-mm-sig@...ts.linaro.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH v3] usb: gadget: aspeed_udc: Add check for dma_alloc_coherent

Add the check for the return value of dma_alloc_coherent in order to
avoid NULL pointer dereference.

This flaw was found using an experimental static analysis tool we are
developing, APP-Miner, which has not been disclosed.

The allyesconfig build using GCC 9.3.0 shows no new warning. As we
don't have a UDC device to test with, no runtime testing was able to
be performed.

Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
Changelog:

v2 -> v3:

1. Add information of finding tool and tests to commit message.

v1 -> v2:

1. Add "goto err;" when allocation fails.
---
 drivers/usb/gadget/udc/aspeed_udc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 01968e2167f9..7dc2457c7460 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -1516,6 +1516,10 @@ static int ast_udc_probe(struct platform_device *pdev)
 					  AST_UDC_EP_DMA_SIZE *
 					  AST_UDC_NUM_ENDPOINTS,
 					  &udc->ep0_buf_dma, GFP_KERNEL);
+	if (!udc->ep0_buf) {
+		rc = -ENOMEM;
+		goto err;
+	}
 
 	udc->gadget.speed = USB_SPEED_UNKNOWN;
 	udc->gadget.max_speed = USB_SPEED_HIGH;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ