public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dan Carpenter <error27@gmail.com>
Cc: "Ismail, Mustafa" <mustafa.ismail@intel.com>,
	Leon Romanovsky <leon@kernel.org>,
	"Latif, Faisal" <faisal.latif@intel.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [bug report] iwpm: crash fix for large connections test
Date: Fri, 20 Jan 2023 12:13:38 +0100	[thread overview]
Message-ID: <Y8p3YgLZPXCMjRDq@kroah.com> (raw)
In-Reply-To: <Y4RkeS9mlTl9uBnO@kadam>

On Mon, Nov 28, 2022 at 10:34:17AM +0300, Dan Carpenter wrote:
> So the background here is that Smatch sees this:
> 
> 	kref_put(&nlmsg_request->kref, iwpm_free_nlmsg_request);
> 
> and correctly says "if we call iwpm_free_nlmsg_request() then
> dereferencing nlmsg_request is a use after free".  However, the code
> is holding two references at this point so it will never call
> iwpm_free_nlmsg_request().
> 
> Smatch already checks to see if we are holding two references, but it
> doesn't parse this code correctly.  Smatch could be fixed, but there are
> other places with similar warnings that are more difficult to fix.
> 
> What we could do is create a kref_no_release() function that just calls
> WARN().  This would silence the warning and, I think, this would make
> the code more readable.
> 
> What do other people think?

Sure, that looks semi-decent if it helps out with the automated tools.

thanks

greg k-h

      reply	other threads:[~2023-01-20 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 13:17 [bug report] iwpm: crash fix for large connections test Dan Carpenter
2022-11-17  9:24 ` Leon Romanovsky
2022-11-18 20:44   ` Ismail, Mustafa
2022-11-19  7:31     ` Dan Carpenter
2022-11-28  7:34     ` Dan Carpenter
2023-01-20 11:13       ` Greg Kroah-Hartman [this message]

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=Y8p3YgLZPXCMjRDq@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=error27@gmail.com \
    --cc=faisal.latif@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mustafa.ismail@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