[PATCH] media: cx231xx: Fix potential NULL access after DVB net init failure
From: Tian Xuechen
Date: Sat Dec 05 2026 - 03:21:54 EST
register_dvb() ignores dvb_net_init() errors and can report success with
no DVB net device. Subsequent cleanup dereferences that missing device
in dvb_net_release().
Propagate the error and unwind the completed frontend stages.
This issue was found by our static analysis tool under development.
Fixes: e0d3bafd0258 ("V4L/DVB (10954): Add cx231xx USB driver")
Signed-off-by: Tian Xuechen <202300460064@xxxxxxxxxxxxxxx>
---
drivers/media/usb/cx231xx/cx231xx-dvb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 472a4405a105..0adeb7e6cc2f 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -556,7 +556,9 @@ static int register_dvb(struct cx231xx_dvb *dvb,
}
/* register network adapter */
- dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
+ result = dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
+ if (result < 0)
+ goto fail_fe_conn;
result = dvb_create_media_graph(&dvb->adapter,
dev->tuner_type == TUNER_ABSENT);
if (result < 0)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907