summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch')
-rw-r--r--debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch b/debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch
new file mode 100644
index 000000000..df8a062a3
--- /dev/null
+++ b/debian/patches-rt/0288-net-xfrm-Use-sequence-counter-with-associated-spinlo.patch
@@ -0,0 +1,43 @@
+From 97138dbb6886695284b96e3680f1533beae6e43a Mon Sep 17 00:00:00 2001
+From: "Ahmed S. Darwish" <a.darwish@linutronix.de>
+Date: Tue, 16 Mar 2021 11:56:30 +0100
+Subject: [PATCH 288/323] net: xfrm: Use sequence counter with associated
+ spinlock
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.10/older/patches-5.10.204-rt100.tar.xz
+
+A sequence counter write section must be serialized or its internal
+state can get corrupted. A plain seqcount_t does not contain the
+information of which lock must be held to guaranteee write side
+serialization.
+
+For xfrm_state_hash_generation, use seqcount_spinlock_t instead of plain
+seqcount_t. This allows to associate the spinlock used for write
+serialization with the sequence counter. It thus enables lockdep to
+verify that the write serialization lock is indeed held before entering
+the sequence counter write section.
+
+If lockdep is disabled, this lock association is compiled out and has
+neither storage size nor runtime overhead.
+
+Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+---
+ include/net/netns/xfrm.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
+index 7b87da22b295..fef22e029c0d 100644
+--- a/include/net/netns/xfrm.h
++++ b/include/net/netns/xfrm.h
+@@ -77,7 +77,7 @@ struct netns_xfrm {
+ struct dst_ops xfrm6_dst_ops;
+ #endif
+ spinlock_t xfrm_state_lock;
+- seqcount_t xfrm_state_hash_generation;
++ seqcount_spinlock_t xfrm_state_hash_generation;
+ seqcount_spinlock_t xfrm_policy_hash_generation;
+
+ spinlock_t xfrm_policy_lock;
+--
+2.43.0
+