From: Andrey Karelin <a.karelin@ideco.ru>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrey Karelin <a.karelin@ideco.ru>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH 2/3] staging: media: av7110: check dvb_dmxdev_init() result in av7110_register()
Date: Mon, 2 Nov 2026 17:51:30 +0500 [thread overview]
Message-ID: <20261102125149.82725-3-a.karelin@ideco.ru> (raw)
In-Reply-To: <20261102125149.82725-1-a.karelin@ideco.ru>
av7110_register() ignores the return value of dvb_dmxdev_init() for both
the main dmxdev and the optional budget-patch dmxdev1. dvb_dmxdev_init()
fails if the demux cannot be opened, the filter array cannot be
allocated or the demux/dvr device cannot be registered. Probing then
continues, and on device removal dvb_unregister() calls
dvb_dmxdev_release(), which dereferences dmxdev->dvbdev and
dmxdev->dvr_dvbdev that are NULL or, if only the dvr device failed to
register, already freed.
Check the result and unwind on failure, releasing the corresponding
demux as well.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Andrey Karelin <a.karelin@ideco.ru>
---
drivers/staging/media/av7110/av7110.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/av7110/av7110.c b/drivers/staging/media/av7110/av7110.c
index ecc15bb222c5..3371e33db103 100644
--- a/drivers/staging/media/av7110/av7110.c
+++ b/drivers/staging/media/av7110/av7110.c
@@ -1283,7 +1283,9 @@ static int av7110_register(struct av7110 *av7110)
av7110->dmxdev.demux = &dvbdemux->dmx;
av7110->dmxdev.capabilities = 0;
- dvb_dmxdev_init(&av7110->dmxdev, &av7110->dvb_adapter);
+ ret = dvb_dmxdev_init(&av7110->dmxdev, &av7110->dvb_adapter);
+ if (ret < 0)
+ goto err_dmx_release;
av7110->hw_frontend.source = DMX_FRONTEND_0;
@@ -1337,13 +1339,17 @@ static int av7110_register(struct av7110 *av7110)
av7110->dmxdev1.demux = &dvbdemux1->dmx;
av7110->dmxdev1.capabilities = 0;
- dvb_dmxdev_init(&av7110->dmxdev1, &av7110->dvb_adapter);
+ ret = dvb_dmxdev_init(&av7110->dmxdev1, &av7110->dvb_adapter);
+ if (ret < 0)
+ goto err_dmx1_release;
dvb_net_init(&av7110->dvb_adapter, &av7110->dvb_net1, &dvbdemux1->dmx);
pr_info("additional demux1 for budget-patch registered\n");
}
return 0;
+err_dmx1_release:
+ dvb_dmx_release(&av7110->demux1);
err_unregister:
dvb_net_release(&av7110->dvb_net);
dvb_unregister_device(av7110->osd_dev);
@@ -1351,6 +1357,7 @@ static int av7110_register(struct av7110 *av7110)
av7110_av_unregister(av7110);
err_dmxdev_release:
dvb_dmxdev_release(&av7110->dmxdev);
+err_dmx_release:
dvb_dmx_release(&av7110->demux);
err_registered:
av7110->registered = 0;
--
2.56.0
next prev parent reply other threads:[~2026-11-02 12:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 12:51 [PATCH 0/3] staging: media: av7110: check demux and net initialization " Andrey Karelin
2026-11-02 12:51 ` [PATCH 1/3] staging: media: av7110: check dvb_dmx_init() result " Andrey Karelin
2026-11-02 12:51 ` Andrey Karelin [this message]
2026-11-02 12:51 ` [PATCH 3/3] staging: media: av7110: check dvb_net_init() " Andrey Karelin
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=20261102125149.82725-3-a.karelin@ideco.ru \
--to=a.karelin@ideco.ru \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=lvc-project@linuxtesting.org \
--cc=mchehab@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®