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 D8AF4C148; Tue, 29 Apr 2025 17:45:25 +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=1745948725; cv=none; b=qBQlzneGPXqYfjknSQLJx5GKaJJBpPb6pnwYKdHSboKzUo/y40e74XzaJji8X6AuDGhO0mfwf/M7mpNqorYc8oqnREOFH+J/RxKsdzTEZO3Z8p1sqv8/Zi2ZgrgbqGsOOI6UBGAz+L99DvNKFFgO0bPLrbDC227wa9G2nSwQ1sM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745948725; c=relaxed/simple; bh=iWkRD9PNMLwIbsACrj0qXMtAATSkEeqTYUiIbnRUlJA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kb9H5GhE9hNihH59jwhaRP4PDGlPdHdbPcawUtCEzgUdiJWxbbdj4hQnpvRQvEfR6nQiu+0bE64lzLVJ2pFB6Ub17lF0Rw5VwhP2o/J4i6J6b/qqNfv5n6jmtLFKJNpZNw6NcmbhUXU77NCS2cNz0XoaKomtf/DL9ikjmG2bH5A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t5sAIRod; 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="t5sAIRod" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D62FC4CEE3; Tue, 29 Apr 2025 17:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1745948725; bh=iWkRD9PNMLwIbsACrj0qXMtAATSkEeqTYUiIbnRUlJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5sAIRodmYXZDfUobWx8a0rv+mgji/k3rY0jw+NyaxD+LMd8ua0E2EVqOvJhK9Au8 drZwYnTcr65XugoZsqMPwrmZVU9vLdvkaOOne/rqjocNMqIeOWsbXOggUwBpwxQMtG bj42XtbU8Iud19YgGS0OvMSIMtARQHC/k2AbqZew= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Jan Beulich , Juergen Gross Subject: [PATCH 5.15 063/373] xenfs/xensyms: respect hypervisors "next" indication Date: Tue, 29 Apr 2025 18:39:00 +0200 Message-ID: <20250429161125.727210331@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250429161123.119104857@linuxfoundation.org> References: <20250429161123.119104857@linuxfoundation.org> User-Agent: quilt/0.68 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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jan Beulich commit 5c4e79e29a9fe4ea132118ac40c2bc97cfe23077 upstream. The interface specifies the symnum field as an input and output; the hypervisor sets it to the next sequential symbol's index. xensyms_next() incrementing the position explicitly (and xensyms_next_sym() decrementing it to "rewind") is only correct as long as the sequence of symbol indexes is non-sparse. Use the hypervisor-supplied value instead to update the position in xensyms_next(), and use the saved incoming index in xensyms_next_sym(). Cc: stable@kernel.org Fixes: a11f4f0a4e18 ("xen: xensyms support") Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross Message-ID: <15d5e7fa-ec5d-422f-9319-d28bed916349@suse.com> Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xenfs/xensyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/xen/xenfs/xensyms.c +++ b/drivers/xen/xenfs/xensyms.c @@ -48,7 +48,7 @@ static int xensyms_next_sym(struct xensy return -ENOMEM; set_xen_guest_handle(symdata->name, xs->name); - symdata->symnum--; /* Rewind */ + symdata->symnum = symnum; /* Rewind */ ret = HYPERVISOR_platform_op(&xs->op); if (ret < 0) @@ -78,7 +78,7 @@ static void *xensyms_next(struct seq_fil { struct xensyms *xs = (struct xensyms *)m->private; - xs->op.u.symdata.symnum = ++(*pos); + *pos = xs->op.u.symdata.symnum; if (xensyms_next_sym(xs)) return NULL;