[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA2PR11MB49535D7458DA7CADEAFEA24DF3CC9@SA2PR11MB4953.namprd11.prod.outlook.com>
Date: Fri, 27 Jan 2023 15:38:58 +0000
From: "Devale, Sindhu" <sindhu.devale@...el.com>
To: Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
"Ismail, Mustafa" <mustafa.ismail@...el.com>
CC: "Saleem, Shiraz" <shiraz.saleem@...el.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Leon Romanovsky <leon@...nel.org>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>
Subject: RE: [PATCH] RDMA/irdma: Fix potential NULL-ptr-dereference
> -----Original Message-----
> From: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
> Sent: Thursday, January 26, 2023 12:53 PM
> To: Ismail, Mustafa <mustafa.ismail@...el.com>
> Cc: Nikita Zhandarovich <n.zhandarovich@...tech.ru>; Saleem, Shiraz
> <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] RDMA/irdma: Fix potential NULL-ptr-dereference
>
> 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.
>
> Fixes: 146b9756f14c ("RDMA/irdma: Add connection manager")
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
>
> drivers/infiniband/hw/irdma/cm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/infiniband/hw/irdma/cm.c
> b/drivers/infiniband/hw/irdma/cm.c
> index 7b086fe63a24..195aa9ea18b6 100644
> --- a/drivers/infiniband/hw/irdma/cm.c
> +++ b/drivers/infiniband/hw/irdma/cm.c
> @@ -1722,6 +1722,9 @@ static int irdma_add_mqh_4(struct irdma_device
> *iwdev,
> continue;
>
> idev = in_dev_get(ip_dev);
> + if (!idev)
> + continue;
> +
> in_dev_for_each_ifa_rtnl(ifa, idev) {
> ibdev_dbg(&iwdev->ibdev,
> "CM: Allocating child CM Listener
> forIP=%pI4, vlan_id=%d, MAC=%pM\n",
Change looks good. Thanks!
Reviewed-by: Sindhu Devale <sindhu.devale@...el.com>
Powered by blists - more mailing lists