* [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup
@ 2026-12-05 8:20 Tian Xuechen
2026-12-05 8:20 ` [PATCH 1/2] media: solo6x10: Fix potential double free on encoder init failure Tian Xuechen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tian Xuechen @ 2026-12-05 8:20 UTC (permalink / raw)
To: maintainers
Cc: ismael, mchehab, bcollins, gregkh, linux-media, linux-kernel,
phasta, hverkuil
Fix two error unwinds in solo6x10. Clear the encoder slots during
initialization rollback and clear the MMIO pointer if mapping fails.
Built solo6x10-v4l2-enc.o and solo6x10-core.o with x86_64 allmodconfig,
GCC 11.4.0 and W=1. No runtime tests were performed.
Tian Xuechen (2):
media: solo6x10: Fix potential double free on encoder init failure
media: solo6x10: Fix potential invalid access after mapping failure
drivers/media/pci/solo6x10/solo6x10-core.c | 4 +++-
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] media: solo6x10: Fix potential double free on encoder init failure
2026-12-05 8:20 [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Tian Xuechen
@ 2026-12-05 8:20 ` Tian Xuechen
2026-12-05 8:20 ` [PATCH 2/2] media: solo6x10: Fix potential invalid access after mapping failure Tian Xuechen
2026-12-05 12:09 ` [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Ben Collins
2 siblings, 0 replies; 4+ messages in thread
From: Tian Xuechen @ 2026-12-05 8:20 UTC (permalink / raw)
To: maintainers
Cc: ismael, mchehab, bcollins, gregkh, linux-media, linux-kernel,
phasta, hverkuil
Partial encoder initialization frees the successful encoders but leaves
their pointers in v4l2_enc. The outer probe unwind visits those entries
again, including the failed entry containing an error pointer.
Clear both the failed entry and each freed encoder slot.
This issue was found by our static analysis tool under development.
Fixes: faa4fd2a0951 ("Staging: solo6x10: New driver (staging) for Softlogic 6x10")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
index 91b5c4161930..a4d7872ed869 100644
--- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
+++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
@@ -1357,8 +1357,11 @@ int solo_enc_v4l2_init(struct solo_dev *solo_dev, unsigned nr)
if (i != solo_dev->nr_chans) {
int ret = PTR_ERR(solo_dev->v4l2_enc[i]);
- while (i--)
+ solo_dev->v4l2_enc[i] = NULL;
+ while (i--) {
solo_enc_free(solo_dev->v4l2_enc[i]);
+ solo_dev->v4l2_enc[i] = NULL;
+ }
dma_free_coherent(&solo_dev->pdev->dev, solo_dev->vh_size,
solo_dev->vh_buf, solo_dev->vh_dma);
solo_dev->vh_buf = NULL;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] media: solo6x10: Fix potential invalid access after mapping failure
2026-12-05 8:20 [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Tian Xuechen
2026-12-05 8:20 ` [PATCH 1/2] media: solo6x10: Fix potential double free on encoder init failure Tian Xuechen
@ 2026-12-05 8:20 ` Tian Xuechen
2026-12-05 12:09 ` [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Ben Collins
2 siblings, 0 replies; 4+ messages in thread
From: Tian Xuechen @ 2026-12-05 8:20 UTC (permalink / raw)
To: maintainers
Cc: ismael, mchehab, bcollins, gregkh, linux-media, linux-kernel,
phasta, hverkuil
pcim_iomap_region() returns an error pointer on failure. The probe unwind
checks reg_base for NULL and otherwise accesses device registers, so an
error pointer is incorrectly treated as a valid mapping.
Clear reg_base before entering the unwind path.
This issue was found by our static analysis tool under development.
Fixes: bd2ad1a08a4c ("media: solo6x10: Replace deprecated PCI functions")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/media/pci/solo6x10/solo6x10-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c
index 282c2c87151f..3d01c6f3fe05 100644
--- a/drivers/media/pci/solo6x10/solo6x10-core.c
+++ b/drivers/media/pci/solo6x10/solo6x10-core.c
@@ -479,8 +479,10 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
solo_dev->reg_base = pcim_iomap_region(pdev, 0, SOLO6X10_NAME);
ret = PTR_ERR_OR_ZERO(solo_dev->reg_base);
- if (ret)
+ if (ret) {
+ solo_dev->reg_base = NULL;
goto fail_probe;
+ }
chip_id = solo_reg_read(solo_dev, SOLO_CHIP_OPTION) &
SOLO_CHIP_ID_MASK;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup
2026-12-05 8:20 [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Tian Xuechen
2026-12-05 8:20 ` [PATCH 1/2] media: solo6x10: Fix potential double free on encoder init failure Tian Xuechen
2026-12-05 8:20 ` [PATCH 2/2] media: solo6x10: Fix potential invalid access after mapping failure Tian Xuechen
@ 2026-12-05 12:09 ` Ben Collins
2 siblings, 0 replies; 4+ messages in thread
From: Ben Collins @ 2026-12-05 12:09 UTC (permalink / raw)
To: Tian Xuechen
Cc: maintainers, ismael, mchehab, gregkh, linux-media, linux-kernel,
phasta, hverkuil
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
> On Dec 5, 2026, at 3:20 AM, Tian Xuechen <202300460064@mail.sdu.edu.cn> wrote:
>
> Fix two error unwinds in solo6x10. Clear the encoder slots during
> initialization rollback and clear the MMIO pointer if mapping fails.
>
> Built solo6x10-v4l2-enc.o and solo6x10-core.o with x86_64 allmodconfig,
> GCC 11.4.0 and W=1. No runtime tests were performed.
>
>
> Tian Xuechen (2):
> media: solo6x10: Fix potential double free on encoder init failure
> media: solo6x10: Fix potential invalid access after mapping failure
>
> drivers/media/pci/solo6x10/solo6x10-core.c | 4 +++-
> drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 5 ++++-
> 2 files changed, 7 insertions(+), 2 deletions(-)
>
>
> base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
>
For both:
Signed-off-by: Ben Collins <bcollins@kernel.org>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-12-05 12:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-05 8:20 [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Tian Xuechen
2026-12-05 8:20 ` [PATCH 1/2] media: solo6x10: Fix potential double free on encoder init failure Tian Xuechen
2026-12-05 8:20 ` [PATCH 2/2] media: solo6x10: Fix potential invalid access after mapping failure Tian Xuechen
2026-12-05 12:09 ` [PATCH 0/2] media: solo6x10: Fix encoder and MMIO error cleanup Ben Collins
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®