Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3867384pxv; Mon, 19 Jul 2021 10:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/pEiqQPpoHQ4gipPznSpnvEe2SeiL3BKpLvV3Kz6YftZDwFCKz18hiYEuq4MP2aktdbIU X-Received: by 2002:a17:907:10cc:: with SMTP id rv12mr27940970ejb.339.1626716340307; Mon, 19 Jul 2021 10:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626716340; cv=none; d=google.com; s=arc-20160816; b=NGumTP8ruDBam2MU1/YPKp7nCP3x1PPAG/96NJXhTnJA/CodrO5tD/8T8axKXCOlPK 9fSOzf76BeV9yuH5NjeJ5J4owsygrErs6wRU7ablE9tuHzLFuCP1e0K/9KIxyzNCh4a7 XGzqDtUAT8x0r/2rDEUb0xhBnfG1RKRuJTzjaIpiAcn76AYkoEnO+EbIhpE2Az1SwJWo VZz3iMv0DtuEJsyAvCrkNe1TWrjm47sNSLoqyuGMdmydsINmEgt6LP8RkaNYVkNYGqhQ QBesjchpczuW26jfUA0VjzsywpXxEv3t8+7tEegVpYoZTTLCyejyXaHqS9CcVVwbzoun Palg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VnnaX0rjgj05vGzLkez7SFG0J2x8tP4/ILQbomtEPgY=; b=J0/K8twYPzmWLETCY02z9JRGeRMkvsnS13zj0Mml+cWmGop09aPWFH+Fmhtjy7XhmO 8pq21b0TuF7Uedl/VCsFS4zwvEw+v4+IxidyL4lH311nFf7Whir+dnQ8iX1nz9yU1P+V kyQnORPaSfaiyR2A3nCbEu45zqogIZ3hMF7H6Kn1KwYpzBIuK40M7P2XbJLKITbVUVdv wL3acxQsS3g7spitax1U5sOYnCamwN9BYofxQQf1pH1UYmWlbDq9rLLOkwCke0AnFo7S Tn9ZXpzpFK93X3r7opdjwTHsduBrRPOnedCT/oj/JaemAnES+HRqlTjC8iO7mcHmJgCu VQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ow424QQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id le4si20832539ejb.214.2021.07.19.10.38.37; Mon, 19 Jul 2021 10:39:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ow424QQz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235753AbhGSQ4u (ORCPT + 99 others); Mon, 19 Jul 2021 12:56:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:59504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347551AbhGSPTm (ORCPT ); Mon, 19 Jul 2021 11:19:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15BA061357; Mon, 19 Jul 2021 15:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626710306; bh=WzoAoHM7kOo9W9iaIEIS2CZ1rnG5kd2JuN1rQeZxR5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ow424QQzfVdIFv7P/+s3crWouwUrCa0sHkjLdX5oSz2M3dTTNcnVFjOF+Xx7bPAUF eljtsCrxofr6C/J8SNVTvW8DTr8YfmuDUz8t5AEVQnPPbShGvYp3Xf77JUUe1DUBgC L594L/yxPu/0NHA1FWMynBtesrRiHAKAP4VFQDZ0= 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 5.10 144/243] virtio_net: Fix error handling in virtnet_restore() Date: Mon, 19 Jul 2021 16:52:53 +0200 Message-Id: <20210719144945.560675796@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210719144940.904087935@linuxfoundation.org> References: <20210719144940.904087935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 91e0e6254a01..345a0f51e8d7 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3234,8 +3234,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; } -- 2.30.2