Commit 39b7b6a6 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

net/sched: cls_flower: reduce fl_change stack size

The new ARP support has pushed the stack size over the edge on ARM,
as there are two large objects on the stack in this function (mask
and tb) and both have now grown a bit more:

net/sched/cls_flower.c: In function 'fl_change':
net/sched/cls_flower.c:928:1: error: the frame size of 1072 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

We can solve this by dynamically allocating one or both of them.
I first tried to do it just for the mask, but that only saved
152 bytes on ARM, while this version just does it for the 'tb'
array, bringing the stack size back down to 664 bytes.

Fixes: 99d31326 ("net/sched: cls_flower: Support matching on ARP")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4a7c9726
...@@ -832,23 +832,31 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -832,23 +832,31 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
struct cls_fl_head *head = rtnl_dereference(tp->root); struct cls_fl_head *head = rtnl_dereference(tp->root);
struct cls_fl_filter *fold = (struct cls_fl_filter *) *arg; struct cls_fl_filter *fold = (struct cls_fl_filter *) *arg;
struct cls_fl_filter *fnew; struct cls_fl_filter *fnew;
struct nlattr *tb[TCA_FLOWER_MAX + 1]; struct nlattr **tb;
struct fl_flow_mask mask = {}; struct fl_flow_mask mask = {};
int err; int err;
if (!tca[TCA_OPTIONS]) if (!tca[TCA_OPTIONS])
return -EINVAL; return -EINVAL;
tb = kcalloc(TCA_FLOWER_MAX + 1, sizeof(struct nlattr *), GFP_KERNEL);
if (!tb)
return -ENOBUFS;
err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], fl_policy); err = nla_parse_nested(tb, TCA_FLOWER_MAX, tca[TCA_OPTIONS], fl_policy);
if (err < 0) if (err < 0)
return err; goto errout_tb;
if (fold && handle && fold->handle != handle) if (fold && handle && fold->handle != handle) {
return -EINVAL; err = -EINVAL;
goto errout_tb;
}
fnew = kzalloc(sizeof(*fnew), GFP_KERNEL); fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
if (!fnew) if (!fnew) {
return -ENOBUFS; err = -ENOBUFS;
goto errout_tb;
}
err = tcf_exts_init(&fnew->exts, TCA_FLOWER_ACT, 0); err = tcf_exts_init(&fnew->exts, TCA_FLOWER_ACT, 0);
if (err < 0) if (err < 0)
...@@ -919,11 +927,14 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -919,11 +927,14 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
list_add_tail_rcu(&fnew->list, &head->filters); list_add_tail_rcu(&fnew->list, &head->filters);
} }
kfree(tb);
return 0; return 0;
errout: errout:
tcf_exts_destroy(&fnew->exts); tcf_exts_destroy(&fnew->exts);
kfree(fnew); kfree(fnew);
errout_tb:
kfree(tb);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment