From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 109FC2F12DB; Fri, 17 Oct 2025 15:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760713639; cv=none; b=fwv+S2QQwmml9wPJe8I+wg/RtyWjl3K4dEKC455y9sGWqQtTQRG3uik9nStIRQ4whFd/Lc3cM5SDHedu5bZG+z+Yi5cfsD7o4popwUmQu152EqNBa0lZrDz4u7CJwciiM8v3Q3S+eiZA4TA4qe9hg1Ev9B5FXjig1fhnsJBG0Yw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760713639; c=relaxed/simple; bh=DuVIPxYxzG/64stHdtG1wHzM3Yux7+9/dMnJMFN04Ho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uaoJekgoPFtqMyeTMNT5KJYOeawQfP5+LFWRjPOjJD01ysbgOBkQbYn/SaTH9uRW5pNEsoyTDhThxqwmWrE82xQ88B+XoF1HOI6xlpdGnh4iO7NeDebNsPxREKQlbb239hkrSPcQwy8Uy11EwHyqTCihJ7AkaL8b65Z2yoHxqXs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DhOxi4CH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DhOxi4CH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC5CC4CEFE; Fri, 17 Oct 2025 15:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760713638; bh=DuVIPxYxzG/64stHdtG1wHzM3Yux7+9/dMnJMFN04Ho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DhOxi4CHOPQYTHi+nDZiWTPz2NmVPRJmfmWgWh2UhHMd8SjQjbhMDZ2zWMxz1qcwg t3Oua+4aHYtYqpDUmuY7NNSh9e6EKsBU0yzEnGOtQxCdcONzPCN89mqFoIrP8KgIL9 Gx6xSCy1aXgBerpw8tvQdA4lPc//Msz4Tsdb4iHw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jason Andryuk , Jan Beulich , Juergen Gross Subject: [PATCH 6.6 067/201] xen/events: Cleanup find_virq() return codes Date: Fri, 17 Oct 2025 16:52:08 +0200 Message-ID: <20251017145137.213656740@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145134.710337454@linuxfoundation.org> References: <20251017145134.710337454@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Andryuk commit 08df2d7dd4ab2db8a172d824cda7872d5eca460a upstream. rc is overwritten by the evtchn_status hypercall in each iteration, so the return value will be whatever the last iteration is. This could incorrectly return success even if the event channel was not found. Change to an explicit -ENOENT for an un-found virq and return 0 on a successful match. Fixes: 62cc5fc7b2e0 ("xen/pv-on-hvm kexec: rebind virqs to existing eventchannel ports") Cc: stable@vger.kernel.org Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Message-ID: <20250828003604.8949-2-jason.andryuk@amd.com> Signed-off-by: Greg Kroah-Hartman --- drivers/xen/events/events_base.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -1330,10 +1330,11 @@ static int find_virq(unsigned int virq, { struct evtchn_status status; evtchn_port_t port; - int rc = -ENOENT; memset(&status, 0, sizeof(status)); for (port = 0; port < xen_evtchn_max_channels(); port++) { + int rc; + status.dom = DOMID_SELF; status.port = port; rc = HYPERVISOR_event_channel_op(EVTCHNOP_status, &status); @@ -1343,10 +1344,10 @@ static int find_virq(unsigned int virq, continue; if (status.u.virq == virq && status.vcpu == xen_vcpu_nr(cpu)) { *evtchn = port; - break; + return 0; } } - return rc; + return -ENOENT; } /**