From: Michael Schmitz <schmitzmic@gmail.com>
To: linux-block@vger.kernel.org, axboe@kernel.dk
Cc: linux-m68k@vger.kernel.org, geert@linux-m68k.org, hch@lst.de,
martin@lichtvoll.de, fthain@linux-m68k.org,
Michael Schmitz <schmitzmic@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH v10 2/3] block: change annotation of rdb_CylBlocks in affs_hardblocks.h
Date: Thu, 15 Jun 2023 15:08:36 +1200 [thread overview]
Message-ID: <20230615030837.8518-3-schmitzmic@gmail.com> (raw)
In-Reply-To: <20230615030837.8518-1-schmitzmic@gmail.com>
The Amiga partition parser module uses signed int for partition sector
address and count, which will overflow for disks larger than 1 TB.
Use u64 as type for sector address and size to allow using disks up to
2 TB without LBD support, and disks larger than 2 TB with LBD. The RBD
format allows to specify disk sizes up to 2^128 bytes (though native
OS limitations reduce this somewhat, to max 2^68 bytes), so check for
u64 overflow carefully to protect against overflowing sector_t.
This bug was reported originally in 2012, and the fix was created by
the RDB author, Joanne Dow <jdow@earthlink.net>. A patch had been
discussed and reviewed on linux-m68k at that time but never officially
submitted (now resubmitted as patch 1 of this series).
Patch 3 (this series) adds additional error checking and warning
messages. One of the error checks now makes use of the previously
unused rdb_CylBlocks field, which causes a 'sparse' warning
(cast to restricted __be32).
Annotate rdb_CylBlocks field as big endian to shut up the warning.
Add comment to document that the same annotation is going to be
needed for any other fields that may be used by the kernel in
future.
Reported-by: Martin Steigerwald <Martin@lichtvoll.de>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=43511
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Message-ID: <201206192146.09327.Martin@lichtvoll.de>
Cc: <stable@vger.kernel.org> # 5.2
Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
---
include/uapi/linux/affs_hardblocks.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/affs_hardblocks.h b/include/uapi/linux/affs_hardblocks.h
index 5e2fb8481252..9da5bc607939 100644
--- a/include/uapi/linux/affs_hardblocks.h
+++ b/include/uapi/linux/affs_hardblocks.h
@@ -6,6 +6,11 @@
/* Just the needed definitions for the RDB of an Amiga HD. */
+/* MSch 20230615: any field used by the Linux kernel must be
+ * annotated __be32! If any fields require increase to 64
+ * bit size, rdb_ID _must_ be changed!
+ */
+
struct RigidDiskBlock {
__u32 rdb_ID;
__be32 rdb_SummedLongs;
@@ -32,7 +37,7 @@ struct RigidDiskBlock {
__u32 rdb_RDBBlocksHi;
__u32 rdb_LoCylinder;
__u32 rdb_HiCylinder;
- __u32 rdb_CylBlocks;
+ __be32 rdb_CylBlocks;
__u32 rdb_AutoParkSeconds;
__u32 rdb_HighRDSKBlock;
__u32 rdb_Reserved4;
--
2.17.1
next prev parent reply other threads:[~2023-06-15 3:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230615030837.8518-1-schmitzmic@gmail.com>
2023-06-15 3:08 ` [PATCH v10 1/3] block: fix signed int overflow in Amiga partition support Michael Schmitz
2023-06-15 3:08 ` Michael Schmitz [this message]
2023-06-15 4:17 ` [PATCH v10 2/3] block: change annotation of rdb_CylBlocks in affs_hardblocks.h Christoph Hellwig
2023-06-15 4:50 ` Michael Schmitz
2023-06-15 5:53 ` Christoph Hellwig
2023-06-15 7:09 ` Michael Schmitz
2023-06-15 7:21 ` Geert Uytterhoeven
2023-06-15 19:53 ` Michael Schmitz
2023-06-16 5:48 ` Christoph Hellwig
2023-06-16 7:20 ` Michael Schmitz
2023-06-16 7:25 ` Christoph Hellwig
2023-06-16 7:51 ` Michael Schmitz
2023-06-16 7:28 ` Geert Uytterhoeven
2023-06-16 7:45 ` Michael Schmitz
2023-06-15 3:08 ` [PATCH v10 3/3] block: add overflow checks for Amiga partition support Michael Schmitz
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=20230615030837.8518-3-schmitzmic@gmail.com \
--to=schmitzmic@gmail.com \
--cc=axboe@kernel.dk \
--cc=fthain@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-m68k@vger.kernel.org \
--cc=martin@lichtvoll.de \
--cc=stable@vger.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