From 155a51125400ea97d9597017d762379c2f434778 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 4 Oct 2016 17:17:36 +0200 Subject: [PATCH] 4.4-stable patches added patches: hwmon-adt7411-set-bit-3-in-cfg1-register.patch ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch mmc-pxamci-fix-potential-oops.patch nvmem-declare-nvmem_cell_read-consistently.patch spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch tools-vm-slabinfo-fix-an-unintentional-printf.patch --- ...n-adt7411-set-bit-3-in-cfg1-register.patch | 43 +++++++++++ ...k-local-mcast-ipv6-address-in-backup.patch | 75 +++++++++++++++++++ queue-4.4/mmc-pxamci-fix-potential-oops.patch | 62 +++++++++++++++ ...declare-nvmem_cell_read-consistently.patch | 36 +++++++++ queue-4.4/series | 6 ++ ...d-invalid-clock-generator-parameters.patch | 40 ++++++++++ ...slabinfo-fix-an-unintentional-printf.patch | 41 ++++++++++ 7 files changed, 303 insertions(+) create mode 100644 queue-4.4/hwmon-adt7411-set-bit-3-in-cfg1-register.patch create mode 100644 queue-4.4/ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch create mode 100644 queue-4.4/mmc-pxamci-fix-potential-oops.patch create mode 100644 queue-4.4/nvmem-declare-nvmem_cell_read-consistently.patch create mode 100644 queue-4.4/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch create mode 100644 queue-4.4/tools-vm-slabinfo-fix-an-unintentional-printf.patch diff --git a/queue-4.4/hwmon-adt7411-set-bit-3-in-cfg1-register.patch b/queue-4.4/hwmon-adt7411-set-bit-3-in-cfg1-register.patch new file mode 100644 index 00000000000..351a691f2d8 --- /dev/null +++ b/queue-4.4/hwmon-adt7411-set-bit-3-in-cfg1-register.patch @@ -0,0 +1,43 @@ +From b53893aae441a034bf4dbbad42fe218561d7d81f Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 19 Jul 2016 16:43:26 +0200 +Subject: hwmon: (adt7411) set bit 3 in CFG1 register + +From: Michael Walle + +commit b53893aae441a034bf4dbbad42fe218561d7d81f upstream. + +According to the datasheet you should only write 1 to this bit. If it is +not set, at least AIN3 will return bad values on newer silicon revisions. + +Fixes: d84ca5b345c2 ("hwmon: Add driver for ADT7411 voltage and temperature sensor") +Signed-off-by: Michael Walle +Signed-off-by: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hwmon/adt7411.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/hwmon/adt7411.c ++++ b/drivers/hwmon/adt7411.c +@@ -30,6 +30,7 @@ + + #define ADT7411_REG_CFG1 0x18 + #define ADT7411_CFG1_START_MONITOR (1 << 0) ++#define ADT7411_CFG1_RESERVED_BIT3 (1 << 3) + + #define ADT7411_REG_CFG2 0x19 + #define ADT7411_CFG2_DISABLE_AVG (1 << 5) +@@ -296,8 +297,10 @@ static int adt7411_probe(struct i2c_clie + mutex_init(&data->device_lock); + mutex_init(&data->update_lock); + ++ /* According to the datasheet, we must only write 1 to bit 3 */ + ret = adt7411_modify_bit(client, ADT7411_REG_CFG1, +- ADT7411_CFG1_START_MONITOR, 1); ++ ADT7411_CFG1_RESERVED_BIT3 ++ | ADT7411_CFG1_START_MONITOR, 1); + if (ret < 0) + return ret; + diff --git a/queue-4.4/ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch b/queue-4.4/ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch new file mode 100644 index 00000000000..3183371e01e --- /dev/null +++ b/queue-4.4/ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch @@ -0,0 +1,75 @@ +From 3777ed688fba82d0bd43f9fc1ebbc6abe788576d Mon Sep 17 00:00:00 2001 +From: Quentin Armitage +Date: Thu, 16 Jun 2016 08:00:14 +0100 +Subject: ipvs: fix bind to link-local mcast IPv6 address in backup + +From: Quentin Armitage + +commit 3777ed688fba82d0bd43f9fc1ebbc6abe788576d upstream. + +When using HEAD from +https://git.kernel.org/cgit/utils/kernel/ipvsadm/ipvsadm.git/, +the command: +ipvsadm --start-daemon backup --mcast-interface eth0.60 \ + --mcast-group ff02::1:81 +fails with the error message: +Argument list too long + +whereas both: +ipvsadm --start-daemon master --mcast-interface eth0.60 \ + --mcast-group ff02::1:81 +and: +ipvsadm --start-daemon backup --mcast-interface eth0.60 \ + --mcast-group 224.0.0.81 +are successful. + +The error message "Argument list too long" isn't helpful. The error occurs +because an IPv6 address is given in backup mode. + +The error is in make_receive_sock() in net/netfilter/ipvs/ip_vs_sync.c, +since it fails to set the interface on the address or the socket before +calling inet6_bind() (via sock->ops->bind), where the test +'if (!sk->sk_bound_dev_if)' failed. + +Setting sock->sk->sk_bound_dev_if on the socket before calling +inet6_bind() resolves the issue. + +Fixes: d33288172e72 ("ipvs: add more mcast parameters for the sync daemon") +Signed-off-by: Quentin Armitage +Acked-by: Julian Anastasov +Signed-off-by: Simon Horman +Signed-off-by: Greg Kroah-Hartman + +--- + net/netfilter/ipvs/ip_vs_sync.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/net/netfilter/ipvs/ip_vs_sync.c ++++ b/net/netfilter/ipvs/ip_vs_sync.c +@@ -1545,7 +1545,8 @@ error: + /* + * Set up receiving multicast socket over UDP + */ +-static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id) ++static struct socket *make_receive_sock(struct netns_ipvs *ipvs, int id, ++ int ifindex) + { + /* multicast addr */ + union ipvs_sockaddr mcast_addr; +@@ -1566,6 +1567,7 @@ static struct socket *make_receive_sock( + set_sock_size(sock->sk, 0, result); + + get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id); ++ sock->sk->sk_bound_dev_if = ifindex; + result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen); + if (result < 0) { + pr_err("Error binding to the multicast addr\n"); +@@ -1868,7 +1870,7 @@ int start_sync_thread(struct netns_ipvs + if (state == IP_VS_STATE_MASTER) + sock = make_send_sock(ipvs, id); + else +- sock = make_receive_sock(ipvs, id); ++ sock = make_receive_sock(ipvs, id, dev->ifindex); + if (IS_ERR(sock)) { + result = PTR_ERR(sock); + goto outtinfo; diff --git a/queue-4.4/mmc-pxamci-fix-potential-oops.patch b/queue-4.4/mmc-pxamci-fix-potential-oops.patch new file mode 100644 index 00000000000..4141533bd0d --- /dev/null +++ b/queue-4.4/mmc-pxamci-fix-potential-oops.patch @@ -0,0 +1,62 @@ +From b3802db5eb72d2a96f4aa4ff0abb937033df2acf Mon Sep 17 00:00:00 2001 +From: Robert Jarzmik +Date: Thu, 14 Jul 2016 17:05:50 +0200 +Subject: mmc: pxamci: fix potential oops + +From: Robert Jarzmik + +commit b3802db5eb72d2a96f4aa4ff0abb937033df2acf upstream. + +As reported by Dan in his report in [1], there is a potential NULL +pointer derefence if these conditions are met : + - there is no platform_data provided, ie. host->pdata = NULL + +Fix this by only using the platform data ro_invert when a gpio for +read-only is provided by the platform data. + +This doesn't appear yet as every pxa board provides a platform_data, and +calls pxa_set_mci_info() with a non NULL pointer. + +[1] [bug report] mmc: pxamci: fix card detect with slot-gpio API. +The commit fd546ee6a7dc ("mmc: pxamci: fix card detect with slot-gpio +API") from Sep 26, 2015, leads to the following static checker warning: + + drivers/mmc/host/pxamci.c:809 pxamci_probe() + warn: variable dereferenced before check 'host->pdata' (see line 798) + +Fixes: fd546ee6a7dc ("mmc: pxamci: fix card detect with slot-gpio API") +Reported-by: Dan Carpenter +Signed-off-by: Robert Jarzmik +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mmc/host/pxamci.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +--- a/drivers/mmc/host/pxamci.c ++++ b/drivers/mmc/host/pxamci.c +@@ -798,14 +798,16 @@ static int pxamci_probe(struct platform_ + gpio_direction_output(gpio_power, + host->pdata->gpio_power_invert); + } +- if (gpio_is_valid(gpio_ro)) ++ if (gpio_is_valid(gpio_ro)) { + ret = mmc_gpio_request_ro(mmc, gpio_ro); +- if (ret) { +- dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro); +- goto out; +- } else { +- mmc->caps2 |= host->pdata->gpio_card_ro_invert ? +- 0 : MMC_CAP2_RO_ACTIVE_HIGH; ++ if (ret) { ++ dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", ++ gpio_ro); ++ goto out; ++ } else { ++ mmc->caps2 |= host->pdata->gpio_card_ro_invert ? ++ 0 : MMC_CAP2_RO_ACTIVE_HIGH; ++ } + } + + if (gpio_is_valid(gpio_cd)) diff --git a/queue-4.4/nvmem-declare-nvmem_cell_read-consistently.patch b/queue-4.4/nvmem-declare-nvmem_cell_read-consistently.patch new file mode 100644 index 00000000000..72b9be37b6b --- /dev/null +++ b/queue-4.4/nvmem-declare-nvmem_cell_read-consistently.patch @@ -0,0 +1,36 @@ +From a6c50912508d80164a5e607993b617be85a46d73 Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Thu, 2 Jun 2016 12:05:12 +0100 +Subject: nvmem: Declare nvmem_cell_read() consistently + +From: Guenter Roeck + +commit a6c50912508d80164a5e607993b617be85a46d73 upstream. + +nvmem_cell_read() is declared as void * if CONFIG_NVMEM is enabled, and +as char * otherwise. This can result in a build warning if CONFIG_NVMEM +is not enabled and a caller asigns the result to a type other than char * +without using a typecast. Use a consistent declaration to avoid the +problem. + +Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.") +Cc: Srinivas Kandagatla +Signed-off-by: Guenter Roeck +Signed-off-by: Srinivas Kandagatla +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/nvmem-consumer.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -74,7 +74,7 @@ static inline void nvmem_cell_put(struct + { + } + +-static inline char *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) ++static inline void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) + { + return ERR_PTR(-ENOSYS); + } diff --git a/queue-4.4/series b/queue-4.4/series index d8fec2fbcab..e066c91b414 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -16,3 +16,9 @@ i40e-avoid-null-pointer-dereference.patch pinctrl-uniphier-fix-.pin_dbg_show-callback.patch pinctrl-flag-strict-is-a-field-in-struct-pinmux_ops.patch drivers-perf-arm_pmu-fix-leak-in-error-path.patch +mmc-pxamci-fix-potential-oops.patch +tools-vm-slabinfo-fix-an-unintentional-printf.patch +ipvs-fix-bind-to-link-local-mcast-ipv6-address-in-backup.patch +nvmem-declare-nvmem_cell_read-consistently.patch +hwmon-adt7411-set-bit-3-in-cfg1-register.patch +spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch diff --git a/queue-4.4/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch b/queue-4.4/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch new file mode 100644 index 00000000000..9d73b5d332e --- /dev/null +++ b/queue-4.4/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch @@ -0,0 +1,40 @@ +From c3ccf357c3d75bd2924e049b6a991f7c0c111068 Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Fri, 5 Aug 2016 10:17:52 +0200 +Subject: spi: sh-msiof: Avoid invalid clock generator parameters + +From: Geert Uytterhoeven + +commit c3ccf357c3d75bd2924e049b6a991f7c0c111068 upstream. + +The conversion from a look-up table to a calculation for clock generator +parameters forgot to take into account that BRDV x 1/1 is valid only if +BRPS is x 1/1 or x 1/2, leading to undefined behavior (e.g. arbitrary +clock rates). + +This limitation is documented for the MSIOF module in all supported +SH/R-Mobile and R-Car Gen2/Gen3 ARM SoCs. + +Tested on r8a7791/koelsch and r8a7795/salvator-x. + +Fixes: 65d5665bb260b034 ("spi: sh-msiof: Update calculation of frequency dividing") +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-sh-msiof.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/spi/spi-sh-msiof.c ++++ b/drivers/spi/spi-sh-msiof.c +@@ -263,6 +263,9 @@ static void sh_msiof_spi_set_clk_regs(st + + for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { + brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); ++ /* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */ ++ if (sh_msiof_spi_div_table[k].div == 1 && brps > 2) ++ continue; + if (brps <= 32) /* max of brdv is 32 */ + break; + } diff --git a/queue-4.4/tools-vm-slabinfo-fix-an-unintentional-printf.patch b/queue-4.4/tools-vm-slabinfo-fix-an-unintentional-printf.patch new file mode 100644 index 00000000000..60c084b10d2 --- /dev/null +++ b/queue-4.4/tools-vm-slabinfo-fix-an-unintentional-printf.patch @@ -0,0 +1,41 @@ +From 2d6a4d64812bb12dda53704943b61a7496d02098 Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 20 Jul 2016 15:45:05 -0700 +Subject: tools/vm/slabinfo: fix an unintentional printf + +From: Dan Carpenter + +commit 2d6a4d64812bb12dda53704943b61a7496d02098 upstream. + +The curly braces are missing here so we print stuff unintentionally. + +Fixes: 9da4714a2d44 ('slub: slabinfo update for cmpxchg handling') +Link: http://lkml.kernel.org/r/20160715211243.GE19522@mwanda +Signed-off-by: Dan Carpenter +Acked-by: Christoph Lameter +Cc: Sergey Senozhatsky +Cc: Colin Ian King +Cc: Laura Abbott +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + tools/vm/slabinfo.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/tools/vm/slabinfo.c ++++ b/tools/vm/slabinfo.c +@@ -510,10 +510,11 @@ static void slab_stats(struct slabinfo * + s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total); + } + +- if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) ++ if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) { + printf("\nCmpxchg_double Looping\n------------------------\n"); + printf("Locked Cmpxchg Double redos %lu\nUnlocked Cmpxchg Double redos %lu\n", + s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail); ++ } + } + + static void report(struct slabinfo *s) -- 2.47.3