]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Apr 2020 11:45:57 +0000 (13:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Apr 2020 11:45:57 +0000 (13:45 +0200)
added patches:
asoc-jz4740-i2s-fix-divider-written-at-incorrect-offset-in-register.patch
ib-hfi1-call-kobject_put-when-kobject_init_and_add-fails.patch
power-supply-axp288_charger-fix-unchecked-return-value.patch
random-always-use-batched-entropy-for-get_random_u-32-64.patch
tools-accounting-getdelays.c-fix-netlink-attribute-length.patch
xen-netfront-fix-mismatched-rtnl_unlock.patch
xen-netfront-update-features-after-registering-netdev.patch

queue-4.4/asoc-jz4740-i2s-fix-divider-written-at-incorrect-offset-in-register.patch [new file with mode: 0644]
queue-4.4/ib-hfi1-call-kobject_put-when-kobject_init_and_add-fails.patch [new file with mode: 0644]
queue-4.4/power-supply-axp288_charger-fix-unchecked-return-value.patch [new file with mode: 0644]
queue-4.4/random-always-use-batched-entropy-for-get_random_u-32-64.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/tools-accounting-getdelays.c-fix-netlink-attribute-length.patch [new file with mode: 0644]
queue-4.4/xen-netfront-fix-mismatched-rtnl_unlock.patch [new file with mode: 0644]
queue-4.4/xen-netfront-update-features-after-registering-netdev.patch [new file with mode: 0644]

diff --git a/queue-4.4/asoc-jz4740-i2s-fix-divider-written-at-incorrect-offset-in-register.patch b/queue-4.4/asoc-jz4740-i2s-fix-divider-written-at-incorrect-offset-in-register.patch
new file mode 100644 (file)
index 0000000..fdb1297
--- /dev/null
@@ -0,0 +1,34 @@
+From 9401d5aa328e64617d87abd59af1c91cace4c3e4 Mon Sep 17 00:00:00 2001
+From: Paul Cercueil <paul@crapouillou.net>
+Date: Fri, 6 Mar 2020 23:29:27 +0100
+Subject: ASoC: jz4740-i2s: Fix divider written at incorrect offset in register
+
+From: Paul Cercueil <paul@crapouillou.net>
+
+commit 9401d5aa328e64617d87abd59af1c91cace4c3e4 upstream.
+
+The 4-bit divider value was written at offset 8, while the jz4740
+programming manual locates it at offset 0.
+
+Fixes: 26b0aad80a86 ("ASoC: jz4740: Add dynamic sampling rate support to jz4740-i2s")
+Signed-off-by: Paul Cercueil <paul@crapouillou.net>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20200306222931.39664-2-paul@crapouillou.net
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/jz4740/jz4740-i2s.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/jz4740/jz4740-i2s.c
++++ b/sound/soc/jz4740/jz4740-i2s.c
+@@ -92,7 +92,7 @@
+ #define JZ_AIC_I2S_STATUS_BUSY BIT(2)
+ #define JZ_AIC_CLK_DIV_MASK 0xf
+-#define I2SDIV_DV_SHIFT 8
++#define I2SDIV_DV_SHIFT 0
+ #define I2SDIV_DV_MASK (0xf << I2SDIV_DV_SHIFT)
+ #define I2SDIV_IDV_SHIFT 8
+ #define I2SDIV_IDV_MASK (0xf << I2SDIV_IDV_SHIFT)
diff --git a/queue-4.4/ib-hfi1-call-kobject_put-when-kobject_init_and_add-fails.patch b/queue-4.4/ib-hfi1-call-kobject_put-when-kobject_init_and_add-fails.patch
new file mode 100644 (file)
index 0000000..29c797c
--- /dev/null
@@ -0,0 +1,78 @@
+From dfb5394f804ed4fcea1fc925be275a38d66712ab Mon Sep 17 00:00:00 2001
+From: Kaike Wan <kaike.wan@intel.com>
+Date: Thu, 26 Mar 2020 12:38:14 -0400
+Subject: IB/hfi1: Call kobject_put() when kobject_init_and_add() fails
+
+From: Kaike Wan <kaike.wan@intel.com>
+
+commit dfb5394f804ed4fcea1fc925be275a38d66712ab upstream.
+
+When kobject_init_and_add() returns an error in the function
+hfi1_create_port_files(), the function kobject_put() is not called for the
+corresponding kobject, which potentially leads to memory leak.
+
+This patch fixes the issue by calling kobject_put() even if
+kobject_init_and_add() fails.
+
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200326163813.21129.44280.stgit@awfm-01.aw.intel.com
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Kaike Wan <kaike.wan@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/rdma/hfi1/sysfs.c |   13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/drivers/staging/rdma/hfi1/sysfs.c
++++ b/drivers/staging/rdma/hfi1/sysfs.c
+@@ -620,7 +620,11 @@ int hfi1_create_port_files(struct ib_dev
+               dd_dev_err(dd,
+                          "Skipping sc2vl sysfs info, (err %d) port %u\n",
+                          ret, port_num);
+-              goto bail;
++              /*
++               * Based on the documentation for kobject_init_and_add(), the
++               * caller should call kobject_put even if this call fails.
++               */
++              goto bail_sc2vl;
+       }
+       kobject_uevent(&ppd->sc2vl_kobj, KOBJ_ADD);
+@@ -630,7 +634,7 @@ int hfi1_create_port_files(struct ib_dev
+               dd_dev_err(dd,
+                          "Skipping sl2sc sysfs info, (err %d) port %u\n",
+                          ret, port_num);
+-              goto bail_sc2vl;
++              goto bail_sl2sc;
+       }
+       kobject_uevent(&ppd->sl2sc_kobj, KOBJ_ADD);
+@@ -640,7 +644,7 @@ int hfi1_create_port_files(struct ib_dev
+               dd_dev_err(dd,
+                          "Skipping vl2mtu sysfs info, (err %d) port %u\n",
+                          ret, port_num);
+-              goto bail_sl2sc;
++              goto bail_vl2mtu;
+       }
+       kobject_uevent(&ppd->vl2mtu_kobj, KOBJ_ADD);
+@@ -651,7 +655,7 @@ int hfi1_create_port_files(struct ib_dev
+               dd_dev_err(dd,
+                "Skipping Congestion Control sysfs info, (err %d) port %u\n",
+                ret, port_num);
+-              goto bail_vl2mtu;
++              goto bail_cc;
+       }
+       kobject_uevent(&ppd->pport_cc_kobj, KOBJ_ADD);
+@@ -691,7 +695,6 @@ bail_sl2sc:
+       kobject_put(&ppd->sl2sc_kobj);
+ bail_sc2vl:
+       kobject_put(&ppd->sc2vl_kobj);
+-bail:
+       return ret;
+ }
diff --git a/queue-4.4/power-supply-axp288_charger-fix-unchecked-return-value.patch b/queue-4.4/power-supply-axp288_charger-fix-unchecked-return-value.patch
new file mode 100644 (file)
index 0000000..f525b9f
--- /dev/null
@@ -0,0 +1,43 @@
+From c3422ad5f84a66739ec6a37251ca27638c85b6be Mon Sep 17 00:00:00 2001
+From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
+Date: Mon, 18 Mar 2019 11:14:39 -0500
+Subject: power: supply: axp288_charger: Fix unchecked return value
+
+From: Gustavo A. R. Silva <gustavo@embeddedor.com>
+
+commit c3422ad5f84a66739ec6a37251ca27638c85b6be upstream.
+
+Currently there is no check on platform_get_irq() return value
+in case it fails, hence never actually reporting any errors and
+causing unexpected behavior when using such value as argument
+for function regmap_irq_get_virq().
+
+Fix this by adding a proper check, a message reporting any errors
+and returning *pirq*
+
+Addresses-Coverity-ID: 1443940 ("Improper use of negative value")
+Fixes: 843735b788a4 ("power: axp288_charger: axp288 charger driver")
+Cc: stable@vger.kernel.org
+Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
+
+---
+ drivers/power/axp288_charger.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/power/axp288_charger.c
++++ b/drivers/power/axp288_charger.c
+@@ -883,6 +883,10 @@ static int axp288_charger_probe(struct p
+       /* Register charger interrupts */
+       for (i = 0; i < CHRG_INTR_END; i++) {
+               pirq = platform_get_irq(info->pdev, i);
++              if (pirq < 0) {
++                      dev_err(&pdev->dev, "Failed to get IRQ: %d\n", pirq);
++                      return pirq;
++              }
+               info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
+               if (info->irq[i] < 0) {
+                       dev_warn(&info->pdev->dev,
diff --git a/queue-4.4/random-always-use-batched-entropy-for-get_random_u-32-64.patch b/queue-4.4/random-always-use-batched-entropy-for-get_random_u-32-64.patch
new file mode 100644 (file)
index 0000000..06ea204
--- /dev/null
@@ -0,0 +1,80 @@
+From 69efea712f5b0489e67d07565aad5c94e09a3e52 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Fri, 21 Feb 2020 21:10:37 +0100
+Subject: random: always use batched entropy for get_random_u{32,64}
+
+From: Jason A. Donenfeld <Jason@zx2c4.com>
+
+commit 69efea712f5b0489e67d07565aad5c94e09a3e52 upstream.
+
+It turns out that RDRAND is pretty slow. Comparing these two
+constructions:
+
+  for (i = 0; i < CHACHA_BLOCK_SIZE; i += sizeof(ret))
+    arch_get_random_long(&ret);
+
+and
+
+  long buf[CHACHA_BLOCK_SIZE / sizeof(long)];
+  extract_crng((u8 *)buf);
+
+it amortizes out to 352 cycles per long for the top one and 107 cycles
+per long for the bottom one, on Coffee Lake Refresh, Intel Core i9-9880H.
+
+And importantly, the top one has the drawback of not benefiting from the
+real rng, whereas the bottom one has all the nice benefits of using our
+own chacha rng. As get_random_u{32,64} gets used in more places (perhaps
+beyond what it was originally intended for when it was introduced as
+get_random_{int,long} back in the md5 monstrosity era), it seems like it
+might be a good thing to strengthen its posture a tiny bit. Doing this
+should only be stronger and not any weaker because that pool is already
+initialized with a bunch of rdrand data (when available). This way, we
+get the benefits of the hardware rng as well as our own rng.
+
+Another benefit of this is that we no longer hit pitfalls of the recent
+stream of AMD bugs in RDRAND. One often used code pattern for various
+things is:
+
+  do {
+       val = get_random_u32();
+  } while (hash_table_contains_key(val));
+
+That recent AMD bug rendered that pattern useless, whereas we're really
+very certain that chacha20 output will give pretty distributed numbers,
+no matter what.
+
+So, this simplification seems better both from a security perspective
+and from a performance perspective.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20200221201037.30231-1-Jason@zx2c4.com
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/random.c |    6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/drivers/char/random.c
++++ b/drivers/char/random.c
+@@ -1824,9 +1824,6 @@ unsigned int get_random_int(void)
+       __u32 *hash;
+       unsigned int ret;
+-      if (arch_get_random_int(&ret))
+-              return ret;
+-
+       hash = get_cpu_var(get_random_int_hash);
+       hash[0] += current->pid + jiffies + random_get_entropy();
+@@ -1846,9 +1843,6 @@ unsigned long get_random_long(void)
+       __u32 *hash;
+       unsigned long ret;
+-      if (arch_get_random_long(&ret))
+-              return ret;
+-
+       hash = get_cpu_var(get_random_int_hash);
+       hash[0] += current->pid + jiffies + random_get_entropy();
index 429fe2219c48ca41d990acdb8cac17d619808fd8..da8a9ba001ab10f347e23c54523984b0fe34866c 100644 (file)
@@ -16,3 +16,10 @@ padata-always-acquire-cpu_hotplug_lock-before-pinst-lock.patch
 mm-mempolicy-require-at-least-one-nodeid-for-mpol_preferred.patch
 net-stmmac-dwmac1000-fix-out-of-bounds-mac-address-reg-setting.patch
 slcan-don-t-transmit-uninitialized-stack-data-in-padding.patch
+random-always-use-batched-entropy-for-get_random_u-32-64.patch
+tools-accounting-getdelays.c-fix-netlink-attribute-length.patch
+power-supply-axp288_charger-fix-unchecked-return-value.patch
+xen-netfront-fix-mismatched-rtnl_unlock.patch
+xen-netfront-update-features-after-registering-netdev.patch
+asoc-jz4740-i2s-fix-divider-written-at-incorrect-offset-in-register.patch
+ib-hfi1-call-kobject_put-when-kobject_init_and_add-fails.patch
diff --git a/queue-4.4/tools-accounting-getdelays.c-fix-netlink-attribute-length.patch b/queue-4.4/tools-accounting-getdelays.c-fix-netlink-attribute-length.patch
new file mode 100644 (file)
index 0000000..88f26bf
--- /dev/null
@@ -0,0 +1,45 @@
+From 4054ab64e29bb05b3dfe758fff3c38a74ba753bb Mon Sep 17 00:00:00 2001
+From: David Ahern <dsahern@kernel.org>
+Date: Wed, 1 Apr 2020 21:02:25 -0700
+Subject: tools/accounting/getdelays.c: fix netlink attribute length
+
+From: David Ahern <dsahern@kernel.org>
+
+commit 4054ab64e29bb05b3dfe758fff3c38a74ba753bb upstream.
+
+A recent change to the netlink code: 6e237d099fac ("netlink: Relax attr
+validation for fixed length types") logs a warning when programs send
+messages with invalid attributes (e.g., wrong length for a u32).  Yafang
+reported this error message for tools/accounting/getdelays.c.
+
+send_cmd() is wrongly adding 1 to the attribute length.  As noted in
+include/uapi/linux/netlink.h nla_len should be NLA_HDRLEN + payload
+length, so drop the +1.
+
+Fixes: 9e06d3f9f6b1 ("per task delay accounting taskstats interface: documentation fix")
+Reported-by: Yafang Shao <laoar.shao@gmail.com>
+Signed-off-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Tested-by: Yafang Shao <laoar.shao@gmail.com>
+Cc: Johannes Berg <johannes@sipsolutions.net>
+Cc: Shailabh Nagar <nagar@watson.ibm.com>
+Cc: <stable@vger.kernel.org>
+Link: http://lkml.kernel.org/r/20200327173111.63922-1-dsahern@kernel.org
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/accounting/getdelays.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/accounting/getdelays.c
++++ b/Documentation/accounting/getdelays.c
+@@ -135,7 +135,7 @@ static int send_cmd(int sd, __u16 nlmsg_
+       msg.g.version = 0x1;
+       na = (struct nlattr *) GENLMSG_DATA(&msg);
+       na->nla_type = nla_type;
+-      na->nla_len = nla_len + 1 + NLA_HDRLEN;
++      na->nla_len = nla_len + NLA_HDRLEN;
+       memcpy(NLA_DATA(na), nla_data, nla_len);
+       msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
diff --git a/queue-4.4/xen-netfront-fix-mismatched-rtnl_unlock.patch b/queue-4.4/xen-netfront-fix-mismatched-rtnl_unlock.patch
new file mode 100644 (file)
index 0000000..91a65f0
--- /dev/null
@@ -0,0 +1,40 @@
+From cb257783c2927b73614b20f915a91ff78aa6f3e8 Mon Sep 17 00:00:00 2001
+From: Ross Lagerwall <ross.lagerwall@citrix.com>
+Date: Thu, 21 Jun 2018 14:00:20 +0100
+Subject: xen-netfront: Fix mismatched rtnl_unlock
+
+From: Ross Lagerwall <ross.lagerwall@citrix.com>
+
+commit cb257783c2927b73614b20f915a91ff78aa6f3e8 upstream.
+
+Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
+Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/xen-netfront.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/xen-netfront.c
++++ b/drivers/net/xen-netfront.c
+@@ -1835,7 +1835,7 @@ static int talk_to_netback(struct xenbus
+       err = xen_net_read_mac(dev, info->netdev->dev_addr);
+       if (err) {
+               xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
+-              goto out;
++              goto out_unlocked;
+       }
+       rtnl_lock();
+@@ -1950,6 +1950,7 @@ abort_transaction_no_dev_fatal:
+       xennet_destroy_queues(info);
+  out:
+       rtnl_unlock();
++out_unlocked:
+       device_unregister(&dev->dev);
+       return err;
+ }
diff --git a/queue-4.4/xen-netfront-update-features-after-registering-netdev.patch b/queue-4.4/xen-netfront-update-features-after-registering-netdev.patch
new file mode 100644 (file)
index 0000000..1af1abb
--- /dev/null
@@ -0,0 +1,51 @@
+From 45c8184c1bed1ca8a7f02918552063a00b909bf5 Mon Sep 17 00:00:00 2001
+From: Ross Lagerwall <ross.lagerwall@citrix.com>
+Date: Thu, 21 Jun 2018 14:00:21 +0100
+Subject: xen-netfront: Update features after registering netdev
+
+From: Ross Lagerwall <ross.lagerwall@citrix.com>
+
+commit 45c8184c1bed1ca8a7f02918552063a00b909bf5 upstream.
+
+Update the features after calling register_netdev() otherwise the
+device features are not set up correctly and it not possible to change
+the MTU of the device. After this change, the features reported by
+ethtool match the device's features before the commit which introduced
+the issue and it is possible to change the device's MTU.
+
+Fixes: f599c64fdf7d ("xen-netfront: Fix race between device setup and open")
+Reported-by: Liam Shepherd <liam@dancer.es>
+Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Nobuhiro Iwamatsu (CIP) <nobuhiro1.iwamatsu@toshiba.co.jp>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/xen-netfront.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/xen-netfront.c
++++ b/drivers/net/xen-netfront.c
+@@ -1982,10 +1982,6 @@ static int xennet_connect(struct net_dev
+       /* talk_to_netback() sets the correct number of queues */
+       num_queues = dev->real_num_tx_queues;
+-      rtnl_lock();
+-      netdev_update_features(dev);
+-      rtnl_unlock();
+-
+       if (dev->reg_state == NETREG_UNINITIALIZED) {
+               err = register_netdev(dev);
+               if (err) {
+@@ -1995,6 +1991,10 @@ static int xennet_connect(struct net_dev
+               }
+       }
++      rtnl_lock();
++      netdev_update_features(dev);
++      rtnl_unlock();
++
+       /*
+        * All public and private state should now be sane.  Get
+        * ready to start sending and receiving packets and give the driver