]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/power-supply-sysfs-prevent-endless-uevent-loop-with-.patch
drop rdma-cma-consider-scope_id-while-binding-to-ipv6-ll-.patch from 4.4, 4.9, and...
[thirdparty/kernel/stable-queue.git] / queue-4.4 / power-supply-sysfs-prevent-endless-uevent-loop-with-.patch
1 From c3def3c3d3fee8e0d35154554f83635a97542085 Mon Sep 17 00:00:00 2001
2 From: Andrey Smirnov <andrew.smirnov@gmail.com>
3 Date: Wed, 24 Apr 2019 00:16:10 -0700
4 Subject: power: supply: sysfs: prevent endless uevent loop with
5 CONFIG_POWER_SUPPLY_DEBUG
6
7 [ Upstream commit 349ced9984ff540ce74ca8a0b2e9b03dc434b9dd ]
8
9 Fix a similar endless event loop as was done in commit
10 8dcf32175b4e ("i2c: prevent endless uevent loop with
11 CONFIG_I2C_DEBUG_CORE"):
12
13 The culprit is the dev_dbg printk in the i2c uevent handler. If
14 this is activated (for instance by CONFIG_I2C_DEBUG_CORE) it results
15 in an endless loop with systemd-journald.
16
17 This happens if user-space scans the system log and reads the uevent
18 file to get information about a newly created device, which seems
19 fair use to me. Unfortunately reading the "uevent" file uses the
20 same function that runs for creating the uevent for a new device,
21 generating the next syslog entry
22
23 Both CONFIG_I2C_DEBUG_CORE and CONFIG_POWER_SUPPLY_DEBUG were reported
24 in https://bugs.freedesktop.org/show_bug.cgi?id=76886 but only former
25 seems to have been fixed. Drop debug prints as it was done in I2C
26 subsystem to resolve the issue.
27
28 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
29 Cc: Chris Healy <cphealy@gmail.com>
30 Cc: linux-pm@vger.kernel.org
31 Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
32 Signed-off-by: Sasha Levin <sashal@kernel.org>
33 ---
34 drivers/power/power_supply_sysfs.c | 6 ------
35 1 file changed, 6 deletions(-)
36
37 diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
38 index ed2d7fd0c734d..488dd7eb0aeb7 100644
39 --- a/drivers/power/power_supply_sysfs.c
40 +++ b/drivers/power/power_supply_sysfs.c
41 @@ -277,15 +277,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
42 char *prop_buf;
43 char *attrname;
44
45 - dev_dbg(dev, "uevent\n");
46 -
47 if (!psy || !psy->desc) {
48 dev_dbg(dev, "No power supply yet\n");
49 return ret;
50 }
51
52 - dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name);
53 -
54 ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name);
55 if (ret)
56 return ret;
57 @@ -321,8 +317,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
58 goto out;
59 }
60
61 - dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf);
62 -
63 ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf);
64 kfree(attrname);
65 if (ret)
66 --
67 2.20.1
68