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]
Message-Id: <20211222100005.1212589-1-jiasheng@iscas.ac.cn>
Date:   Wed, 22 Dec 2021 18:00:05 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     balbi@...nel.org, gregkh@...uxfoundation.org
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] usb: gadget: udc: mv_udc_core: Check error dma address

Because the dma_map_single() might return error dma address if fails.
Therefore it might be better to check the address in order to avoid the
use of error dma address in build_dtd() which is called by req_to_dtd().

Fixes: 90fccb529d24 ("usb: gadget: Gadget directory cleanup - group UDC drivers")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/usb/gadget/udc/mv_udc_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
index 0fb4ef464321..2613dbdc5aba 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -1472,6 +1472,9 @@ udc_prime_status(struct mv_udc *udc, u8 direction, u16 status, bool empty)
 		req->req.dma = dma_map_single(ep->udc->gadget.dev.parent,
 				req->req.buf, req->req.length,
 				ep_dir(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+		retval = dma_mapping_error(ep->udc->gadget.dev.parent, req->req.dma);
+		if (retval)
+			goto out;
 		req->mapped = 1;
 	}
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ