mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Devale, Sindhu" <sindhu.devale@intel.com>
To: Nikita Zhandarovich <n.zhandarovich@fintech.ru>,
	"Ismail, Mustafa" <mustafa.ismail@intel.com>
Cc: "Saleem, Shiraz" <shiraz.saleem@intel.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>
Subject: RE: [PATCH] RDMA/irdma: Fix potential NULL-ptr-dereference
Date: Fri, 27 Jan 2023 15:38:58 +0000	[thread overview]
Message-ID: <SA2PR11MB49535D7458DA7CADEAFEA24DF3CC9@SA2PR11MB4953.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230126185230.62464-1-n.zhandarovich@fintech.ru>



> -----Original Message-----
> From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
> Sent: Thursday, January 26, 2023 12:53 PM
> To: Ismail, Mustafa <mustafa.ismail@intel.com>
> Cc: Nikita Zhandarovich <n.zhandarovich@fintech.ru>; Saleem, Shiraz
> <shiraz.saleem@intel.com>; Jason Gunthorpe <jgg@ziepe.ca>; Leon
> Romanovsky <leon@kernel.org>; linux-rdma@vger.kernel.org; linux-
> kernel@vger.kernel.org; lvc-project@linuxtesting.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@fintech.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@intel.com>

  reply	other threads:[~2023-01-27 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 18:52 Nikita Zhandarovich
2023-01-27 15:38 ` Devale, Sindhu [this message]
2023-01-29 12:57 ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR11MB49535D7458DA7CADEAFEA24DF3CC9@SA2PR11MB4953.namprd11.prod.outlook.com \
    --to=sindhu.devale@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mustafa.ismail@intel.com \
    --cc=n.zhandarovich@fintech.ru \
    --cc=shiraz.saleem@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®