Skip to contentSkip to conversation

Patch "can: peak/pci: fix potential bug when probe() fails" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 10, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

can: peak/pci: fix potential bug when probe() fails

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
can-peak-pci-fix-potential-bug-when-probe-fails.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 5c2cb02edf79ad79d9b8d07c6d52243a948c4c9f Mon Sep 17 00:00:00 2001

From: Stephane Grosjean <[email protected]>
Date: Thu, 23 Nov 2017 15:44:35 +0100
Subject: can: peak/pci: fix potential bug when probe() fails

From: Stephane Grosjean <[email protected]>

commit 5c2cb02edf79ad79d9b8d07c6d52243a948c4c9f upstream.

PCI/PCIe drivers for PEAK-System CAN/CAN-FD interfaces do some access to the PCI config during probing. In case one of these accesses fails, a POSITIVE PCIBIOS_xxx error code is returned back. This POSITIVE error code MUST be converted into a NEGATIVE errno for the probe() function to indicate it failed. Using the pcibios_err_to_errno() function, we make sure that the return code will always be negative.

---
 drivers/net/can/peak_canfd/peak_pciefd_main.c |    5 ++++-
 drivers/net/can/sja1000/peak_pci.c            |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/can/peak_canfd/peak_pciefd_main.c +4 -1
@@ -825,7 +825,10 @@ err_release_regions:
 err_disable_pci:
 	pci_disable_device(pdev);
 
-	return err;
+	/* pci_xxx_config_word() return positive PCIBIOS_xxx error codes while
+	 * the probe() function must return a negative errno in case of failure
+	 * (err is unchanged if negative) */
+	return pcibios_err_to_errno(err);
 }
 
 /* free the board structure object, as well as its resources: */
drivers/net/can/sja1000/peak_pci.c +4 -1
@@ -717,7 +717,10 @@ failure_release_regions:
 failure_disable_pci:
 	pci_disable_device(pdev);
 
-	return err;
+	/* pci_xxx_config_word() return positive PCIBIOS_xxx error codes while
+	 * the probe() function must return a negative errno in case of failure
+	 * (err is unchanged if negative) */
+	return pcibios_err_to_errno(err);
 }
 
 static void peak_pci_remove(struct pci_dev *pdev)

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/can-peak-pcie_fd-fix-potential-bug-in-restarting-tx-queue.patch queue-4.14/can-peak-pci-fix-potential-bug-when-probe-fails.patch