git: 51f4e90ce7ef - main - firewire: NULL check on malloc in fw_busreset()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Jun 2026 00:41:10 UTC
The branch main has been updated by adrian:
URL: https://cgit.FreeBSD.org/src/commit/?id=51f4e90ce7ef3b8d036a9d34ab464f4152ca4bab
commit 51f4e90ce7ef3b8d036a9d34ab464f4152ca4bab
Author: Abdelkader Boudih <freebsd@seuros.com>
AuthorDate: 2026-06-22 00:30:53 +0000
Commit: Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2026-06-22 00:31:12 +0000
firewire: NULL check on malloc in fw_busreset()
fw_busreset() allocates newrom with M_NOWAIT from interrupt context.
If the allocation fails, crom_load() dereferences a NULL pointer.
Skip the config ROM comparison on allocation failure so the next bus
reset will retry.
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D57728
---
sys/dev/firewire/firewire.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/dev/firewire/firewire.c b/sys/dev/firewire/firewire.c
index a54cbf9cdf0b..dfb906ba34c1 100644
--- a/sys/dev/firewire/firewire.c
+++ b/sys/dev/firewire/firewire.c
@@ -748,6 +748,8 @@ fw_busreset(struct firewire_comm *fc, uint32_t new_status)
*/
#define FW_MAX_GENERATION 0xF
newrom = malloc(CROMSIZE, M_FW, M_NOWAIT | M_ZERO);
+ if (newrom == NULL)
+ goto out;
src = &fc->crom_src_buf->src;
crom_load(src, newrom, CROMSIZE);
if (bcmp(newrom, fc->config_rom, CROMSIZE) != 0) {
@@ -763,6 +765,7 @@ fw_busreset(struct firewire_comm *fc, uint32_t new_status)
bcopy(newrom, fc->config_rom, CROMSIZE);
}
free(newrom, M_FW);
+out:;
}
/* Call once after reboot */