All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Cc: stable@vger.kernel.org, Mustafa Ismail <mustafa.ismail@intel.com>,
	Shiraz Saleem <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: Re: [PATCH 5.4/5.10 1/1] RDMA/i40iw: Fix potential NULL-ptr-dereference
Date: Wed, 15 Mar 2023 09:00:03 +0100	[thread overview]
Message-ID: <ZBF7A87Ph+O2y7KY@kroah.com> (raw)
In-Reply-To: <20230314134456.3557-2-n.zhandarovich@fintech.ru>

On Tue, Mar 14, 2023 at 06:44:56AM -0700, Nikita Zhandarovich wrote:
> From: Nikita Zhandarovich <n.zhandarovich@fintech.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@fintech.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,

As this isn't anything that can be triggered by a normal system
operation, I'm going to drop it from the review queue.  Unless you have
a reproducer that can cause this to happen from userspace?

thanks,

greg k-h

  reply	other threads:[~2023-03-15  8:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 13:44 [PATCH 5.4/5.10 0/1] RDMA/i40iw: Fix potential NULL-ptr-dereference Nikita Zhandarovich
2023-03-14 13:44 ` [PATCH 5.4/5.10 1/1] " Nikita Zhandarovich
2023-03-15  8:00   ` Greg Kroah-Hartman [this message]
2023-03-15  9:55     ` Nikita Zhandarovich

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=ZBF7A87Ph+O2y7KY@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --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 \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.