]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.11-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Mar 2021 06:15:03 +0000 (08:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Mar 2021 06:15:03 +0000 (08:15 +0200)
added patches:
can-dev-move-device-back-to-init-netns-on-owning-netns-delete.patch
ch_ktls-fix-enum-conversion-warning.patch
fs-cachefiles-remove-wait_bit_key-layout-dependency.patch

queue-5.11/can-dev-move-device-back-to-init-netns-on-owning-netns-delete.patch [new file with mode: 0644]
queue-5.11/ch_ktls-fix-enum-conversion-warning.patch [new file with mode: 0644]
queue-5.11/fs-cachefiles-remove-wait_bit_key-layout-dependency.patch [new file with mode: 0644]
queue-5.11/series

diff --git a/queue-5.11/can-dev-move-device-back-to-init-netns-on-owning-netns-delete.patch b/queue-5.11/can-dev-move-device-back-to-init-netns-on-owning-netns-delete.patch
new file mode 100644 (file)
index 0000000..cc36e6e
--- /dev/null
@@ -0,0 +1,96 @@
+From 3a5ca857079ea022e0b1b17fc154f7ad7dbc150f Mon Sep 17 00:00:00 2001
+From: Martin Willi <martin@strongswan.org>
+Date: Tue, 2 Mar 2021 13:24:23 +0100
+Subject: can: dev: Move device back to init netns on owning netns delete
+
+From: Martin Willi <martin@strongswan.org>
+
+commit 3a5ca857079ea022e0b1b17fc154f7ad7dbc150f upstream.
+
+When a non-initial netns is destroyed, the usual policy is to delete
+all virtual network interfaces contained, but move physical interfaces
+back to the initial netns. This keeps the physical interface visible
+on the system.
+
+CAN devices are somewhat special, as they define rtnl_link_ops even
+if they are physical devices. If a CAN interface is moved into a
+non-initial netns, destroying that netns lets the interface vanish
+instead of moving it back to the initial netns. default_device_exit()
+skips CAN interfaces due to having rtnl_link_ops set. Reproducer:
+
+  ip netns add foo
+  ip link set can0 netns foo
+  ip netns delete foo
+
+WARNING: CPU: 1 PID: 84 at net/core/dev.c:11030 ops_exit_list+0x38/0x60
+CPU: 1 PID: 84 Comm: kworker/u4:2 Not tainted 5.10.19 #1
+Workqueue: netns cleanup_net
+[<c010e700>] (unwind_backtrace) from [<c010a1d8>] (show_stack+0x10/0x14)
+[<c010a1d8>] (show_stack) from [<c086dc10>] (dump_stack+0x94/0xa8)
+[<c086dc10>] (dump_stack) from [<c086b938>] (__warn+0xb8/0x114)
+[<c086b938>] (__warn) from [<c086ba10>] (warn_slowpath_fmt+0x7c/0xac)
+[<c086ba10>] (warn_slowpath_fmt) from [<c0629f20>] (ops_exit_list+0x38/0x60)
+[<c0629f20>] (ops_exit_list) from [<c062a5c4>] (cleanup_net+0x230/0x380)
+[<c062a5c4>] (cleanup_net) from [<c0142c20>] (process_one_work+0x1d8/0x438)
+[<c0142c20>] (process_one_work) from [<c0142ee4>] (worker_thread+0x64/0x5a8)
+[<c0142ee4>] (worker_thread) from [<c0148a98>] (kthread+0x148/0x14c)
+[<c0148a98>] (kthread) from [<c0100148>] (ret_from_fork+0x14/0x2c)
+
+To properly restore physical CAN devices to the initial netns on owning
+netns exit, introduce a flag on rtnl_link_ops that can be set by drivers.
+For CAN devices setting this flag, default_device_exit() considers them
+non-virtual, applying the usual namespace move.
+
+The issue was introduced in the commit mentioned below, as at that time
+CAN devices did not have a dellink() operation.
+
+Fixes: e008b5fc8dc7 ("net: Simplfy default_device_exit and improve batching.")
+Link: https://lore.kernel.org/r/20210302122423.872326-1-martin@strongswan.org
+Signed-off-by: Martin Willi <martin@strongswan.org>
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/can/dev.c   |    1 +
+ include/net/rtnetlink.h |    2 ++
+ net/core/dev.c          |    2 +-
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/can/dev.c
++++ b/drivers/net/can/dev.c
+@@ -1255,6 +1255,7 @@ static void can_dellink(struct net_devic
+ static struct rtnl_link_ops can_link_ops __read_mostly = {
+       .kind           = "can",
++      .netns_refund   = true,
+       .maxtype        = IFLA_CAN_MAX,
+       .policy         = can_policy,
+       .setup          = can_setup,
+--- a/include/net/rtnetlink.h
++++ b/include/net/rtnetlink.h
+@@ -33,6 +33,7 @@ static inline int rtnl_msg_family(const
+  *
+  *    @list: Used internally
+  *    @kind: Identifier
++ *    @netns_refund: Physical device, move to init_net on netns exit
+  *    @maxtype: Highest device specific netlink attribute number
+  *    @policy: Netlink policy for device specific attribute validation
+  *    @validate: Optional validation function for netlink/changelink parameters
+@@ -64,6 +65,7 @@ struct rtnl_link_ops {
+       size_t                  priv_size;
+       void                    (*setup)(struct net_device *dev);
++      bool                    netns_refund;
+       unsigned int            maxtype;
+       const struct nla_policy *policy;
+       int                     (*validate)(struct nlattr *tb[],
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -11194,7 +11194,7 @@ static void __net_exit default_device_ex
+                       continue;
+               /* Leave virtual devices for the generic cleanup */
+-              if (dev->rtnl_link_ops)
++              if (dev->rtnl_link_ops && !dev->rtnl_link_ops->netns_refund)
+                       continue;
+               /* Push remaining network devices to init_net */
diff --git a/queue-5.11/ch_ktls-fix-enum-conversion-warning.patch b/queue-5.11/ch_ktls-fix-enum-conversion-warning.patch
new file mode 100644 (file)
index 0000000..36ef2d3
--- /dev/null
@@ -0,0 +1,37 @@
+From 6f235a69e59484e382dc31952025b0308efedc17 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 23 Mar 2021 22:52:50 +0100
+Subject: ch_ktls: fix enum-conversion warning
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 6f235a69e59484e382dc31952025b0308efedc17 upstream.
+
+gcc points out an incorrect enum assignment:
+
+drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c: In function 'chcr_ktls_cpl_set_tcb_rpl':
+drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c:684:22: warning: implicit conversion from 'enum <anonymous>' to 'enum ch_ktls_open_state' [-Wenum-conversion]
+
+This appears harmless, and should apparently use 'CH_KTLS_OPEN_SUCCESS'
+instead of 'false', with the same value '0'.
+
+Fixes: efca3878a5fb ("ch_ktls: Issue if connection offload fails")
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
++++ b/drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
+@@ -727,7 +727,7 @@ static int chcr_ktls_cpl_set_tcb_rpl(str
+               kvfree(tx_info);
+               return 0;
+       }
+-      tx_info->open_state = false;
++      tx_info->open_state = CH_KTLS_OPEN_SUCCESS;
+       spin_unlock(&tx_info->lock);
+       complete(&tx_info->completion);
diff --git a/queue-5.11/fs-cachefiles-remove-wait_bit_key-layout-dependency.patch b/queue-5.11/fs-cachefiles-remove-wait_bit_key-layout-dependency.patch
new file mode 100644 (file)
index 0000000..dd5e108
--- /dev/null
@@ -0,0 +1,64 @@
+From 39f985c8f667c80a3d1eb19d31138032fa36b09e Mon Sep 17 00:00:00 2001
+From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
+Date: Sat, 20 Mar 2021 05:40:38 +0000
+Subject: fs/cachefiles: Remove wait_bit_key layout dependency
+
+From: Matthew Wilcox (Oracle) <willy@infradead.org>
+
+commit 39f985c8f667c80a3d1eb19d31138032fa36b09e upstream.
+
+Cachefiles was relying on wait_page_key and wait_bit_key being the
+same layout, which is fragile.  Now that wait_page_key is exposed in
+the pagemap.h header, we can remove that fragility
+
+A comment on the need to maintain structure layout equivalence was added by
+Linus[1] and that is no longer applicable.
+
+Fixes: 62906027091f ("mm: add PageWaiters indicating tasks are waiting for a page bit")
+Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Tested-by: kafs-testing@auristor.com
+cc: linux-cachefs@redhat.com
+cc: linux-mm@kvack.org
+Link: https://lore.kernel.org/r/20210320054104.1300774-2-willy@infradead.org/
+Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3510ca20ece0150af6b10c77a74ff1b5c198e3e2 [1]
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/cachefiles/rdwr.c    |    7 +++----
+ include/linux/pagemap.h |    1 -
+ 2 files changed, 3 insertions(+), 5 deletions(-)
+
+--- a/fs/cachefiles/rdwr.c
++++ b/fs/cachefiles/rdwr.c
+@@ -24,17 +24,16 @@ static int cachefiles_read_waiter(wait_q
+               container_of(wait, struct cachefiles_one_read, monitor);
+       struct cachefiles_object *object;
+       struct fscache_retrieval *op = monitor->op;
+-      struct wait_bit_key *key = _key;
++      struct wait_page_key *key = _key;
+       struct page *page = wait->private;
+       ASSERT(key);
+       _enter("{%lu},%u,%d,{%p,%u}",
+              monitor->netfs_page->index, mode, sync,
+-             key->flags, key->bit_nr);
++             key->page, key->bit_nr);
+-      if (key->flags != &page->flags ||
+-          key->bit_nr != PG_locked)
++      if (key->page != page || key->bit_nr != PG_locked)
+               return 0;
+       _debug("--- monitor %p %lx ---", page, page->flags);
+--- a/include/linux/pagemap.h
++++ b/include/linux/pagemap.h
+@@ -559,7 +559,6 @@ static inline pgoff_t linear_page_index(
+       return pgoff;
+ }
+-/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c */
+ struct wait_page_key {
+       struct page *page;
+       int bit_nr;
index 6e555f91ae579bc33fcd7528fee54918b02151e1..e52a295237e0fc2ae8582ce6713544e6661dbaa2 100644 (file)
@@ -240,3 +240,6 @@ smb3-fix-cached-file-size-problems-in-duplicate-extents-reflink.patch
 cifs-adjust-key-sizes-and-key-generation-routines-for-aes256-encryption.patch
 locking-mutex-fix-non-debug-version-of-mutex_lock_io_nested.patch
 x86-mem_encrypt-correct-physical-address-calculation-in-__set_clr_pte_enc.patch
+fs-cachefiles-remove-wait_bit_key-layout-dependency.patch
+ch_ktls-fix-enum-conversion-warning.patch
+can-dev-move-device-back-to-init-netns-on-owning-netns-delete.patch