From: Greg Kroah-Hartman Date: Tue, 24 Oct 2017 09:57:56 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v3.18.78~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e47333222e3acfe323c550266c7579420681f2d6;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: cls_api.c-fix-dumping-of-non-existing-actions-stats.patch --- diff --git a/queue-3.18/cls_api.c-fix-dumping-of-non-existing-actions-stats.patch b/queue-3.18/cls_api.c-fix-dumping-of-non-existing-actions-stats.patch new file mode 100644 index 00000000000..b9a468382dc --- /dev/null +++ b/queue-3.18/cls_api.c-fix-dumping-of-non-existing-actions-stats.patch @@ -0,0 +1,56 @@ +From b057df24a7536cce6c372efe9d0e3d1558afedf4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ignacy=20Gaw=C4=99dzki?= + +Date: Tue, 3 Feb 2015 19:05:18 +0100 +Subject: cls_api.c: Fix dumping of non-existing actions' stats. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ignacy Gawędzki + +commit b057df24a7536cce6c372efe9d0e3d1558afedf4 upstream. + +In tcf_exts_dump_stats(), ensure that exts->actions is not empty before +accessing the first element of that list and calling tcf_action_copy_stats() +on it. This fixes some random segvs when adding filters of type "basic" with +no particular action. + +This also fixes the dumping of those "no-action" filters, which more often +than not made calls to tcf_action_copy_stats() fail and consequently netlink +attributes added by the caller to be removed by a call to nla_nest_cancel(). + +Fixes: 33be62715991 ("net_sched: act: use standard struct list_head") +Signed-off-by: Ignacy Gawędzki +Acked-by: Cong Wang +Signed-off-by: David S. Miller +Cc: J Pommnitz +Signed-off-by: Greg Kroah-Hartman + +--- + net/sched/cls_api.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -563,8 +563,9 @@ void tcf_exts_change(struct tcf_proto *t + } + EXPORT_SYMBOL(tcf_exts_change); + +-#define tcf_exts_first_act(ext) \ +- list_first_entry(&(exts)->actions, struct tc_action, list) ++#define tcf_exts_first_act(ext) \ ++ list_first_entry_or_null(&(exts)->actions, \ ++ struct tc_action, list) + + int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) + { +@@ -610,7 +611,7 @@ int tcf_exts_dump_stats(struct sk_buff * + { + #ifdef CONFIG_NET_CLS_ACT + struct tc_action *a = tcf_exts_first_act(exts); +- if (tcf_action_copy_stats(skb, a, 1) < 0) ++ if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0) + return -1; + #endif + return 0; diff --git a/queue-3.18/series b/queue-3.18/series index 2d8543d546b..ad5d9067795 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -14,3 +14,4 @@ bus-mbus-fix-window-size-calculation-for-4gb-windows.patch keys-encrypted-fix-dereference-of-null-user_key_payload.patch lib-digsig-fix-dereference-of-null-user_key_payload.patch keys-don-t-let-add_key-update-an-uninstantiated-key.patch +cls_api.c-fix-dumping-of-non-existing-actions-stats.patch