[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230530203116.2008-4-demi@invisiblethingslab.com>
Date: Tue, 30 May 2023 16:31:03 -0400
From: Demi Marie Obenour <demi@...isiblethingslab.com>
To: Jens Axboe <axboe@...nel.dk>,
Roger Pau Monné <roger.pau@...rix.com>,
Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...nel.org>, dm-devel@...hat.com
Cc: Demi Marie Obenour <demi@...isiblethingslab.com>,
Marek Marczykowski-Górecki
<marmarek@...isiblethingslab.com>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org,
stable@...r.kernel.org
Subject: [PATCH v2 03/16] device-mapper: do not allow targets to overlap 'struct dm_ioctl'
This prevents dm_split_args() from corrupting this struct.
Signed-off-by: Demi Marie Obenour <demi@...isiblethingslab.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@...r.kernel.org
---
drivers/md/dm-ioctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 64e8f16d344c47057de5e2d29e3d63202197dca0..a1d5fe64e1d0d9d3dcb06924249b89fe661944ab 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1444,6 +1444,12 @@ static int populate_table(struct dm_table *table,
return -EINVAL;
}
+ if (next < sizeof(struct dm_ioctl)) {
+ DMERR("%s: first target spec (offset %u) overlaps 'struct dm_ioctl'",
+ __func__, next);
+ return -EINVAL;
+ }
+
for (i = 0; i < param->target_count; i++) {
r = next_target(spec, next, end, &spec, &target_params);
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab
Powered by blists - more mailing lists