FAILED: patch "[PATCH] media: saa7164: fix cleanup on resource allocation failure" failed to apply to 5.10-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 28e84c6e2e6753ed238ea097b2842a32a6a6879b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090952-skeletal-related-3a42@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 28e84c6e2e6753ed238ea097b2842a32a6a6879b Mon Sep 17 00:00:00 2001
From: Guangshuo Li <[email protected]>
Date: Sat, 18 Jul 2026 14:10:11 +0800
Subject: [PATCH] media: saa7164: fix cleanup on resource allocation failure
saa7164_dev_setup() adds the device to the global saa7164_devlist before requesting the PCI BAR memory regions.
If get_resources() fails, saa7164_dev_setup() decrements the device count and returns an error, but leaves the device on saa7164_devlist. The probe error path then frees the device, leaving a dangling entry on the global list.
Reuse the existing MMIO mapping error path to remove the device from saa7164_devlist and decrement the device count before returning.
Also release BAR0 if it was successfully requested but the BAR2 request fails.
drivers/media/pci/saa7164/saa7164-core.c +5 -3
@@ -878,6 +878,9 @@ static int get_resources(struct saa7164_dev *dev)if (request_mem_region (pci_resource_start (dev->pci,2 ),pci_resource_len (dev->pci,2 ), dev->name))return 0 ; + +release_mem_region (pci_resource_start (dev->pci,0 ), +pci_resource_len (dev->pci,0 )); } printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx or 0x%llx\n",
@@ -1000,8 +1003,7 @@ static int saa7164_dev_setup(struct saa7164_dev *dev) dev->name, dev->pci->subsystem_vendor, dev->pci->subsystem_device); - saa7164_devcount--; -return -ENODEV ; + goto err_devlist; }/* PCI/e allocations */
@@ -1039,7 +1041,7 @@ static int saa7164_dev_setup(struct saa7164_dev *dev)iounmap (dev->lmmio); err_ioremap_bar0:release_resources (dev); - +err_devlist: scoped_guard(mutex, &devlist) {list_del (&dev->devlist); }
Sasha Levin
maintainerPATCH 1/1 media: saa7164: fix cleanup on resource allocation failure
From: Guangshuo Li <[email protected]>
[ Upstream commit 28e84c6e2e6753ed238ea097b2842a32a6a6879b ]
saa7164_dev_setup() adds the device to the global saa7164_devlist before requesting the PCI BAR memory regions.
If get_resources() fails, saa7164_dev_setup() decrements the device count and returns an error, but leaves the device on saa7164_devlist. The probe error path then frees the device, leaving a dangling entry on the global list.
Reuse the existing MMIO mapping error path to remove the device from saa7164_devlist and decrement the device count before returning.
Also release BAR0 if it was successfully requested but the BAR2 request fails.
--- drivers/media/pci/saa7164/saa7164-core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/media/pci/saa7164/saa7164-core.c +6 -0
@@ -880,6 +880,9 @@ static int get_resources(struct saa7164_dev *dev)if (request_mem_region (pci_resource_start (dev->pci,2 ),pci_resource_len (dev->pci,2 ), dev->name))return 0 ; + +release_mem_region (pci_resource_start (dev->pci,0 ), +pci_resource_len (dev->pci,0 )); } printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx or 0x%llx\n",
@@ -993,6 +996,9 @@ static int saa7164_dev_setup(struct saa7164_dev *dev) dev->name, dev->pci->subsystem_vendor, dev->pci->subsystem_device); +mutex_lock (&devlist); +list_del (&dev->devlist); +mutex_unlock (&devlist); saa7164_devcount--;return -ENODEV ; }
Signature · 1 line
2.53.0