Commit 55747a0a authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipmr: __pim_rcv() is called under rcu_read_lock

No need to get a reference on reg_dev and release it, we are in a
rcu_read_lock() protected section.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ddcb4541
...@@ -1805,6 +1805,7 @@ int ip_mr_input(struct sk_buff *skb) ...@@ -1805,6 +1805,7 @@ int ip_mr_input(struct sk_buff *skb)
} }
#ifdef CONFIG_IP_PIMSM #ifdef CONFIG_IP_PIMSM
/* called with rcu_read_lock() */
static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb, static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb,
unsigned int pimlen) unsigned int pimlen)
{ {
...@@ -1826,26 +1827,23 @@ static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb, ...@@ -1826,26 +1827,23 @@ static int __pim_rcv(struct mr_table *mrt, struct sk_buff *skb,
read_lock(&mrt_lock); read_lock(&mrt_lock);
if (mrt->mroute_reg_vif_num >= 0) if (mrt->mroute_reg_vif_num >= 0)
reg_dev = mrt->vif_table[mrt->mroute_reg_vif_num].dev; reg_dev = mrt->vif_table[mrt->mroute_reg_vif_num].dev;
if (reg_dev)
dev_hold(reg_dev);
read_unlock(&mrt_lock); read_unlock(&mrt_lock);
if (reg_dev == NULL) if (reg_dev == NULL)
return 1; return 1;
skb->mac_header = skb->network_header; skb->mac_header = skb->network_header;
skb_pull(skb, (u8*)encap - skb->data); skb_pull(skb, (u8 *)encap - skb->data);
skb_reset_network_header(skb); skb_reset_network_header(skb);
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
skb->ip_summed = 0; skb->ip_summed = CHECKSUM_NONE;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
skb_tunnel_rx(skb, reg_dev); skb_tunnel_rx(skb, reg_dev);
netif_rx(skb); netif_rx(skb);
dev_put(reg_dev);
return 0; return NET_RX_SUCCESS;
} }
#endif #endif
......
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