net: thunderbolt: Unregister ThunderboltIP protocol handler when suspending
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 28 Sep 2018 09:21:17 +0000 (12:21 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:54:07 +0000 (11:54 +0200)
[ Upstream commit 9872760eb7b1d4f6066ad8b560714a5d0a728fdb ]

The XDomain protocol messages may start as soon as Thunderbolt control
channel is started. This means that if the other host starts sending
ThunderboltIP packets early enough they will be passed to the network
driver which then gets confused because its resume hook is not called
yet.

Fix this by unregistering the ThunderboltIP protocol handler when
suspending and registering it back on resume.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/thunderbolt.c

index e0d6760f321951da99e38dd6dc8eb3749848e115..4b5af24139703a474da45227fd86e854da80f22b 100644 (file)
@@ -1285,6 +1285,7 @@ static int __maybe_unused tbnet_suspend(struct device *dev)
                tbnet_tear_down(net, true);
        }
 
+       tb_unregister_protocol_handler(&net->handler);
        return 0;
 }
 
@@ -1293,6 +1294,8 @@ static int __maybe_unused tbnet_resume(struct device *dev)
        struct tb_service *svc = tb_to_service(dev);
        struct tbnet *net = tb_service_get_drvdata(svc);
 
+       tb_register_protocol_handler(&net->handler);
+
        netif_carrier_off(net->dev);
        if (netif_running(net->dev)) {
                netif_device_attach(net->dev);