From: Sasha Levin Date: Mon, 15 Feb 2021 04:28:17 +0000 (-0500) Subject: Fixes for 4.4 X-Git-Tag: v5.4.99~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf6628817d5c1de60937204cd86512255d40439f;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.4 Signed-off-by: Sasha Levin --- diff --git a/queue-4.4/h8300-fix-preemption-build-ti_pre_count-undefined.patch b/queue-4.4/h8300-fix-preemption-build-ti_pre_count-undefined.patch new file mode 100644 index 00000000000..5466242ebc5 --- /dev/null +++ b/queue-4.4/h8300-fix-preemption-build-ti_pre_count-undefined.patch @@ -0,0 +1,44 @@ +From 43a648727b297d565f9647312289507c171395c8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 12 Feb 2021 20:52:54 -0800 +Subject: h8300: fix PREEMPTION build, TI_PRE_COUNT undefined + +From: Randy Dunlap + +[ Upstream commit ade9679c159d5bbe14fb7e59e97daf6062872e2b ] + +Fix a build error for undefined 'TI_PRE_COUNT' by adding it to +asm-offsets.c. + + h8300-linux-ld: arch/h8300/kernel/entry.o: in function `resume_kernel': (.text+0x29a): undefined reference to `TI_PRE_COUNT' + +Link: https://lkml.kernel.org/r/20210212021650.22740-1-rdunlap@infradead.org +Fixes: df2078b8daa7 ("h8300: Low level entry") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Cc: Yoshinori Sato +Cc: Thomas Gleixner +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + arch/h8300/kernel/asm-offsets.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/h8300/kernel/asm-offsets.c b/arch/h8300/kernel/asm-offsets.c +index dc2d16ce8a0d5..3e33a9844d99a 100644 +--- a/arch/h8300/kernel/asm-offsets.c ++++ b/arch/h8300/kernel/asm-offsets.c +@@ -62,6 +62,9 @@ int main(void) + OFFSET(TI_FLAGS, thread_info, flags); + OFFSET(TI_CPU, thread_info, cpu); + OFFSET(TI_PRE, thread_info, preempt_count); ++#ifdef CONFIG_PREEMPTION ++ DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); ++#endif + + return 0; + } +-- +2.27.0 + diff --git a/queue-4.4/netfilter-xt_recent-fix-attempt-to-update-deleted-en.patch b/queue-4.4/netfilter-xt_recent-fix-attempt-to-update-deleted-en.patch new file mode 100644 index 00000000000..61ce22ae51d --- /dev/null +++ b/queue-4.4/netfilter-xt_recent-fix-attempt-to-update-deleted-en.patch @@ -0,0 +1,66 @@ +From 9fd0c0bf06b7759b2c6016ee5b957e5e9496deb2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Jan 2021 20:57:43 +0100 +Subject: netfilter: xt_recent: Fix attempt to update deleted entry + +From: Jozsef Kadlecsik + +[ Upstream commit b1bdde33b72366da20d10770ab7a49fe87b5e190 ] + +When both --reap and --update flag are specified, there's a code +path at which the entry to be updated is reaped beforehand, +which then leads to kernel crash. Reap only entries which won't be +updated. + +Fixes kernel bugzilla #207773. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=207773 +Reported-by: Reindl Harald +Fixes: 0079c5aee348 ("netfilter: xt_recent: add an entry reaper") +Signed-off-by: Jozsef Kadlecsik +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/xt_recent.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c +index cd53b861a15c1..ffe673c6a2485 100644 +--- a/net/netfilter/xt_recent.c ++++ b/net/netfilter/xt_recent.c +@@ -156,7 +156,8 @@ static void recent_entry_remove(struct recent_table *t, struct recent_entry *e) + /* + * Drop entries with timestamps older then 'time'. + */ +-static void recent_entry_reap(struct recent_table *t, unsigned long time) ++static void recent_entry_reap(struct recent_table *t, unsigned long time, ++ struct recent_entry *working, bool update) + { + struct recent_entry *e; + +@@ -165,6 +166,12 @@ static void recent_entry_reap(struct recent_table *t, unsigned long time) + */ + e = list_entry(t->lru_list.next, struct recent_entry, lru_list); + ++ /* ++ * Do not reap the entry which are going to be updated. ++ */ ++ if (e == working && update) ++ return; ++ + /* + * The last time stamp is the most recent. + */ +@@ -307,7 +314,8 @@ recent_mt(const struct sk_buff *skb, struct xt_action_param *par) + + /* info->seconds must be non-zero */ + if (info->check_set & XT_RECENT_REAP) +- recent_entry_reap(t, time); ++ recent_entry_reap(t, time, e, ++ info->check_set & XT_RECENT_UPDATE && ret); + } + + if (info->check_set & XT_RECENT_SET || +-- +2.27.0 + diff --git a/queue-4.4/series b/queue-4.4/series index 5470862edad..fd24e2ac580 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -12,3 +12,5 @@ squashfs-add-more-sanity-checks-in-id-lookup.patch squashfs-add-more-sanity-checks-in-inode-lookup.patch squashfs-add-more-sanity-checks-in-xattr-id-lookup.patch memblock-do-not-start-bottom-up-allocations-with-ker.patch +netfilter-xt_recent-fix-attempt-to-update-deleted-en.patch +h8300-fix-preemption-build-ti_pre_count-undefined.patch