All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Mike Rapoport <rppt@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] nvdimm: Prevent integer overflow in ramdax_get_config_data()
Date: Tue, 25 Nov 2025 21:59:29 +0300	[thread overview]
Message-ID: <aSX8kcQT3z-iD94M@stanley.mountain> (raw)
In-Reply-To: <6925db85a9343_63977100fd@iweiny-mobl.notmuch>

On Tue, Nov 25, 2025 at 10:38:29AM -0600, Ira Weiny wrote:
> Dan Carpenter wrote:
> > The "cmd->in_offset" variable comes from the user via the __nd_ioctl()
> > function.  The problem is that the "cmd->in_offset + cmd->in_length"
> > addition could have an integer wrapping issue if cmd->in_offset is close
> > to UINT_MAX .  The "cmd->in_length" variable has been capped, but the
> > "cmd->in_offset" variable has not.  Both of these variables are type u32.
> 
> Does ramdax_set_config_data() also need this?

Yes.  It does.  These are from Smatch warnings, right.  They take a few
rebuilds for the taint information to propagate from the ioctl to the
ramdax_get_config_data() function.  When I rebuilt it, then it propagates
to both so I would have seen the ramdax_set_config_data() tomorrow.

But they're called from the same function so the taint data should
have propagated to both at the same time...  WTF?  I don't know what
happened.  Anyway, I will fix that and resend.

Thanks for noticing.

>  I'm not quite following where in_length is capped so I'm inclined to
> add size_add in both set and get.

I meant that the  if (struct_size(cmd, in_buf, cmd->in_length) > buf_len)
line checks that cmd->in_length is okay.

regards,
dan carpenter


      reply	other threads:[~2025-11-25 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 13:54 [PATCH next] nvdimm: Prevent integer overflow in ramdax_get_config_data() Dan Carpenter
2025-11-25 16:38 ` Ira Weiny
2025-11-25 18:59   ` 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=aSX8kcQT3z-iD94M@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=rppt@kernel.org \
    --cc=vishal.l.verma@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 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.