mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: Hans Verkuil <hverkuil@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] media: cec: extron: release the v4l2 device on disconnect
Date: Tue,  3 Nov 2026 10:28:50 +0000	[thread overview]
Message-ID: <20261103102850.1340434-1-vulab@iscas.ac.cn> (raw)

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


             reply	other threads:[~2026-11-03 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 10:28 Wentao Liang [this message]
2026-11-03 10:41 ` Krzysztof Kozlowski
2026-11-03 11:10 ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261103102850.1340434-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=hverkuil@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®