summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch')
-rw-r--r--debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch b/debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch
new file mode 100644
index 000000000..abce9d9d0
--- /dev/null
+++ b/debian/patches-rt/0182-xfrm-Use-sequence-counter-with-associated-spinlock.patch
@@ -0,0 +1,46 @@
+From 17aae888f2940f55065824bd7c267df06be47fbb Mon Sep 17 00:00:00 2001
+From: "Ahmed S. Darwish" <a.darwish@linutronix.de>
+Date: Wed, 10 Jun 2020 12:53:22 +0200
+Subject: [PATCH 182/323] 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 side critical section must be protected by some
+form of locking to serialize writers. A plain seqcount_t does not
+contain the information of which lock must be held when entering a write
+side critical section.
+
+Use the new seqcount_spinlock_t data type, which allows to associate a
+spinlock with the sequence counter. This enables lockdep to verify that
+the spinlock used for writer serialization is held when the write side
+critical section is entered.
+
+If lockdep is disabled this lock association is compiled out and has
+neither storage size nor runtime overhead.
+
+Upstream-status: The xfrm locking used for seqcoun writer serialization
+appears to be broken. If that's the case, a proper fix will need to be
+submitted upstream. (e.g. make the seqcount per network namespace?)
+
+Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ net/xfrm/xfrm_state.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
+index ba73014805a4..14e1f36bdda5 100644
+--- a/net/xfrm/xfrm_state.c
++++ b/net/xfrm/xfrm_state.c
+@@ -2691,7 +2691,8 @@ int __net_init xfrm_state_init(struct net *net)
+ net->xfrm.state_num = 0;
+ INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize);
+ spin_lock_init(&net->xfrm.xfrm_state_lock);
+- seqcount_init(&net->xfrm.xfrm_state_hash_generation);
++ seqcount_spinlock_init(&net->xfrm.xfrm_state_hash_generation,
++ &net->xfrm.xfrm_state_lock);
+ return 0;
+
+ out_byspi:
+--
+2.43.0
+