Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kirjanov <dkirjanov@suse.com>2019-03-21 14:19:49 +0100
committerDenis Kirjanov <dkirjanov@suse.com>2019-03-21 14:19:49 +0100
commitb703244992c3e3f1e29ba42094ba9d51d514cd53 (patch)
tree307408022f8346c154ca3a47d614d4b34e0c6761
parente7cec4a34cd4bc5046297ba05ebb17365b4a20ed (diff)
gro_cells: make sure device is up in gro_cells_receive()
(git-fixes). suse-commit: 07d85fc90ec99381190dd2f4bf7f646b427cd044
-rw-r--r--net/core/gro_cells.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
index 49174de13eca..4a5a2548b1db 100644
--- a/net/core/gro_cells.c
+++ b/net/core/gro_cells.c
@@ -12,22 +12,36 @@ int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
struct gro_cell *cell;
+ int res;
- if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev))
- return netif_rx(skb);
+ rcu_read_lock();
+ if (unlikely(!(dev->flags & IFF_UP)))
+ goto drop;
+
+ if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) {
+ res = netif_rx(skb);
+ goto unlock;
+ }
cell = this_cpu_ptr(gcells->cells);
if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) {
+drop:
atomic_long_inc(&dev->rx_dropped);
kfree_skb(skb);
- return NET_RX_DROP;
+ res = NET_RX_DROP;
+ goto unlock;
}
__skb_queue_tail(&cell->napi_skbs, skb);
if (skb_queue_len(&cell->napi_skbs) == 1)
napi_schedule(&cell->napi);
- return NET_RX_SUCCESS;
+
+ res = NET_RX_SUCCESS;
+
+unlock:
+ rcu_read_unlock();
+ return res;
}
EXPORT_SYMBOL(gro_cells_receive);