Skip to contentSkip to conversation

firewire: core: validate descriptor and sub-block lengths in fw_core_add_descriptor()

PATCH Sreeraj S Kurup 2 participants 2 messages Jul 27 – Jul 30

lore
Share & tools
lore
#0 lore raw

Hi Takashi,

Thanks for applying the series to the for-next branch!

Regarding the change in generate_config_rom():

I dropped that specific change from this patchset to keep the series strictly focused on the out-of-bounds issue in fw_core_add_descriptor().

WARN_ON(j != config_rom_length) acts as an assertion that the ROM block traversal matched the expected length. Replacing it with pr_warn() and clamping config_rom_length = j avoids a kernel warning splat, but if j != config_rom_length occurs, it indicates an unexpected state during ROM generation rather than a standard runtime condition.

If you feel handling length mismatches gracefully via pr_warn() and updating config_rom_length is preferred over the WARN_ON assertion, I would be happy to send a follow-up patch for it.

Thanks,
Sreeraj

#1 lore raw

Hi,

Quoted 15 lines · Sreeraj S Kurup

Hi Takashi,

Thanks for applying the series to the for-next branch!

Regarding the change in generate_config_rom():

I dropped that specific change from this patchset to keep the series strictly focused on the out-of-bounds issue in fw_core_add_descriptor().

WARN_ON(j != config_rom_length) acts as an assertion that the ROM block traversal matched the expected length. Replacing it with pr_warn() and clamping config_rom_length = j avoids a kernel warning splat, but if j != config_rom_length occurs, it indicates an unexpected state during ROM generation rather than a standard runtime condition.

Quoted 3 lines

If you feel handling length mismatches gracefully via pr_warn() and updating config_rom_length is preferred over the WARN_ON assertion, I would be happy to send a follow-up patch for it.

Hm. The case that j does not equals to config_rom_length seems to be a programming mistake and should be fixed immediately. So let me leave it as is without any mitigation.

Thanks

Takashi Sakamoto