]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Sun, 12 Jun 2022 13:42:05 +0000 (09:42 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 12 Jun 2022 13:42:05 +0000 (09:42 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/ata-pata_octeon_cf-fix-refcount-leak-in-octeon_cf_pr.patch [new file with mode: 0644]
queue-4.14/drm-imx-fix-compiler-warning-with-gcc-12.patch [new file with mode: 0644]
queue-4.14/net-altera-fix-refcount-leak-in-altera_tse_mdio_crea.patch [new file with mode: 0644]
queue-4.14/net-ipv6-unexport-__init-annotated-seg6_hmac_init.patch [new file with mode: 0644]
queue-4.14/net-mdio-unexport-__init-annotated-mdio_bus_init.patch [new file with mode: 0644]
queue-4.14/net-mlx4_en-fix-wrong-return-value-on-ioctl-eeprom-q.patch [new file with mode: 0644]
queue-4.14/net-xfrm-unexport-__init-annotated-xfrm4_protocol_in.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/sunrpc-fix-the-calculation-of-xdr-end-in-xdr_get_nex.patch [new file with mode: 0644]

diff --git a/queue-4.14/ata-pata_octeon_cf-fix-refcount-leak-in-octeon_cf_pr.patch b/queue-4.14/ata-pata_octeon_cf-fix-refcount-leak-in-octeon_cf_pr.patch
new file mode 100644 (file)
index 0000000..d9dbb83
--- /dev/null
@@ -0,0 +1,52 @@
+From 82ccc26352447aa601a9dfbedd86b09a920629b4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 1 Jun 2022 12:59:26 +0400
+Subject: ata: pata_octeon_cf: Fix refcount leak in octeon_cf_probe
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+[ Upstream commit 10d6bdf532902be1d8aa5900b3c03c5671612aa2 ]
+
+of_find_device_by_node() takes reference, we should use put_device()
+to release it when not need anymore.
+Add missing put_device() to avoid refcount leak.
+
+Fixes: 43f01da0f279 ("MIPS/OCTEON/ata: Convert pata_octeon_cf.c to use device tree.")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
+Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ata/pata_octeon_cf.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
+index ac3b1fda820f..c240d8cbfd41 100644
+--- a/drivers/ata/pata_octeon_cf.c
++++ b/drivers/ata/pata_octeon_cf.c
+@@ -888,12 +888,14 @@ static int octeon_cf_probe(struct platform_device *pdev)
+                               int i;
+                               res_dma = platform_get_resource(dma_dev, IORESOURCE_MEM, 0);
+                               if (!res_dma) {
++                                      put_device(&dma_dev->dev);
+                                       of_node_put(dma_node);
+                                       return -EINVAL;
+                               }
+                               cf_port->dma_base = (u64)devm_ioremap_nocache(&pdev->dev, res_dma->start,
+                                                                        resource_size(res_dma));
+                               if (!cf_port->dma_base) {
++                                      put_device(&dma_dev->dev);
+                                       of_node_put(dma_node);
+                                       return -EINVAL;
+                               }
+@@ -903,6 +905,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
+                                       irq = i;
+                                       irq_handler = octeon_cf_interrupt;
+                               }
++                              put_device(&dma_dev->dev);
+                       }
+                       of_node_put(dma_node);
+               }
+-- 
+2.35.1
+
diff --git a/queue-4.14/drm-imx-fix-compiler-warning-with-gcc-12.patch b/queue-4.14/drm-imx-fix-compiler-warning-with-gcc-12.patch
new file mode 100644 (file)
index 0000000..4a5cab5
--- /dev/null
@@ -0,0 +1,51 @@
+From abc052930f7ae8f7312ef16608218d247444ec83 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 Jun 2022 16:59:29 -0700
+Subject: drm: imx: fix compiler warning with gcc-12
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+[ Upstream commit 7aefd8b53815274f3ef398d370a3c9b27dd9f00c ]
+
+Gcc-12 correctly warned about this code using a non-NULL pointer as a
+truth value:
+
+  drivers/gpu/drm/imx/ipuv3-crtc.c: In function ‘ipu_crtc_disable_planes’:
+  drivers/gpu/drm/imx/ipuv3-crtc.c:72:21: error: the comparison will always evaluate as ‘true’ for the address of ‘plane’ will never be NULL [-Werror=address]
+     72 |                 if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
+        |                     ^
+
+due to the extraneous '&' address-of operator.
+
+Philipp Zabel points out that The mistake had no adverse effect since
+the following condition doesn't actually dereference the NULL pointer,
+but the intent of the code was obviously to check for it, not to take
+the address of the member.
+
+Fixes: eb8c88808c83 ("drm/imx: add deferred plane disabling")
+Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/imx/ipuv3-crtc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
+index 12dd261fc308..628de21c03d2 100644
+--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
++++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
+@@ -72,7 +72,7 @@ static void ipu_crtc_disable_planes(struct ipu_crtc *ipu_crtc,
+       drm_atomic_crtc_state_for_each_plane(plane, old_crtc_state) {
+               if (plane == &ipu_crtc->plane[0]->base)
+                       disable_full = true;
+-              if (&ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
++              if (ipu_crtc->plane[1] && plane == &ipu_crtc->plane[1]->base)
+                       disable_partial = true;
+       }
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-altera-fix-refcount-leak-in-altera_tse_mdio_crea.patch b/queue-4.14/net-altera-fix-refcount-leak-in-altera_tse_mdio_crea.patch
new file mode 100644 (file)
index 0000000..a175bb8
--- /dev/null
@@ -0,0 +1,59 @@
+From cbd6edc6e833f2e1bd185d291ad9d0ffa87907bb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 Jun 2022 08:11:43 +0400
+Subject: net: altera: Fix refcount leak in altera_tse_mdio_create
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+[ Upstream commit 11ec18b1d8d92b9df307d31950dcba0b3dd7283c ]
+
+Every iteration of for_each_child_of_node() decrements
+the reference count of the previous node.
+When break from a for_each_child_of_node() loop,
+we need to explicitly call of_node_put() on the child node when
+not need anymore.
+Add missing of_node_put() to avoid refcount leak.
+
+Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Link: https://lore.kernel.org/r/20220607041144.7553-1-linmq006@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/altera/altera_tse_main.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
+index 691fd194e5ea..1c0f11ec7a83 100644
+--- a/drivers/net/ethernet/altera/altera_tse_main.c
++++ b/drivers/net/ethernet/altera/altera_tse_main.c
+@@ -174,7 +174,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
+       mdio = mdiobus_alloc();
+       if (mdio == NULL) {
+               netdev_err(dev, "Error allocating MDIO bus\n");
+-              return -ENOMEM;
++              ret = -ENOMEM;
++              goto put_node;
+       }
+       mdio->name = ALTERA_TSE_RESOURCE_NAME;
+@@ -191,6 +192,7 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
+                          mdio->id);
+               goto out_free_mdio;
+       }
++      of_node_put(mdio_node);
+       if (netif_msg_drv(priv))
+               netdev_info(dev, "MDIO bus %s: created\n", mdio->id);
+@@ -200,6 +202,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
+ out_free_mdio:
+       mdiobus_free(mdio);
+       mdio = NULL;
++put_node:
++      of_node_put(mdio_node);
+       return ret;
+ }
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-ipv6-unexport-__init-annotated-seg6_hmac_init.patch b/queue-4.14/net-ipv6-unexport-__init-annotated-seg6_hmac_init.patch
new file mode 100644 (file)
index 0000000..e3b8a4e
--- /dev/null
@@ -0,0 +1,52 @@
+From f551e81a6747f68e296185274eb423dcb83018f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Jun 2022 13:53:55 +0900
+Subject: net: ipv6: unexport __init-annotated seg6_hmac_init()
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 5801f064e35181c71857a80ff18af4dbec3c5f5c ]
+
+EXPORT_SYMBOL and __init is a bad combination because the .init.text
+section is freed up after the initialization. Hence, modules cannot
+use symbols annotated __init. The access to a freed symbol may end up
+with kernel panic.
+
+modpost used to detect it, but it has been broken for a decade.
+
+Recently, I fixed modpost so it started to warn it again, then this
+showed up in linux-next builds.
+
+There are two ways to fix it:
+
+  - Remove __init
+  - Remove EXPORT_SYMBOL
+
+I chose the latter for this case because the caller (net/ipv6/seg6.c)
+and the callee (net/ipv6/seg6_hmac.c) belong to the same module.
+It seems an internal function call in ipv6.ko.
+
+Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/seg6_hmac.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
+index 558fe8cc6d43..ad5f8d521402 100644
+--- a/net/ipv6/seg6_hmac.c
++++ b/net/ipv6/seg6_hmac.c
+@@ -405,7 +405,6 @@ int __init seg6_hmac_init(void)
+ {
+       return seg6_hmac_init_algo();
+ }
+-EXPORT_SYMBOL(seg6_hmac_init);
+ int __net_init seg6_hmac_net_init(struct net *net)
+ {
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-mdio-unexport-__init-annotated-mdio_bus_init.patch b/queue-4.14/net-mdio-unexport-__init-annotated-mdio_bus_init.patch
new file mode 100644 (file)
index 0000000..6dcb84c
--- /dev/null
@@ -0,0 +1,54 @@
+From 5c1bf3f918f93cf2bd788c08a103d7bc99272b92 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Jun 2022 13:53:53 +0900
+Subject: net: mdio: unexport __init-annotated mdio_bus_init()
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 35b42dce619701f1300fb8498dae82c9bb1f0263 ]
+
+EXPORT_SYMBOL and __init is a bad combination because the .init.text
+section is freed up after the initialization. Hence, modules cannot
+use symbols annotated __init. The access to a freed symbol may end up
+with kernel panic.
+
+modpost used to detect it, but it has been broken for a decade.
+
+Recently, I fixed modpost so it started to warn it again, then this
+showed up in linux-next builds.
+
+There are two ways to fix it:
+
+  - Remove __init
+  - Remove EXPORT_SYMBOL
+
+I chose the latter for this case because the only in-tree call-site,
+drivers/net/phy/phy_device.c is never compiled as modular.
+(CONFIG_PHYLIB is boolean)
+
+Fixes: 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/phy/mdio_bus.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
+index 7b9480ce21a2..2911648d4669 100644
+--- a/drivers/net/phy/mdio_bus.c
++++ b/drivers/net/phy/mdio_bus.c
+@@ -716,7 +716,6 @@ int __init mdio_bus_init(void)
+       return ret;
+ }
+-EXPORT_SYMBOL_GPL(mdio_bus_init);
+ #if IS_ENABLED(CONFIG_PHYLIB)
+ void mdio_bus_exit(void)
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-mlx4_en-fix-wrong-return-value-on-ioctl-eeprom-q.patch b/queue-4.14/net-mlx4_en-fix-wrong-return-value-on-ioctl-eeprom-q.patch
new file mode 100644 (file)
index 0000000..277d7d2
--- /dev/null
@@ -0,0 +1,38 @@
+From b43274000b941cc966d6baf56dfd42893b00f921 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Jun 2022 14:57:18 +0300
+Subject: net/mlx4_en: Fix wrong return value on ioctl EEPROM query failure
+
+From: Gal Pressman <gal@nvidia.com>
+
+[ Upstream commit f5826c8c9d57210a17031af5527056eefdc2b7eb ]
+
+The ioctl EEPROM query wrongly returns success on read failures, fix
+that by returning the appropriate error code.
+
+Fixes: 7202da8b7f71 ("ethtool, net/mlx4_en: Cable info, get_module_info/eeprom ethtool support")
+Signed-off-by: Gal Pressman <gal@nvidia.com>
+Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
+Link: https://lore.kernel.org/r/20220606115718.14233-1-tariqt@nvidia.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+index 565e1ac241aa..cca7aaf03777 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+@@ -2055,7 +2055,7 @@ static int mlx4_en_get_module_eeprom(struct net_device *dev,
+                       en_err(priv,
+                              "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n",
+                              i, offset, ee->len - i, ret);
+-                      return 0;
++                      return ret;
+               }
+               i += ret;
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-xfrm-unexport-__init-annotated-xfrm4_protocol_in.patch b/queue-4.14/net-xfrm-unexport-__init-annotated-xfrm4_protocol_in.patch
new file mode 100644 (file)
index 0000000..d827c02
--- /dev/null
@@ -0,0 +1,50 @@
+From 6de23f4fd040ee1e05ccc0610942ab84aad4ba3d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 Jun 2022 13:53:54 +0900
+Subject: net: xfrm: unexport __init-annotated xfrm4_protocol_init()
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 4a388f08d8784af48f352193d2b72aaf167a57a1 ]
+
+EXPORT_SYMBOL and __init is a bad combination because the .init.text
+section is freed up after the initialization. Hence, modules cannot
+use symbols annotated __init. The access to a freed symbol may end up
+with kernel panic.
+
+modpost used to detect it, but it has been broken for a decade.
+
+Recently, I fixed modpost so it started to warn it again, then this
+showed up in linux-next builds.
+
+There are two ways to fix it:
+
+  - Remove __init
+  - Remove EXPORT_SYMBOL
+
+I chose the latter for this case because the only in-tree call-site,
+net/ipv4/xfrm4_policy.c is never compiled as modular.
+(CONFIG_XFRM is boolean)
+
+Fixes: 2f32b51b609f ("xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly")
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/xfrm4_protocol.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/net/ipv4/xfrm4_protocol.c b/net/ipv4/xfrm4_protocol.c
+index 8dd0e6ab8606..0e1f5dc2766b 100644
+--- a/net/ipv4/xfrm4_protocol.c
++++ b/net/ipv4/xfrm4_protocol.c
+@@ -297,4 +297,3 @@ void __init xfrm4_protocol_init(void)
+ {
+       xfrm_input_register_afinfo(&xfrm4_input_afinfo);
+ }
+-EXPORT_SYMBOL(xfrm4_protocol_init);
+-- 
+2.35.1
+
index bc99bab5162a5ce9bee223c568409a54867b3f4e..a20ec56a7c9ed85e20f9b36b6275f4d4d4f414ac 100644 (file)
@@ -171,3 +171,11 @@ m68knommu-set-zero_page-to-the-allocated-zeroed-page.patch
 m68knommu-fix-undefined-reference-to-_init_sp.patch
 video-fbdev-pxa3xx-gcu-release-the-resources-correct.patch
 xprtrdma-treat-all-calls-not-a-bcall-when-bc_serv-is.patch
+ata-pata_octeon_cf-fix-refcount-leak-in-octeon_cf_pr.patch
+net-mlx4_en-fix-wrong-return-value-on-ioctl-eeprom-q.patch
+sunrpc-fix-the-calculation-of-xdr-end-in-xdr_get_nex.patch
+net-mdio-unexport-__init-annotated-mdio_bus_init.patch
+net-xfrm-unexport-__init-annotated-xfrm4_protocol_in.patch
+net-ipv6-unexport-__init-annotated-seg6_hmac_init.patch
+net-altera-fix-refcount-leak-in-altera_tse_mdio_crea.patch
+drm-imx-fix-compiler-warning-with-gcc-12.patch
diff --git a/queue-4.14/sunrpc-fix-the-calculation-of-xdr-end-in-xdr_get_nex.patch b/queue-4.14/sunrpc-fix-the-calculation-of-xdr-end-in-xdr_get_nex.patch
new file mode 100644 (file)
index 0000000..bf6d53f
--- /dev/null
@@ -0,0 +1,49 @@
+From 396a477dbfc7d224ce8615c2ad6214a3cac0cfcd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 Jun 2022 16:47:52 -0400
+Subject: SUNRPC: Fix the calculation of xdr->end in
+ xdr_get_next_encode_buffer()
+
+From: Chuck Lever <chuck.lever@oracle.com>
+
+[ Upstream commit 6c254bf3b637dd4ef4f78eb78c7447419c0161d7 ]
+
+I found that NFSD's new NFSv3 READDIRPLUS XDR encoder was screwing up
+right at the end of the page array. xdr_get_next_encode_buffer() does
+not compute the value of xdr->end correctly:
+
+ * The check to see if we're on the final available page in xdr->buf
+   needs to account for the space consumed by @nbytes.
+
+ * The new xdr->end value needs to account for the portion of @nbytes
+   that is to be encoded into the previous buffer.
+
+Fixes: 2825a7f90753 ("nfsd4: allow encoding across page boundaries")
+Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
+Reviewed-by: NeilBrown <neilb@suse.de>
+Reviewed-by: J. Bruce Fields <bfields@fieldses.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sunrpc/xdr.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
+index 87cf0b933f99..51ccde7c1311 100644
+--- a/net/sunrpc/xdr.c
++++ b/net/sunrpc/xdr.c
+@@ -544,7 +544,11 @@ static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
+        */
+       xdr->p = (void *)p + frag2bytes;
+       space_left = xdr->buf->buflen - xdr->buf->len;
+-      xdr->end = (void *)p + min_t(int, space_left, PAGE_SIZE);
++      if (space_left - nbytes >= PAGE_SIZE)
++              xdr->end = (void *)p + PAGE_SIZE;
++      else
++              xdr->end = (void *)p + space_left - frag1bytes;
++
+       xdr->buf->page_len += frag2bytes;
+       xdr->buf->len += nbytes;
+       return p;
+-- 
+2.35.1
+