]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Sep 2019 10:39:30 +0000 (11:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 8 Sep 2019 10:39:30 +0000 (11:39 +0100)
added patches:
net-fix-skb-use-after-free-in-netpoll.patch
net-stmmac-dwmac-rk-don-t-fail-if-phy-regulator-is-absent.patch

queue-4.4/net-fix-skb-use-after-free-in-netpoll.patch [new file with mode: 0644]
queue-4.4/net-stmmac-dwmac-rk-don-t-fail-if-phy-regulator-is-absent.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/net-fix-skb-use-after-free-in-netpoll.patch b/queue-4.4/net-fix-skb-use-after-free-in-netpoll.patch
new file mode 100644 (file)
index 0000000..266b1ec
--- /dev/null
@@ -0,0 +1,90 @@
+From foo@baz Sun 08 Sep 2019 11:16:31 AM WEST
+From: Feng Sun <loyou85@gmail.com>
+Date: Mon, 26 Aug 2019 14:46:04 +0800
+Subject: net: fix skb use after free in netpoll
+
+From: Feng Sun <loyou85@gmail.com>
+
+[ Upstream commit 2c1644cf6d46a8267d79ed95cb9b563839346562 ]
+
+After commit baeababb5b85d5c4e6c917efe2a1504179438d3b
+("tun: return NET_XMIT_DROP for dropped packets"),
+when tun_net_xmit drop packets, it will free skb and return NET_XMIT_DROP,
+netpoll_send_skb_on_dev will run into following use after free cases:
+1. retry netpoll_start_xmit with freed skb;
+2. queue freed skb in npinfo->txq.
+queue_process will also run into use after free case.
+
+hit netpoll_send_skb_on_dev first case with following kernel log:
+
+[  117.864773] kernel BUG at mm/slub.c:306!
+[  117.864773] invalid opcode: 0000 [#1] SMP PTI
+[  117.864774] CPU: 3 PID: 2627 Comm: loop_printmsg Kdump: loaded Tainted: P           OE     5.3.0-050300rc5-generic #201908182231
+[  117.864775] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
+[  117.864775] RIP: 0010:kmem_cache_free+0x28d/0x2b0
+[  117.864781] Call Trace:
+[  117.864781]  ? tun_net_xmit+0x21c/0x460
+[  117.864781]  kfree_skbmem+0x4e/0x60
+[  117.864782]  kfree_skb+0x3a/0xa0
+[  117.864782]  tun_net_xmit+0x21c/0x460
+[  117.864782]  netpoll_start_xmit+0x11d/0x1b0
+[  117.864788]  netpoll_send_skb_on_dev+0x1b8/0x200
+[  117.864789]  __br_forward+0x1b9/0x1e0 [bridge]
+[  117.864789]  ? skb_clone+0x53/0xd0
+[  117.864790]  ? __skb_clone+0x2e/0x120
+[  117.864790]  deliver_clone+0x37/0x50 [bridge]
+[  117.864790]  maybe_deliver+0x89/0xc0 [bridge]
+[  117.864791]  br_flood+0x6c/0x130 [bridge]
+[  117.864791]  br_dev_xmit+0x315/0x3c0 [bridge]
+[  117.864792]  netpoll_start_xmit+0x11d/0x1b0
+[  117.864792]  netpoll_send_skb_on_dev+0x1b8/0x200
+[  117.864792]  netpoll_send_udp+0x2c6/0x3e8
+[  117.864793]  write_msg+0xd9/0xf0 [netconsole]
+[  117.864793]  console_unlock+0x386/0x4e0
+[  117.864793]  vprintk_emit+0x17e/0x280
+[  117.864794]  vprintk_default+0x29/0x50
+[  117.864794]  vprintk_func+0x4c/0xbc
+[  117.864794]  printk+0x58/0x6f
+[  117.864795]  loop_fun+0x24/0x41 [printmsg_loop]
+[  117.864795]  kthread+0x104/0x140
+[  117.864795]  ? 0xffffffffc05b1000
+[  117.864796]  ? kthread_park+0x80/0x80
+[  117.864796]  ret_from_fork+0x35/0x40
+
+Signed-off-by: Feng Sun <loyou85@gmail.com>
+Signed-off-by: Xiaojun Zhao <xiaojunzhao141@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/core/netpoll.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/net/core/netpoll.c
++++ b/net/core/netpoll.c
+@@ -122,7 +122,7 @@ static void queue_process(struct work_st
+               txq = netdev_get_tx_queue(dev, q_index);
+               HARD_TX_LOCK(dev, txq, smp_processor_id());
+               if (netif_xmit_frozen_or_stopped(txq) ||
+-                  netpoll_start_xmit(skb, dev, txq) != NETDEV_TX_OK) {
++                  !dev_xmit_complete(netpoll_start_xmit(skb, dev, txq))) {
+                       skb_queue_head(&npinfo->txq, skb);
+                       HARD_TX_UNLOCK(dev, txq);
+                       local_irq_restore(flags);
+@@ -357,7 +357,7 @@ void netpoll_send_skb_on_dev(struct netp
+                               HARD_TX_UNLOCK(dev, txq);
+-                              if (status == NETDEV_TX_OK)
++                              if (dev_xmit_complete(status))
+                                       break;
+                       }
+@@ -374,7 +374,7 @@ void netpoll_send_skb_on_dev(struct netp
+       }
+-      if (status != NETDEV_TX_OK) {
++      if (!dev_xmit_complete(status)) {
+               skb_queue_tail(&npinfo->txq, skb);
+               schedule_delayed_work(&npinfo->tx_work,0);
+       }
diff --git a/queue-4.4/net-stmmac-dwmac-rk-don-t-fail-if-phy-regulator-is-absent.patch b/queue-4.4/net-stmmac-dwmac-rk-don-t-fail-if-phy-regulator-is-absent.patch
new file mode 100644 (file)
index 0000000..e33c937
--- /dev/null
@@ -0,0 +1,40 @@
+From foo@baz Sun 08 Sep 2019 11:16:31 AM WEST
+From: Chen-Yu Tsai <wens@csie.org>
+Date: Thu, 29 Aug 2019 11:17:24 +0800
+Subject: net: stmmac: dwmac-rk: Don't fail if phy regulator is absent
+
+From: Chen-Yu Tsai <wens@csie.org>
+
+[ Upstream commit 3b25528e1e355c803e73aa326ce657b5606cda73 ]
+
+The devicetree binding lists the phy phy as optional. As such, the
+driver should not bail out if it can't find a regulator. Instead it
+should just skip the remaining regulator related code and continue
+on normally.
+
+Skip the remainder of phy_power_on() if a regulator supply isn't
+available. This also gets rid of the bogus return code.
+
+Fixes: 2e12f536635f ("net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator")
+Signed-off-by: Chen-Yu Tsai <wens@csie.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+@@ -429,10 +429,8 @@ static int phy_power_on(struct rk_priv_d
+       int ret;
+       struct device *dev = &bsp_priv->pdev->dev;
+-      if (!ldo) {
+-              dev_err(dev, "no regulator found\n");
+-              return -1;
+-      }
++      if (!ldo)
++              return 0;
+       if (enable) {
+               ret = regulator_enable(ldo);
index c5c5d9dfb07078b1f5baf591fee0825e06686b8b..a58c24f63d2670bc375e7cf723e963f12e2bb57c 100644 (file)
@@ -19,3 +19,5 @@ spi-bcm2835aux-unifying-code-between-polling-and-int.patch
 spi-bcm2835aux-remove-dangerous-uncontrolled-read-of.patch
 spi-bcm2835aux-fix-corruptions-for-longer-spi-transf.patch
 revert-x86-apic-include-the-ldr-when-clearing-out-ap.patch
+net-fix-skb-use-after-free-in-netpoll.patch
+net-stmmac-dwmac-rk-don-t-fail-if-phy-regulator-is-absent.patch