Commit e40dbc51 authored by Ben Greear's avatar Ben Greear Committed by David S. Miller

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.
Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b0f77d0e
...@@ -442,8 +442,10 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -442,8 +442,10 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
int err; int err;
err = ipmr_fib_lookup(net, &fl, &mrt); err = ipmr_fib_lookup(net, &fl, &mrt);
if (err < 0) if (err < 0) {
kfree_skb(skb);
return err; return err;
}
read_lock(&mrt_lock); read_lock(&mrt_lock);
dev->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
...@@ -1728,8 +1730,10 @@ int ip_mr_input(struct sk_buff *skb) ...@@ -1728,8 +1730,10 @@ int ip_mr_input(struct sk_buff *skb)
goto dont_forward; goto dont_forward;
err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt); err = ipmr_fib_lookup(net, &skb_rtable(skb)->fl, &mrt);
if (err < 0) if (err < 0) {
kfree_skb(skb);
return err; return err;
}
if (!local) { if (!local) {
if (IPCB(skb)->opt.router_alert) { if (IPCB(skb)->opt.router_alert) {
......
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