History

ipmr: Don't leak memory if fib lookup fails.

This was detected using two mcast router tables. The pimreg for the second interface did not have a specific mrule, so packets received by it were handled by the default table, which had nothing configured. This caused the ipmr_fib_lookup to fail, causing the memory leak.

Ben Greear committed 16 years ago

Commit e40dbc51 parent b0f77d01 file · +6 −2Browse files

Unified · Split

net/ipv4/ipmr.c+6−2
@@ -442,8 +442,10 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) · 441 unmodified lines
442442 int err;
443443
444444 err = ipmr_fib_lookup(net, &fl, &mrt);
445− if (err < 0)
445+ if (err < 0) {
446+ kfree_skb(skb);
446447 return err;
448+ }
447449
448450 read_lock(&mrt_lock);
449451 dev->stats.tx_bytes += skb->len;
@@ -1728,8 +1730,10 @@ int ip_mr_input(struct sk_buff *skb) · 1278 unmodified lines
17281730 goto dont_forward;
17291731
17301732 err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt);
1731− if (err < 0)
1733+ if (err < 0) {
1734+ kfree_skb(skb);
17321735 return err;
1736+ }
17331737
17341738 if (!local) {
17351739 if (IPCB(skb)->opt.router_alert) {