]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - include/linux/netfilter/x_tables.h
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / include / linux / netfilter / x_tables.h
index 2ad1a2b289b5a57d25a3835e97302dd0db774f90..b4d10155af5418d7b27d7fb4dea67c37fb6b5270 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <linux/netdevice.h>
 #include <linux/static_key.h>
+#include <linux/locallock.h>
 #include <uapi/linux/netfilter/x_tables.h>
 
 /* Test a struct->invflags and a boolean for inequality */
@@ -300,6 +301,8 @@ void xt_free_table_info(struct xt_table_info *info);
  */
 DECLARE_PER_CPU(seqcount_t, xt_recseq);
 
+DECLARE_LOCAL_IRQ_LOCK(xt_write_lock);
+
 /* xt_tee_enabled - true if x_tables needs to handle reentrancy
  *
  * Enabled if current ip(6)tables ruleset has at least one -j TEE rule.
@@ -320,6 +323,9 @@ static inline unsigned int xt_write_recseq_begin(void)
 {
        unsigned int addend;
 
+       /* RT protection */
+       local_lock(xt_write_lock);
+
        /*
         * Low order bit of sequence is set if we already
         * called xt_write_recseq_begin().
@@ -350,6 +356,7 @@ static inline void xt_write_recseq_end(unsigned int addend)
        /* this is kind of a write_seqcount_end(), but addend is 0 or 1 */
        smp_wmb();
        __this_cpu_add(xt_recseq.sequence, addend);
+       local_unlock(xt_write_lock);
 }
 
 /*