Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Yishai Hadas <yishaih@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [bug report] RDMA/core: Introduce a DMAH object and its alloc/free APIs
Date: Mon, 25 May 2026 09:52:57 +0300	[thread overview]
Message-ID: <ahPxybgr-27yeRNY@stanley.mountain> (raw)
In-Reply-To: <e2a4adb3-4f09-4e23-bddd-e18e158342b9@nvidia.com>

On Sun, May 24, 2026 at 10:22:55AM +0300, Yishai Hadas wrote:
> On 21/05/2026 11:04, Dan Carpenter wrote:
> > Hello Yishai Hadas,
> > 
> > Commit d83edab562a4 ("RDMA/core: Introduce a DMAH object and its
> > alloc/free APIs") from Jul 17, 2025 (linux-next), leads to the
> > following Smatch static checker warning:
> > 
> > 	drivers/infiniband/core/uverbs_std_types_dmah.c:50 ib_uverbs_handler_UVERBS_METHOD_DMAH_ALLOC()
> > 	error: passing untrusted data 'dmah->cpu_id' to 'cpumask_test_cpu()'
> > 
> > drivers/infiniband/core/uverbs_std_types_dmah.c
> >      40         dmah = rdma_zalloc_drv_obj(ib_dev, ib_dmah);
> >      41         if (!dmah)
> >      42                 return -ENOMEM;
> >      43
> >      44         if (uverbs_attr_is_valid(attrs, UVERBS_ATTR_ALLOC_DMAH_CPU_ID)) {
> >      45                 ret = uverbs_copy_from(&dmah->cpu_id, attrs,
> >                                                ^^^^^^^^^^^^^
> > cpu_id is untrusted data.
> > 
> >      46                                        UVERBS_ATTR_ALLOC_DMAH_CPU_ID);
> >      47                 if (ret)
> >      48                         goto err;
> >      49
> > --> 50                 if (!cpumask_test_cpu(dmah->cpu_id, current->cpus_ptr)) {
> >                                               ^^^^^^^^^^^^
> > You can't pass untrusted data to cpumask_test_cpu() or it results in
> > possibly a WARN_ON() (most people have reboot on WARN enabled) and
> > and out of bounds access.
> 
> Thanks Dan for your report.
> 
> It seems that the below [1] chunk should solve the issue.
> 
> Would you like please to send a fixup patch having it ?
> 

If you could take care of it that would be great, thanks.  I'm
trying to scale my process to compete with Sashiko.  :P

regards,
dan carpenter


      reply	other threads:[~2026-05-25  6:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  8:04 [bug report] RDMA/core: Introduce a DMAH object and its alloc/free APIs Dan Carpenter
2026-05-24  7:22 ` Yishai Hadas
2026-05-25  6:52   ` Dan Carpenter [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=ahPxybgr-27yeRNY@stanley.mountain \
    --to=error27@gmail.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yishaih@nvidia.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