Skip to content

Commit 33eb987

Browse files
Eric Dumazetdavem330
authored andcommitted
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>
1 parent b30c516 commit 33eb987

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/bridge/br_netfilter.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,18 @@ static struct dst_ops fake_dst_ops = {
117117
* ipt_REJECT needs it. Future netfilter modules might
118118
* require us to fill additional fields.
119119
*/
120+
static const u32 br_dst_default_metrics[RTAX_MAX] = {
121+
[RTAX_MTU - 1] = 1500,
122+
};
123+
120124
void br_netfilter_rtable_init(struct net_bridge *br)
121125
{
122126
struct rtable *rt = &br->fake_rtable;
123127

124128
atomic_set(&rt->dst.__refcnt, 1);
125129
rt->dst.dev = br->dev;
126130
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);
128132
rt->dst.flags = DST_NOXFRM;
129133
rt->dst.ops = &fake_dst_ops;
130134
}

0 commit comments

Comments
 (0)