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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230314134456.3557-2-n.zhandarovich@fintech.ru>
Date:   Tue, 14 Mar 2023 06:44:56 -0700
From:   Nikita Zhandarovich <n.zhandarovich@...tech.ru>
To:     <stable@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
        Mustafa Ismail <mustafa.ismail@...el.com>,
        Shiraz Saleem <shiraz.saleem@...el.com>,
        "Jason Gunthorpe" <jgg@...pe.ca>,
        Leon Romanovsky <leon@...nel.org>,
        <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <lvc-project@...uxtesting.org>
Subject: [PATCH 5.4/5.10 1/1] RDMA/i40iw: Fix potential NULL-ptr-dereference

From: Nikita Zhandarovich <n.zhandarovich@...tech.ru>

commit 5d9745cead1f121974322b94ceadfb4d1e67960e upstream.

in_dev_get() can return NULL which will cause a failure once idev is
dereferenced in in_dev_for_each_ifa_rtnl(). This patch adds a
check for NULL value in idev beforehand.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Changes made to the original patch during backporting:
Apply patch to drivers/infiniband/hw/i40iw/i40iw_cm.c instead of
drivers/infiniband/hw/irdma/cm.c due to the fact that kernel versions
5.10 and below use i40iw driver, not irdma.

Fixes: f27b4746f378 ("i40iw: add connection management code")
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
Link: https://lore.kernel.org/r/20230126185230.62464-1-n.zhandarovich@fintech.ru
---
 drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
index 3053c345a5a3..e1236ac502f2 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
@@ -1776,6 +1776,8 @@ static enum i40iw_status_code i40iw_add_mqh_4(
 			const struct in_ifaddr *ifa;
 
 			idev = in_dev_get(dev);
+			if (!idev)
+				continue;
 
 			in_dev_for_each_ifa_rtnl(ifa, idev) {
 				i40iw_debug(&iwdev->sc_dev,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ