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: <1652891743-110930-1-git-send-email-lyz_cs@pku.edu.cn>
Date:   Wed, 18 May 2022 09:35:43 -0700
From:   Yongzhi Liu <lyz_cs@....edu.cn>
To:     pawell@...ence.com, gregkh@...uxfoundation.org, peter.chen@....com
Cc:     linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        fuyq@....pku.edu.cn, Yongzhi Liu <lyz_cs@....edu.cn>
Subject: [PATCH] usb: cdnsp:  Fix potential dereference of NULL pointer

The return value of cdnsp_get_transfer_ring()
needs to be checked to avoid use of NULL pointer
in case of an acquisition failure.

Fixes: 3d8290455 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")

Signed-off-by: Yongzhi Liu <lyz_cs@....edu.cn>
---
 drivers/usb/cdns3/cdnsp-ring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
index 1b14384..9f206b9 100644
--- a/drivers/usb/cdns3/cdnsp-ring.c
+++ b/drivers/usb/cdns3/cdnsp-ring.c
@@ -655,6 +655,8 @@ static int cdnsp_cmd_set_deq(struct cdnsp_device *pdev,
 	 * to reflect the new position.
 	 */
 	ep_ring = cdnsp_get_transfer_ring(pdev, pep, deq_state->stream_id);
+	if (!ep_ring)
+		return -EINVAL;
 
 	if (cdnsp_trb_is_link(ep_ring->dequeue)) {
 		ep_ring->deq_seg = ep_ring->deq_seg->next;
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ