summaryrefslogtreecommitdiff
path: root/drivers/net/xen-netback/hash.c
diff options
context:
space:
mode:
authorIgor Druzhinin <igor.druzhinin@citrix.com>2019-02-28 14:11:26 +0000
committerDavid S. Miller <davem@davemloft.net>2019-02-28 12:50:37 -0800
commita2288d4e355992d369c50c45d017a85f6061ff71 (patch)
tree29c9e1a705304424084678266ea7fec916fe8c6a /drivers/net/xen-netback/hash.c
parent99e87f56b48f490fb16b6e0f74691c1e664dea95 (diff)
xen-netback: don't populate the hash cache on XenBus disconnect
Occasionally, during the disconnection procedure on XenBus which includes hash cache deinitialization there might be some packets still in-flight on other processors. Handling of these packets includes hashing and hash cache population that finally results in hash cache data structure corruption. In order to avoid this we prevent hashing of those packets if there are no queues initialized. In that case RCU protection of queues guards the hash cache as well. Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com> Reviewed-by: Paul Durrant <paul.durrant@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/hash.c')
-rw-r--r--drivers/net/xen-netback/hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c
index 0ccb021f1e78..10d580c3dea3 100644
--- a/drivers/net/xen-netback/hash.c
+++ b/drivers/net/xen-netback/hash.c
@@ -454,6 +454,8 @@ void xenvif_init_hash(struct xenvif *vif)
if (xenvif_hash_cache_size == 0)
return;
+ BUG_ON(vif->hash.cache.count);
+
spin_lock_init(&vif->hash.cache.lock);
INIT_LIST_HEAD(&vif->hash.cache.list);
}