mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: cec: extron: release the v4l2 device on disconnect
@ 2026-11-03 10:28 Wentao Liang
  2026-11-03 10:41 ` Krzysztof Kozlowski
  2026-11-03 11:10 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-03 10:28 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, Wentao Liang, stable

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@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 .../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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:28 [PATCH] media: cec: extron: release the v4l2 device on disconnect Wentao Liang
2026-11-03 10:41 ` Krzysztof Kozlowski
2026-11-03 11:10 ` Krzysztof Kozlowski

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®