Linux IIO development
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: "Jinseob Kim" <kimjinseob88@gmail.com>,
	"Joshua Crofts" <joshua.crofts1@gmail.com>,
	"Sanjay Chitroda" <sanjayembeddedse@gmail.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	sashiko-bot@kernel.org,
	"Jonathan Cameron" <jonathan.cameron@oss.qualcomm.com>
Subject: Re: [PATCH v2] iio: buffer: Ensure bounce buffer used for unaligned case is zeroed.
Date: Mon, 03 Aug 2026 10:05:45 +0100	[thread overview]
Message-ID: <9b8c1ec9126cc1f8625cc488cdeb03de7978eaf2.camel@gmail.com> (raw)
In-Reply-To: <20260803012224.219493-1-jic23@kernel.org>

On Mon, 2026-08-03 at 02:22 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> 
> iio_push_to_buffers_with_ts_unaligned() leaks uninitialized heap memory
> to userspace if the data passed in is not a multiple of 8 bytes and the
> timestamp is enabled. Specify __GFP_ZERO for the devm_krealloc()
> to ensure any extra space is cleared.
> 
> Fixes: 95ec3fdf2b79 ("iio: core: Introduce iio_push_to_buffers_with_ts_unaligned()")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/patchset/20260529121005.1470-1-kimjinseob88%40gmail.com
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

> 
> v1: https://patchwork.kernel.org/project/linux-iio/patch/20260604084307.640053-1-jic23@kernel.org/
> 
> Drop the memset in favour of __GFP_ZERO.  (Andy)
> Thanks to Nuno who pointed out there is a self test to ensure this
> behaves as expected.
> 
>  drivers/iio/industrialio-buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index 531fc4ccc15d..4960c8377932 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -2464,7 +2464,8 @@ int iio_push_to_buffers_with_ts_unaligned(struct iio_dev *indio_dev,
>  
>  		bb = devm_krealloc(&indio_dev->dev,
>  				   iio_dev_opaque->bounce_buffer,
> -				   indio_dev->scan_bytes, GFP_KERNEL);
> +				   indio_dev->scan_bytes,
> +				   GFP_KERNEL | __GFP_ZERO);
>  		if (!bb)
>  			return -ENOMEM;
>  		iio_dev_opaque->bounce_buffer = bb;

  reply	other threads:[~2026-08-03  9:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  1:22 [PATCH v2] iio: buffer: Ensure bounce buffer used for unaligned case is zeroed Jonathan Cameron
2026-08-03  9:05 ` Nuno Sá [this message]
2026-08-03  9:26 ` Joshua Crofts
  -- strict thread matches above, loose matches on Subject: below --
2026-06-04  8:43 Jonathan Cameron
2026-06-04  9:10 ` Andy Shevchenko
2026-06-05 13:50   ` Jonathan Cameron
2026-06-05 19:18     ` Andy Shevchenko
2026-06-08 20:00       ` Nuno Sá
2026-06-14 19:52         ` Jonathan Cameron

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=9b8c1ec9126cc1f8625cc488cdeb03de7978eaf2.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=kimjinseob88@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sanjayembeddedse@gmail.com \
    --cc=sashiko-bot@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox