mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/2] firewire: core: validate descriptor and sub-block lengths in fw_core_add_descriptor()
Date: Mon, 27 Jul 2026 09:47:02 +0900	[thread overview]
Message-ID: <20260727004702.GA237697@sakamocchi.jp> (raw)
In-Reply-To: <20260725155255.3054-1-sreekuttan2156239@gmail.com>

Hi,

On Sat, Jul 25, 2026 at 03:52:53PM +0000, Sreeraj S Kurup wrote:
> This two-patch series addresses potential out-of-bounds memory
> accesses when parsing Config ROM descriptors in
> fw_core_add_descriptor().
> 
> Patch 1 adds overall length validation using the in_range() macro
> to ensure descriptors fit within standard IEEE 1394 Config ROM
> limits (256 quadlets).
> 
> Patch 2 validates individual sub-block header lengths during
> iteration to prevent reading past allocated buffer boundaries on
> malformed inputs.
> 
> v2 -> v3:
>  - Split original single patch into two distinct commits for cleaner
>    review as requested by Takashi Sakamoto.
>  - Simplified overall length check using the in_range() macro.
> 
> Sreeraj S Kurup (2):
>   firewire: core: validate overall descriptor length in
>     fw_core_add_descriptor()
>   firewire: core: validate sub-block lengths in fw_core_add_descriptor()
> 
>  drivers/firewire/core-card.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)

Applied to for-next branch.

By the way, how do you think about the following change in your previous
patches? It seems to be omitted from current patchset.

======== 8< --------
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index a754c6366b97..cb8ce491fe9d 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -143,7 +143,11 @@ static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
 	for (i = 0; i < j; i += length + 1)
 		length = fw_compute_block_crc(config_rom + i);

-	WARN_ON(j != config_rom_length);
+     if (j != config_rom_length) {
+        pr_warn("FireWire ROM length mismatch: expected %zu, got %d\n",
+            config_rom_length, j);
+        config_rom_length = j;
+     }
 }
======== 8< --------


Thanks

Takashi Sakamoto

  parent reply	other threads:[~2026-07-27  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-25 15:52 Sreeraj S Kurup
2026-07-25 15:52 ` [PATCH V3 v3 1/2] firewire: core: validate overall descriptor length " Sreeraj S Kurup
2026-07-25 15:52 ` [PATCH V3 v3 2/2] firewire: core: validate sub-block lengths " Sreeraj S Kurup
2026-07-27  0:47 ` Takashi Sakamoto [this message]
2026-07-27 17:42 [PATCH v3 0/2] firewire: core: validate descriptor and " Sreeraj S Kurup
2026-07-30 13:03 ` Takashi Sakamoto

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=20260727004702.GA237697@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=sreekuttan2156239@gmail.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®