All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <david.laight.linux@gmail.com>
To: Mikulas Patocka <mpatocka@redhat.com>,
	Tony Asleson <tasleson@redhat.com>,
	"Bryn M . Reeves" <bmr@redhat.com>,
	Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Benjamin Marzinski <bmarzins@redhat.com>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Cc: David Laight <david.laight.linux@gmail.com>
Subject: [PATCH 0/3] dm: simplify list ioctls
Date: Wed, 24 Jun 2026 15:52:40 +0100	[thread overview]
Message-ID: <20260624145243.2736-1-david.laight.linux@gmail.com> (raw)

Scanning for poossibly unbounded strlen() found the device/disk
manager ioctls that do a double scan of the data to check whether
the caller supplied buffer is large enough, and then to fill it.

If the buffer is too small the required size isn't returned.

So simplify everything and make it all less likely to overrun
the kernel buffer (copied back to user later) if anything changes
between the scans.

I managed a minimal test that the ioctls still work.

David Laight (3):
  dm: __list_versions(): Only process targets once
  dm: list_devices(): Only process devices once
  dm: lookup_ioctl(): Use designated array initialers

 drivers/md/dm-ioctl.c | 207 +++++++++++++++++++-----------------------
 1 file changed, 92 insertions(+), 115 deletions(-)

-- 
2.39.5


             reply	other threads:[~2026-06-24 14:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24 14:52 David Laight [this message]
2026-06-24 14:52 ` [PATCH 1/3] dm: __list_versions(): Only process targets once David Laight
2026-06-24 14:52 ` [PATCH 2/3] dm: list_devices(): Only process devices once David Laight
2026-06-24 14:52 ` [PATCH 3/3] dm: lookup_ioctl(): Use designated array initialers David Laight

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=20260624145243.2736-1-david.laight.linux@gmail.com \
    --to=david.laight.linux@gmail.com \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=bmr@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=tasleson@redhat.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.