Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-14 11:45:40 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-14 11:45:43 +0100
commit673c6f7e36d64c347f27d310958b4a10393d58ec (patch)
tree1e96b56d01f275dbea462daed136e319246ebd0d
parentb7264877121d89972f08333932efa3e79f41b89c (diff)
hwmon: (lm80) fix a missing check of bus read in lm80 probe
(bsc#1051510).
-rw-r--r--patches.drivers/hwmon-lm80-fix-a-missing-check-of-bus-read-in-lm80-p.patch55
-rw-r--r--series.conf1
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.drivers/hwmon-lm80-fix-a-missing-check-of-bus-read-in-lm80-p.patch b/patches.drivers/hwmon-lm80-fix-a-missing-check-of-bus-read-in-lm80-p.patch
new file mode 100644
index 0000000000..30ac8fc199
--- /dev/null
+++ b/patches.drivers/hwmon-lm80-fix-a-missing-check-of-bus-read-in-lm80-p.patch
@@ -0,0 +1,55 @@
+From 9aa3aa15f4c2f74f47afd6c5db4b420fadf3f315 Mon Sep 17 00:00:00 2001
+From: Kangjie Lu <kjlu@umn.edu>
+Date: Fri, 21 Dec 2018 13:10:39 -0600
+Subject: [PATCH] hwmon: (lm80) fix a missing check of bus read in lm80 probe
+Git-commit: 9aa3aa15f4c2f74f47afd6c5db4b420fadf3f315
+Patch-mainline: v5.0-rc1
+References: bsc#1051510
+
+In lm80_probe(), if lm80_read_value() fails, it returns a negative
+error number which is stored to data->fan[f_min] and will be further
+used. We should avoid using the data if the read fails.
+
+The fix checks if lm80_read_value() fails, and if so, returns with the
+error number.
+
+Signed-off-by: Kangjie Lu <kjlu@umn.edu>
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+
+---
+ drivers/hwmon/lm80.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
+index 04f9df0d2341..0e30fa00204c 100644
+--- a/drivers/hwmon/lm80.c
++++ b/drivers/hwmon/lm80.c
+@@ -628,6 +628,7 @@ static int lm80_probe(struct i2c_client *client,
+ struct device *dev = &client->dev;
+ struct device *hwmon_dev;
+ struct lm80_data *data;
++ int rv;
+
+ data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
+ if (!data)
+@@ -640,8 +641,14 @@ static int lm80_probe(struct i2c_client *client,
+ lm80_init_client(client);
+
+ /* A few vars need to be filled upon startup */
+- data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
+- data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
++ rv = lm80_read_value(client, LM80_REG_FAN_MIN(1));
++ if (rv < 0)
++ return rv;
++ data->fan[f_min][0] = rv;
++ rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
++ if (rv < 0)
++ return rv;
++ data->fan[f_min][1] = rv;
+
+ hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
+ data, lm80_groups);
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index 76070b6ebf..ab10e36b08 100644
--- a/series.conf
+++ b/series.conf
@@ -20069,6 +20069,7 @@
patches.fixes/mm-migrate-provide-buffer_migrate_page_norefs.patch
patches.fixes/blkdev-avoid-migration-stalls-for-blkdev-pages.patch
patches.drivers/hwmon-lm80-fix-a-missing-check-of-the-status-of-SMBu.patch
+ patches.drivers/hwmon-lm80-fix-a-missing-check-of-bus-read-in-lm80-p.patch
patches.drivers/gpio-pl061-Move-irq_chip-definition-inside-struct-pl.patch
patches.drivers/gpiolib-Fix-return-value-of-gpio_to_desc-stub-if-GPI.patch
patches.drivers/power-supply-olpc_battery-correct-the-temperature-un.patch