From b03457abaf672247264262d6953f00159824bc4c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 7 Jul 2014 13:04:07 -0700 Subject: [PATCH] 3.10-stable patches added patches: hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch --- ...ast-to-s16-on-shunt-and-current-regs.patch | 49 +++++++++++++++++++ ...-netdev-state-for-debugfs-read-write.patch | 43 ++++++++++++++++ ...ory-leak-on-sta-rate-selection-table.patch | 36 ++++++++++++++ queue-3.10/series | 3 ++ 4 files changed, 131 insertions(+) create mode 100644 queue-3.10/hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch create mode 100644 queue-3.10/mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch create mode 100644 queue-3.10/mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch diff --git a/queue-3.10/hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch b/queue-3.10/hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch new file mode 100644 index 00000000000..ef9a85e6fec --- /dev/null +++ b/queue-3.10/hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch @@ -0,0 +1,49 @@ +From c0214f98943b1fe43f7be61b7782b0c8f0836f28 Mon Sep 17 00:00:00 2001 +From: Fabio Baltieri +Date: Sun, 8 Jun 2014 22:06:24 +0100 +Subject: hwmon: (ina2xx) Cast to s16 on shunt and current regs + +From: Fabio Baltieri + +commit c0214f98943b1fe43f7be61b7782b0c8f0836f28 upstream. + +All devices supported by ina2xx are bidirectional and report the +measured shunt voltage and power values as a signed 16 bit, but the +current driver implementation caches all registers as u16, leading +to an incorrect sign extension when reporting to userspace in +ina2xx_get_value(). + +This patch fixes the problem by casting the signed registers to s16. +Tested on an INA219. + +Signed-off-by: Fabio Baltieri +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/ina2xx.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/hwmon/ina2xx.c ++++ b/drivers/hwmon/ina2xx.c +@@ -147,7 +147,8 @@ static int ina2xx_get_value(struct ina2x + + switch (reg) { + case INA2XX_SHUNT_VOLTAGE: +- val = DIV_ROUND_CLOSEST(data->regs[reg], ++ /* signed register */ ++ val = DIV_ROUND_CLOSEST((s16)data->regs[reg], + data->config->shunt_div); + break; + case INA2XX_BUS_VOLTAGE: +@@ -159,8 +160,8 @@ static int ina2xx_get_value(struct ina2x + val = data->regs[reg] * data->config->power_lsb; + break; + case INA2XX_CURRENT: +- /* LSB=1mA (selected). Is in mA */ +- val = data->regs[reg]; ++ /* signed register, LSB=1mA (selected), in mA */ ++ val = (s16)data->regs[reg]; + break; + default: + /* programmer goofed */ diff --git a/queue-3.10/mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch b/queue-3.10/mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch new file mode 100644 index 00000000000..a3bd9d0b62d --- /dev/null +++ b/queue-3.10/mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch @@ -0,0 +1,43 @@ +From 923eaf367206e01f22c97aee22300e332d071916 Mon Sep 17 00:00:00 2001 +From: Arik Nemtsov +Date: Mon, 26 May 2014 14:40:51 +0300 +Subject: mac80211: don't check netdev state for debugfs read/write + +From: Arik Nemtsov + +commit 923eaf367206e01f22c97aee22300e332d071916 upstream. + +Doing so will lead to an oops for a p2p-dev interface, since it has +no netdev. + +Signed-off-by: Arik Nemtsov +Signed-off-by: Emmanuel Grumbach +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman + +--- + net/mac80211/debugfs_netdev.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -34,8 +34,7 @@ static ssize_t ieee80211_if_read( + ssize_t ret = -EINVAL; + + read_lock(&dev_base_lock); +- if (sdata->dev->reg_state == NETREG_REGISTERED) +- ret = (*format)(sdata, buf, sizeof(buf)); ++ ret = (*format)(sdata, buf, sizeof(buf)); + read_unlock(&dev_base_lock); + + if (ret >= 0) +@@ -62,8 +61,7 @@ static ssize_t ieee80211_if_write( + + ret = -ENODEV; + rtnl_lock(); +- if (sdata->dev->reg_state == NETREG_REGISTERED) +- ret = (*write)(sdata, buf, count); ++ ret = (*write)(sdata, buf, count); + rtnl_unlock(); + + return ret; diff --git a/queue-3.10/mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch b/queue-3.10/mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch new file mode 100644 index 00000000000..3f2f187ae86 --- /dev/null +++ b/queue-3.10/mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch @@ -0,0 +1,36 @@ +From 53d045258ee2e38b1e882617cb0799a04d05f5fa Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Tue, 27 May 2014 22:33:57 +0200 +Subject: mac80211: fix a memory leak on sta rate selection table +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Felix Fietkau + +commit 53d045258ee2e38b1e882617cb0799a04d05f5fa upstream. + +If the rate control algorithm uses a selection table, it +is leaked when the station is destroyed - fix that. + +Signed-off-by: Felix Fietkau +Reported-by: Christophe Prévotaux +Fixes: 0d528d85c519 ("mac80211: improve the rate control API") +[add commit log entry, remove pointless NULL check] +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman + +--- + net/mac80211/sta_info.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -270,6 +270,7 @@ void sta_info_free(struct ieee80211_loca + + sta_dbg(sta->sdata, "Destroyed STA %pM\n", sta->sta.addr); + ++ kfree(rcu_dereference_raw(sta->sta.rates)); + kfree(sta); + } + diff --git a/queue-3.10/series b/queue-3.10/series index c3a1a0e1ae3..12b043c04ab 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -24,3 +24,6 @@ bluetooth-fix-locking-of-hdev-when-calling-into-smp-code.patch dm-thin-update-discard_granularity-to-reflect-the-thin-pool-blocksize.patch rbd-use-reference-counts-for-image-requests.patch rbd-handle-parent_overlap-on-writes-correctly.patch +hwmon-ina2xx-cast-to-s16-on-shunt-and-current-regs.patch +mac80211-don-t-check-netdev-state-for-debugfs-read-write.patch +mac80211-fix-a-memory-leak-on-sta-rate-selection-table.patch -- 2.47.3