mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Viacheslav Dubeyko <slava@dubeyko.com>,
	Hui Peng <benquike@gmail.com>,
	glaubitz@physik.fu-berlin.de, frank.li@vivo.com,
	brauner@kernel.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hfs: validate drAlBlkSiz and fs_ablocks in hfs_mdb_get()
Date: Tue, 22 Sep 2026 00:01:38 +0200	[thread overview]
Message-ID: <e8b51a7b-a2fc-459f-81d8-49d6b0235829@kernel.org> (raw)
In-Reply-To: <1164821496f54d2fe03af44283d48db707a5e391.camel@dubeyko.com>

On 21/09/2026 23:33, Viacheslav Dubeyko wrote:
> On Sat, 2026-09-19 at 22:26 +0000, Hui Peng wrote:
>> In hfs_mdb_get() (fs/hfs/mdb.c), reject images with allocation block
>> size (drAlBlkSiz) of 0 or not a multiple of HFS_SECTOR_SIZE (512), or
>> with fs_ablocks == 0, preventing a divide-by-zero trap and out-of-
>> bounds
>> bitmap scans on crafted HFS images.
>>
>> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
>> Assisted-by: LLM
>> Signed-off-by: Hui Peng <benquike@gmail.com>
>> ---
>> diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c
>> index 277de712f9d4..9e78c561a3f1 100644
>> --- a/fs/hfs/mdb.c
>> +++ b/fs/hfs/mdb.c
>> @@ -204,6 +204,11 @@ int hfs_mdb_get(struct super_block *sb)
>>  	/* These parameters are read from the MDB, and never written
>> */
>>  	HFS_SB(sb)->part_start = part_start;
>>  	HFS_SB(sb)->fs_ablocks = be16_to_cpu(mdb->drNmAlBlks);
>> +	if (!HFS_SB(sb)->fs_ablocks) {
> 
> This check doesn't look like checking that it's "not a multiple of
> HFS_SECTOR_SIZE (512)". Could you make your check more accurate?

In case you were not aware of: this patch is result of huge AI
semi-autonomous work, basically close to spam posting style. Whatever
you review you might be actually talking to an slop-agent, thus wasting
your time.

Best regards,
Krzysztof

      reply	other threads:[~2026-09-21 22:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 22:26 Hui Peng
2026-09-21 21:33 ` Viacheslav Dubeyko
2026-09-21 22:01   ` Krzysztof Kozlowski [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=e8b51a7b-a2fc-459f-81d8-49d6b0235829@kernel.org \
    --to=krzk@kernel.org \
    --cc=benquike@gmail.com \
    --cc=brauner@kernel.org \
    --cc=frank.li@vivo.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®