Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2728306pxj; Mon, 31 May 2021 09:14:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxigaUanlD+eGeuLTwHOWNkkDX8Fkjztep9LRt5ZW++dw+lCqFDDrcnBa/mfRpBMek/e3g8 X-Received: by 2002:a92:d8d0:: with SMTP id l16mr8376379ilo.41.1622477678941; Mon, 31 May 2021 09:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622477678; cv=none; d=google.com; s=arc-20160816; b=MGNzdoxDX3ugranqKA3EkHlr1/FPBwEgGM35jEVRZxUNG1NPpX0TgsAk5Nn28gEv6K 2ltUHU7oDNo/th21ixJrQEy8ilmAosB1grzJraL85BzYDv+5JCK8cd0w9CidWJmj0WZk kJMDFfsZuMOJ7bYUB3A7tRBL5c0jBUl1o2lbAifeJYTnw/npGUT3mh8Hn7z1eHP+1e9i 9OdG7qd5wEkNiXRsH0xCXfep6uNyXIXIpyEhSAQ8IBFov/NWsjR/MH5GaY2DMHdmlIS+ ovYRYX5ongJ3w69BFkXaI7Rb9153PxLcDJe2gCK5u0qNmj8m3jktJyuEF80BJvOWfr5o FPrg== 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=Q/3OS4N4EX2Jq/EiKslZAzaSviY5CpJhcWxmkMNSBis=; b=H+AnEYhTSIFGQUrAfg1UmfYULj9MPwQnw9BvWhD7AvGocut/sVtOsSyzeI+fhmxPwA cC1Gp55WUmGFcv6x4et1b4PJf9h/Tf8GXQYMfY1lvg2VyU8872J54l2CR8CeK/K0Vz09 P/hH0SkVmGV9DwHN9nNa2HHyxK9pM2fTBZ7ljPaD/1utjCCI1jjLvPYYHAG7oBGEtiPL 6nRxpgeh2eYQ6aRYJtOeFl6iYD+JIPsnlxB1SlbXkS7aaYSCSpWZTOywxpwRhdkYjxNU 4zxbMBapTezuoyYyXs/VDIlY7U+Wceu1JivJPoyqsBmqbrPbWXLE4BSInXTaD54TVvpJ pHsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SLaN5hV8; 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 t7si15171710ilm.97.2021.05.31.09.14.25; Mon, 31 May 2021 09:14:38 -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=SLaN5hV8; 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 S234625AbhEaQOw (ORCPT + 99 others); Mon, 31 May 2021 12:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:37972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234141AbhEaOjb (ORCPT ); Mon, 31 May 2021 10:39:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 43ED961C5F; Mon, 31 May 2021 13:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469158; bh=fDSHuxrhJTbpqsPwkMi+VT3J276BLyapjLD2nMJdh4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SLaN5hV8gdrNnyE48re/UhJteyfKeztZSp+Oi3eAm5PhaJlliYngbDc0kroVxnXe1 QYVXgfVc0kMfneCLbrSEJPO5Ab7Ja5Xj9xHKDbHct9LpfA0VFGgJtyALvATvFMNwiv UBbZrGIecLgCsAZp7SepSYua7Pb+OXRVtTDEr86E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shaokun Zhang , Marc Zyngier , Jason Wang , "Michael S. Tsirkin" , Eric Auger , Zhu Lingshan Subject: [PATCH 5.12 090/296] Revert "irqbypass: do not start cons/prod when failed connect" Date: Mon, 31 May 2021 15:12:25 +0200 Message-Id: <20210531130706.924302301@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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: Zhu Lingshan commit e44b49f623c77bee7451f1a82ccfb969c1028ae2 upstream. This reverts commit a979a6aa009f3c99689432e0cdb5402a4463fb88. The reverted commit may cause VM freeze on arm64 with GICv4, where stopping a consumer is implemented by suspending the VM. Should the connect fail, the VM will not be resumed, which is a bit of a problem. It also erroneously calls the producer destructor unconditionally, which is unexpected. Reported-by: Shaokun Zhang Suggested-by: Marc Zyngier Acked-by: Jason Wang Acked-by: Michael S. Tsirkin Reviewed-by: Eric Auger Tested-by: Shaokun Zhang Signed-off-by: Zhu Lingshan [maz: tags and cc-stable, commit message update] Signed-off-by: Marc Zyngier Fixes: a979a6aa009f ("irqbypass: do not start cons/prod when failed connect") Link: https://lore.kernel.org/r/3a2c66d6-6ca0-8478-d24b-61e8e3241b20@hisilicon.com Link: https://lore.kernel.org/r/20210508071152.722425-1-lingshan.zhu@intel.com Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- virt/lib/irqbypass.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) --- a/virt/lib/irqbypass.c +++ b/virt/lib/irqbypass.c @@ -40,21 +40,17 @@ static int __connect(struct irq_bypass_p if (prod->add_consumer) ret = prod->add_consumer(prod, cons); - if (ret) - goto err_add_consumer; - - ret = cons->add_producer(cons, prod); - if (ret) - goto err_add_producer; + if (!ret) { + ret = cons->add_producer(cons, prod); + if (ret && prod->del_consumer) + prod->del_consumer(prod, cons); + } if (cons->start) cons->start(cons); if (prod->start) prod->start(prod); -err_add_producer: - if (prod->del_consumer) - prod->del_consumer(prod, cons); -err_add_consumer: + return ret; }