Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2654374pxj; Mon, 31 May 2021 07:29:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH8pgPn0uUb6YFPOowPXyLXItAjXvCp3ECYJBviuEg3YarGsAnzMztQ1Vcmgn7o7Wbx+Bv X-Received: by 2002:a02:6944:: with SMTP id e65mr9314660jac.48.1622471391563; Mon, 31 May 2021 07:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471391; cv=none; d=google.com; s=arc-20160816; b=0yN2E0uhe3H0XU8SSyX1fPZhpIa4kpF0MP+QGsqcCTpCeCAIGaEHL1t7L5Thduk5eU Cuh+e0gJrmnjTFolQSqs9G0IvbMl1ZOBYPIUqiOElvxcOdz0fUFODWaY9Gie3zKMiUCN X4qsLzUUc5R6hiQY4/zs2SKSDeBQfbttsDK38AyyVukgnQ87L3pRzXdyDcvTmX22ZoZW xdI/kw30NrVhobsaS6GF9BwNDrJkPhtqZn5fJnZ25UlbjYhZ484T1UxHCOTAwmujqmcJ JeqxYIeLyqWWTSP6HfHQhVCpjOw/9kVmuwIr2g++r50mI9XSFFRM7t592/e1oip04Ymx QpOw== 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=Tvg8J4SSpcbHxYvtacxk7vdhI+6OiYipTCwFx6FV6qBanLOD/oPR+VLzYAdhoNbmMx AqvA9ZvCHbhzvNoDjjJMAN8MXklYgIfMjvA6VsCgxXRnXfGlyeIKfKoUUtjvO2icLlkM sAzF7pD5/nwc0u27CRx1lWf6O5Z3fzIKwC2bs8ZzjIAPPIWzbmhwGB8qV3D7LtKopcG7 9lwUW6eAQgTz0HzU6KFJ56JvME2PD+YtnxFPbq0oeKgUmp+Sne+U3G2mkI+Gv7aJ1r1L lmI1GBlLSWhAqH+6sX36FtY9g7SWfySRhjQFHUSC9nYGSBm9vetYor8KrbJ2ZEGIznJX qOjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h/1y+nJA"; 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 o21si15161475jat.63.2021.05.31.07.29.38; Mon, 31 May 2021 07:29:51 -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="h/1y+nJA"; 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 S234028AbhEaO3p (ORCPT + 99 others); Mon, 31 May 2021 10:29:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:55082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232211AbhEaNxP (ORCPT ); Mon, 31 May 2021 09:53:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 071696188B; Mon, 31 May 2021 13:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467992; bh=fDSHuxrhJTbpqsPwkMi+VT3J276BLyapjLD2nMJdh4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/1y+nJAcD2yIjkXsrtk+diy1fqEw/DDzHKFXnbaBJwtEhxhnuyLaDkep9sItCkc0 dCTzZeqWD/fL+6DwzqT3Gorx0dyXi/u9z3PZyGsSLq5lYRtV2SlxlusV1BKvFeQpFi MbSU+Hq6WzelaD20ejHyejbtDNIJNKR+V5+dUYY4= 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.10 075/252] Revert "irqbypass: do not start cons/prod when failed connect" Date: Mon, 31 May 2021 15:12:20 +0200 Message-Id: <20210531130700.548488476@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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; }