From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DA17C43217 for ; Wed, 2 Nov 2022 03:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbiKBDXJ (ORCPT ); Tue, 1 Nov 2022 23:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbiKBDWo (ORCPT ); Tue, 1 Nov 2022 23:22:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8588B25C50 for ; Tue, 1 Nov 2022 20:22:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 20B53617BF for ; Wed, 2 Nov 2022 03:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6F0DC433D6; Wed, 2 Nov 2022 03:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667359356; bh=tn4ALnfGZ9tlExoMDg9CF8u2RZB2QCp6oezOKdgmiCE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BgPFiH/9gMopE8PeTTpL+tUVet7MABZewJnhQcAqXlUoi1LF2KHd7QymwnY2cwayq L3Vq9r7xONxsq+VPAeQ4hV1PI7EiVVdRRxN7GIpBgn2nveSzO2fDkG7gg4dXFH5ois oGgxE8f4x0TAs4RneI770X/sRKT2BvZCcm7ZBJAA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Beulich , Juergen Gross , Demi Marie Obenour Subject: [PATCH 5.4 26/64] Xen/gntdev: dont ignore kernel unmapping error Date: Wed, 2 Nov 2022 03:33:52 +0100 Message-Id: <20221102022052.658454781@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022051.821538553@linuxfoundation.org> References: <20221102022051.821538553@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jan Beulich commit f28347cc66395e96712f5c2db0a302ee75bafce6 upstream. While working on XSA-361 and its follow-ups, I failed to spot another place where the kernel mapping part of an operation was not treated the same as the user space part. Detect and propagate errors and add a 2nd pr_debug(). Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/c2513395-74dc-aea3-9192-fd265aa44e35@suse.com Signed-off-by: Juergen Gross Signed-off-by: Demi Marie Obenour Co-authored-by: Demi Marie Obenour Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -419,6 +419,14 @@ static void __unmap_grant_pages_done(int map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status); map->unmap_ops[offset+i].handle = -1; + if (use_ptemod) { + WARN_ON(map->kunmap_ops[offset+i].status && + map->kunmap_ops[offset+i].handle != -1); + pr_debug("kunmap handle=%u st=%d\n", + map->kunmap_ops[offset+i].handle, + map->kunmap_ops[offset+i].status); + map->kunmap_ops[offset+i].handle = -1; + } } /* * Decrease the live-grant counter. This must happen after the loop to