Commit 57c5d461 authored by Amerigo Wang's avatar Amerigo Wang Committed by David S. Miller

netpoll: take rcu_read_lock_bh() in netpoll_rx()

In __netpoll_rx(), it dereferences ->npinfo without rcu_dereference_bh(),
this patch fixes it by using the 'npinfo' passed from netpoll_rx()
where it is already dereferenced with rcu_dereference_bh().

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3335f0ca
...@@ -52,7 +52,7 @@ void netpoll_set_trap(int trap); ...@@ -52,7 +52,7 @@ void netpoll_set_trap(int trap);
void __netpoll_cleanup(struct netpoll *np); void __netpoll_cleanup(struct netpoll *np);
void __netpoll_free_rcu(struct netpoll *np); void __netpoll_free_rcu(struct netpoll *np);
void netpoll_cleanup(struct netpoll *np); void netpoll_cleanup(struct netpoll *np);
int __netpoll_rx(struct sk_buff *skb); int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
struct net_device *dev); struct net_device *dev);
static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
...@@ -77,7 +77,7 @@ static inline bool netpoll_rx(struct sk_buff *skb) ...@@ -77,7 +77,7 @@ static inline bool netpoll_rx(struct sk_buff *skb)
spin_lock(&npinfo->rx_lock); spin_lock(&npinfo->rx_lock);
/* check rx_flags again with the lock held */ /* check rx_flags again with the lock held */
if (npinfo->rx_flags && __netpoll_rx(skb)) if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
ret = true; ret = true;
spin_unlock(&npinfo->rx_lock); spin_unlock(&npinfo->rx_lock);
......
...@@ -543,13 +543,12 @@ static void arp_reply(struct sk_buff *skb) ...@@ -543,13 +543,12 @@ static void arp_reply(struct sk_buff *skb)
spin_unlock_irqrestore(&npinfo->rx_lock, flags); spin_unlock_irqrestore(&npinfo->rx_lock, flags);
} }
int __netpoll_rx(struct sk_buff *skb) int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
{ {
int proto, len, ulen; int proto, len, ulen;
int hits = 0; int hits = 0;
const struct iphdr *iph; const struct iphdr *iph;
struct udphdr *uh; struct udphdr *uh;
struct netpoll_info *npinfo = skb->dev->npinfo;
struct netpoll *np, *tmp; struct netpoll *np, *tmp;
if (list_empty(&npinfo->rx_np)) if (list_empty(&npinfo->rx_np))
......
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