From patchwork Mon Jul 19 14:52:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 481153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF023C64E6E for ; Mon, 19 Jul 2021 15:31:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F5FA61364 for ; Mon, 19 Jul 2021 15:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238994AbhGSOuX (ORCPT ); Mon, 19 Jul 2021 10:50:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:41930 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344059AbhGSOsj (ORCPT ); Mon, 19 Jul 2021 10:48:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B08BB613EB; Mon, 19 Jul 2021 15:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626708375; bh=3HQ9wMVGRFD8/R5uZMqXYBhCBBu1BfO9S4JiZLoCwT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eE8fZuxuuaOpjeE9YfAiC9VL8hc638+uZ/vVB9PPXSAwhMDT5HRqymSkJQWj6s2Ap nWYNepsENOyICFvkQwKEV9sx5LFF6gXRzLnOd9LNtIijDHoallw5WL0PJAT588aZXN hQcg9vg6hpTOOH6FxWNhzrMbpLx5nItL84OkL4b0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Jason Wang , "Michael S. Tsirkin" , Sasha Levin Subject: [PATCH 4.14 285/315] virtio_net: Fix error handling in virtnet_restore() Date: Mon, 19 Jul 2021 16:52:54 +0200 Message-Id: <20210719144952.807666691@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144942.861561397@linuxfoundation.org> References: <20210719144942.861561397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xie Yongji [ Upstream commit 3f2869cace829fb4b80fc53b3ddaa7f4ba9acbf1 ] Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed. Signed-off-by: Xie Yongji Link: https://lore.kernel.org/r/20210517084516.332-1-xieyongji@bytedance.com Acked-by: Jason Wang Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin --- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 71052d17c9ae..c8abbf81ef52 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2765,8 +2765,11 @@ static __maybe_unused int virtnet_restore(struct virtio_device *vdev) virtnet_set_queues(vi, vi->curr_queue_pairs); err = virtnet_cpu_notif_add(vi); - if (err) + if (err) { + virtnet_freeze_down(vdev); + remove_vq_common(vi); return err; + } return 0; }