Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-10-30 12:15:55 +0100
committerTakashi Iwai <tiwai@suse.de>2018-10-30 12:16:03 +0100
commit0535cdc9ba43fa711b64162f644e8d4aebe7736a (patch)
tree901473a9ac1ed8de4e477305e9d2a03b6384655f
parent0831c5e2d5f66819d7dd6480d73699a87b9294fc (diff)
iio: adc: imx25-gcq: Fix leak of device_node in
mx25_gcq_setup_cfgs() (bsc#1051510).
-rw-r--r--patches.drivers/iio-adc-imx25-gcq-Fix-leak-of-device_node-in-mx25_gc.patch77
-rw-r--r--series.conf1
2 files changed, 78 insertions, 0 deletions
diff --git a/patches.drivers/iio-adc-imx25-gcq-Fix-leak-of-device_node-in-mx25_gc.patch b/patches.drivers/iio-adc-imx25-gcq-Fix-leak-of-device_node-in-mx25_gc.patch
new file mode 100644
index 0000000000..0dd5585cb3
--- /dev/null
+++ b/patches.drivers/iio-adc-imx25-gcq-Fix-leak-of-device_node-in-mx25_gc.patch
@@ -0,0 +1,77 @@
+From d3fa21c73c391975488818b085b894c2980ea052 Mon Sep 17 00:00:00 2001
+From: Alexey Khoroshilov <khoroshilov@ispras.ru>
+Date: Sat, 22 Sep 2018 00:58:02 +0300
+Subject: [PATCH] iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs()
+Git-commit: d3fa21c73c391975488818b085b894c2980ea052
+Patch-mainline: v4.20-rc1
+References: bsc#1051510
+
+Leaving for_each_child_of_node loop we should release child device node,
+if it is not stored for future use.
+
+Found by Linux Driver Verification project (linuxtesting.org).
+
+Jc: I'm not sending this as a quick fix as it's been wrong for years,
+but good to pick up for stable after the merge window.
+
+Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
+Fixes: 6df2e98c3ea56 ("iio: adc: Add imx25-gcq ADC driver")
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/iio/adc/fsl-imx25-gcq.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/iio/adc/fsl-imx25-gcq.c b/drivers/iio/adc/fsl-imx25-gcq.c
+index ea264fa9e567..929c617db364 100644
+--- a/drivers/iio/adc/fsl-imx25-gcq.c
++++ b/drivers/iio/adc/fsl-imx25-gcq.c
+@@ -209,12 +209,14 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
+ ret = of_property_read_u32(child, "reg", &reg);
+ if (ret) {
+ dev_err(dev, "Failed to get reg property\n");
++ of_node_put(child);
+ return ret;
+ }
+
+ if (reg >= MX25_NUM_CFGS) {
+ dev_err(dev,
+ "reg value is greater than the number of available configuration registers\n");
++ of_node_put(child);
+ return -EINVAL;
+ }
+
+@@ -228,6 +230,7 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
+ if (IS_ERR(priv->vref[refp])) {
+ dev_err(dev, "Error, trying to use external voltage reference without a vref-%s regulator.",
+ mx25_gcq_refp_names[refp]);
++ of_node_put(child);
+ return PTR_ERR(priv->vref[refp]);
+ }
+ priv->channel_vref_mv[reg] =
+@@ -240,6 +243,7 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
+ break;
+ default:
+ dev_err(dev, "Invalid positive reference %d\n", refp);
++ of_node_put(child);
+ return -EINVAL;
+ }
+
+@@ -254,10 +258,12 @@ static int mx25_gcq_setup_cfgs(struct platform_device *pdev,
+
+ if ((refp & MX25_ADCQ_CFG_REFP_MASK) != refp) {
+ dev_err(dev, "Invalid fsl,adc-refp property value\n");
++ of_node_put(child);
+ return -EINVAL;
+ }
+ if ((refn & MX25_ADCQ_CFG_REFN_MASK) != refn) {
+ dev_err(dev, "Invalid fsl,adc-refn property value\n");
++ of_node_put(child);
+ return -EINVAL;
+ }
+
+--
+2.19.1
+
diff --git a/series.conf b/series.conf
index 3eb0bfc187..d456ceed26 100644
--- a/series.conf
+++ b/series.conf
@@ -18293,6 +18293,7 @@
patches.drivers/drm-i915-cfl-Add-a-new-CFL-PCI-ID
patches.drivers/drm-i915-Restore-vblank-interrupts-earlier.patch
patches.drivers/drm-i915-dp-Link-train-Fallback-on-eDP-only-if-fallb.patch
+ patches.drivers/iio-adc-imx25-gcq-Fix-leak-of-device_node-in-mx25_gc.patch
patches.drivers/media-uvcvideo-Fix-uvc_alloc_entity-allocation-align.patch
patches.drivers/media-dvb-fix-compat-ioctl-translation.patch
patches.drivers/media-tvp5150-avoid-going-past-array-on-v4l2_queryme.patch