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 65FB6C4332F for ; Wed, 2 Nov 2022 03:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbiKBDdt (ORCPT ); Tue, 1 Nov 2022 23:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbiKBDdn (ORCPT ); Tue, 1 Nov 2022 23:33:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1291E6E for ; Tue, 1 Nov 2022 20:33:35 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7B39FB82063 for ; Wed, 2 Nov 2022 03:33:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60FD8C433D6; Wed, 2 Nov 2022 03:33:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667360013; bh=ciVVTn6gTDM5tDj4jildxySdeSiSv4Mmf0D1+y20Cu8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgHcXlq+y05T+BDwEk+uY2/o7afXDIKaKuG43mUiwHCALFtJhFmqR3YKKKJnCngFg HBn7FbLYvpYmeDYlro47Y0vVuBAJC+AzB2R/uGUZk7P9dGIb4XG/CbK+hjIdacauKj p3O5qrAeXqhsuoSS7cc4TgVVKGO2tJD8vlUeY0dE= 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 4.19 45/78] Xen/gntdev: dont ignore kernel unmapping error Date: Wed, 2 Nov 2022 03:34:30 +0100 Message-Id: <20221102022054.316943303@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022052.895556444@linuxfoundation.org> References: <20221102022052.895556444@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 @@ -422,6 +422,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