[PATCH] media: cec: extron: release the v4l2 device on disconnect
From: Wentao Liang
Date: Tue Nov 03 2026 - 06:17:55 EST
extron_connect() registers a v4l2 device, which takes a reference on
the underlying serio device. extron_disconnect() never unregisters it,
so the reference is never dropped. The extron structure allocated in
extron_connect() is not freed either.
Unregister the v4l2 device and free the structure at the end of
extron_disconnect(), mirroring the error path in extron_connect().
Fixes: 056f2821b631 ("media: cec: extron-da-hd-4k-plus: add the Extron DA HD 4K Plus CEC driver")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
.../media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index 1f8ed7ff31e5..724709606a0b 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -1403,6 +1403,8 @@ static void extron_disconnect(struct serio *serio)
extron->serio = NULL;
serio_set_drvdata(serio, NULL);
serio_close(serio);
+ v4l2_device_unregister(&extron->v4l2_dev);
+ kfree(extron);
}
static int extron_setup(struct extron *extron)
--
2.34.1