kernel: pick earlycon regression fixes from the stable-queue.git
[oweals/openwrt.git] / target / linux / generic / pending-3.18 / 610-netfilter_match_bypass_default_checks.patch
index 74be425049eccf6ead1b129b1f4b66433bef225f..b96402fd3ed1c7fcc489d8ba0bed92957be7e643 100644 (file)
@@ -57,9 +57,9 @@
 +      ip_checkdefault(&e->ip);
 +
        j = 0;
+       memset(&mtpar, 0, sizeof(mtpar));
        mtpar.net       = net;
-       mtpar.table     = name;
-@@ -942,6 +970,7 @@ copy_entries_to_user(unsigned int total_
+@@ -943,6 +971,7 @@ copy_entries_to_user(unsigned int total_
        const struct xt_table_info *private = table->private;
        int ret = 0;
        const void *loc_cpu_entry;
  
        counters = alloc_counters(table);
        if (IS_ERR(counters))
-@@ -972,6 +1001,14 @@ copy_entries_to_user(unsigned int total_
-                       ret = -EFAULT;
+@@ -974,6 +1003,14 @@ copy_entries_to_user(unsigned int total_
                        goto free_counters;
                }
-+
 +              flags = e->ip.flags & IPT_F_MASK;
 +              if (copy_to_user(userptr + off
 +                               + offsetof(struct ipt_entry, ip.flags),
 +                      ret = -EFAULT;
 +                      goto free_counters;
 +              }
++
                for (i = sizeof(struct ipt_entry);
                     i < e->target_offset;
+                    i += m->u.match_size) {
+@@ -1380,12 +1417,15 @@ compat_copy_entry_to_user(struct ipt_ent
+       compat_uint_t origsize;
+       const struct xt_entry_match *ematch;
+       int ret = 0;
++      u8 flags = e->ip.flags & IPT_F_MASK;
+       origsize = *size;
+       ce = (struct compat_ipt_entry __user *)*dstptr;
+       if (copy_to_user(ce, e, sizeof(struct ipt_entry)) != 0 ||
+           copy_to_user(&ce->counters, &counters[i],
+-          sizeof(counters[i])) != 0)
++          sizeof(counters[i])) != 0 ||
++          copy_to_user(&ce->ip.flags, &flags,
++          sizeof(flags)) != 0)
+               return -EFAULT;
+       *dstptr += sizeof(struct compat_ipt_entry);