mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
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>
This commit is contained in:
parent
b30c516f87
commit
33eb9873a2
@ -117,6 +117,10 @@ static struct dst_ops fake_dst_ops = {
|
|||||||
* ipt_REJECT needs it. Future netfilter modules might
|
* ipt_REJECT needs it. Future netfilter modules might
|
||||||
* require us to fill additional fields.
|
* require us to fill additional fields.
|
||||||
*/
|
*/
|
||||||
|
static const u32 br_dst_default_metrics[RTAX_MAX] = {
|
||||||
|
[RTAX_MTU - 1] = 1500,
|
||||||
|
};
|
||||||
|
|
||||||
void br_netfilter_rtable_init(struct net_bridge *br)
|
void br_netfilter_rtable_init(struct net_bridge *br)
|
||||||
{
|
{
|
||||||
struct rtable *rt = &br->fake_rtable;
|
struct rtable *rt = &br->fake_rtable;
|
||||||
@ -124,7 +128,7 @@ void br_netfilter_rtable_init(struct net_bridge *br)
|
|||||||
atomic_set(&rt->dst.__refcnt, 1);
|
atomic_set(&rt->dst.__refcnt, 1);
|
||||||
rt->dst.dev = br->dev;
|
rt->dst.dev = br->dev;
|
||||||
rt->dst.path = &rt->dst;
|
rt->dst.path = &rt->dst;
|
||||||
dst_metric_set(&rt->dst, RTAX_MTU, 1500);
|
dst_init_metrics(&rt->dst, br_dst_default_metrics, true);
|
||||||
rt->dst.flags = DST_NOXFRM;
|
rt->dst.flags = DST_NOXFRM;
|
||||||
rt->dst.ops = &fake_dst_ops;
|
rt->dst.ops = &fake_dst_ops;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user