[RAMEN9610-19737][MODAP-40430] Fix CFI panic on ip_expire
authordujeonglee <dujeong.lee@samsung.com>
Thu, 5 Sep 2019 01:01:47 +0000 (10:01 +0900)
committerKim Gunho <gunho.kim@samsung.com>
Mon, 9 Sep 2019 11:15:00 +0000 (20:15 +0900)
Change-Id: I678395a3dc85ceb833532379653d2dd2b8670796
Signed-off-by: dujeonglee <dujeong.lee@samsung.com>
Signed-off-by: Kim Gunho <gunho.kim@samsung.com>
include/linux/timer.h [changed mode: 0644->0755]
include/net/inet_frag.h [changed mode: 0644->0755]
net/ipv4/inet_fragment.c [changed mode: 0644->0755]
net/ipv4/ip_fragment.c [changed mode: 0644->0755]
net/ipv6/netfilter/nf_conntrack_reasm.c [changed mode: 0644->0755]
net/ipv6/reassembly.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index e0ea1fe..28d24e1
@@ -7,6 +7,7 @@
 #include <linux/stddef.h>
 #include <linux/debugobjects.h>
 #include <linux/stringify.h>
+#include <linux/version.h>
 
 struct tvec_base;
 
@@ -182,7 +183,6 @@ static inline void timer_setup(struct timer_list *timer,
 
 #define from_timer(var, callback_timer, timer_fieldname) \
        container_of(callback_timer, typeof(*var), timer_fieldname)
-
 /**
  * timer_pending - is a timer pending?
  * @timer: the timer in question
old mode 100644 (file)
new mode 100755 (executable)
index 335cf78..29fc316
@@ -96,7 +96,11 @@ struct inet_frags {
        void                    (*constructor)(struct inet_frag_queue *q,
                                               const void *arg);
        void                    (*destructor)(struct inet_frag_queue *);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+       void                    (*frag_expire)(unsigned long t);
+#else
        void                    (*frag_expire)(struct timer_list *t);
+#endif
        struct kmem_cache       *frags_cachep;
        const char              *frags_cache_name;
        struct rhashtable_params rhash_params;
old mode 100644 (file)
new mode 100755 (executable)
index 6ffee9d..442597c
@@ -172,7 +172,7 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf,
        f->constructor(q, arg);
        add_frag_mem_limit(nf, f->qsize);
 
-       timer_setup(&q->timer, f->frag_expire, 0);
+       timer_setup(&q->timer, (void (*)(struct timer_list *))f->frag_expire, 0);
        spin_lock_init(&q->lock);
        refcount_set(&q->refcnt, 3);
 
old mode 100644 (file)
new mode 100755 (executable)
index d95b32a..7593b15
@@ -183,9 +183,13 @@ static bool frag_expire_skip_icmp(u32 user)
 /*
  * Oops, a fragment queue timed out.  Kill it and send an ICMP reply.
  */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+static void ip_expire(unsigned long t)
+#else
 static void ip_expire(struct timer_list *t)
+#endif
 {
-       struct inet_frag_queue *frag = from_timer(frag, t, timer);
+       struct inet_frag_queue *frag = from_timer(frag, (struct timer_list *)t, timer);
        const struct iphdr *iph;
        struct sk_buff *head = NULL;
        struct net *net;
old mode 100644 (file)
new mode 100755 (executable)
index 237fb04..f459458
@@ -150,9 +150,13 @@ static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
        return 1 << (ipv6_get_dsfield(ipv6h) & INET_ECN_MASK);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+static void nf_ct_frag6_expire(unsigned long t)
+#else
 static void nf_ct_frag6_expire(struct timer_list *t)
+#endif
 {
-       struct inet_frag_queue *frag = from_timer(frag, t, timer);
+       struct inet_frag_queue *frag = from_timer(frag, (struct timer_list *)t, timer);
        struct frag_queue *fq;
        struct net *net;
 
old mode 100644 (file)
new mode 100755 (executable)
index 2a8c680..19ddde7
@@ -134,9 +134,13 @@ out_rcu_unlock:
 }
 EXPORT_SYMBOL(ip6_expire_frag_queue);
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
+static void ip6_frag_expire(unsigned long t)
+#else
 static void ip6_frag_expire(struct timer_list *t)
+#endif
 {
-       struct inet_frag_queue *frag = from_timer(frag, t, timer);
+       struct inet_frag_queue *frag = from_timer(frag, (struct timer_list *)t, timer);
        struct frag_queue *fq;
        struct net *net;