diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-05-24 13:32:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-24 13:32:18 -0400 |
commit | 33eb9873a283a2076f2b5628813d5365ca420ea9 (patch) | |
tree | ae07eb66338204a0995d8cacc32f8242674e5104 /net/bridge | |
parent | b30c516f875004f025f4d10147bde28c5e98466b (diff) |
bridge: initialize fake_rtable metrics
bridge netfilter code uses a fake_rtable, and we must init its _metric
field or risk NULL dereference later.
Ref: https://bugzilla.kernel.org/show_bug.cgi?id=35672
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_netfilter.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index e1f5ec75e91c..3fa123185e89 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -117,6 +117,10 @@ static struct dst_ops fake_dst_ops = { | |||
117 | * ipt_REJECT needs it. Future netfilter modules might | 117 | * ipt_REJECT needs it. Future netfilter modules might |
118 | * require us to fill additional fields. | 118 | * require us to fill additional fields. |
119 | */ | 119 | */ |
120 | static const u32 br_dst_default_metrics[RTAX_MAX] = { | ||
121 | [RTAX_MTU - 1] = 1500, | ||
122 | }; | ||
123 | |||
120 | void br_netfilter_rtable_init(struct net_bridge *br) | 124 | void br_netfilter_rtable_init(struct net_bridge *br) |
121 | { | 125 | { |
122 | struct rtable *rt = &br->fake_rtable; | 126 | struct rtable *rt = &br->fake_rtable; |
@@ -124,7 +128,7 @@ void br_netfilter_rtable_init(struct net_bridge *br) | |||
124 | atomic_set(&rt->dst.__refcnt, 1); | 128 | atomic_set(&rt->dst.__refcnt, 1); |
125 | rt->dst.dev = br->dev; | 129 | rt->dst.dev = br->dev; |
126 | rt->dst.path = &rt->dst; | 130 | rt->dst.path = &rt->dst; |
127 | dst_metric_set(&rt->dst, RTAX_MTU, 1500); | 131 | dst_init_metrics(&rt->dst, br_dst_default_metrics, true); |
128 | rt->dst.flags = DST_NOXFRM; | 132 | rt->dst.flags = DST_NOXFRM; |
129 | rt->dst.ops = &fake_dst_ops; | 133 | rt->dst.ops = &fake_dst_ops; |
130 | } | 134 | } |