Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp479365imn; Wed, 27 Jul 2022 11:20:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUujDGzqQHpCLmJpROiVBOX57Y+TuQdpr2BXRveQZe0o1tNj64uS9kT24T9iVARxkEidiB X-Received: by 2002:a17:906:9b14:b0:72b:97ac:c30c with SMTP id eo20-20020a1709069b1400b0072b97acc30cmr18755998ejc.588.1658946054542; Wed, 27 Jul 2022 11:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946054; cv=none; d=google.com; s=arc-20160816; b=d9DoEfAoj6QM6TTJuOnHkoXmj65F/aBkrg2GwfelRqt5eKL6KfUTc5PpsrtRLog2qb MZsVzXoMs9tChmszNlrDjStIve6TTVroOOtjo+AHSvieZwuJ48UTUhUJQdl/uHcOzkWz CeIHJE0M6CH/RWVdIydfM8Jj4p/ACGkzykf02dIxmxFfVu0JVPyC75o2ANDpAUcaV/iU FUnajhbqW7ukhBiohvkM/4FbE9uPRkqHa52eA0oL1i8O9ixsQ2pJViK4orC9L0fQPGdl /mfszPoE26ODeEt3+6SVJCmpHYdjQ6weVdWkhsTTeUbNWBTwNgGCluFS9QaWTBOdQbX1 UIyA== 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=C6fJtjrxnEHGYtnVzqNAtC+sJ7l2IwHswvFCQvilenA=; b=uNWhjxg9GxP/aGlZnufO0pDTvJpw1KzayHaoczezvexta0f2QvPYEXPMSLk909o0+B la2su02Zl9hfUtTSqTRIfCoTpNMZPKGR70Leb2YG32iPSd3yg8d/TdRUOKKdJg3WWvnN bgQ++jiEZfHxTWORb2KHoc0Bif46TDeKKVJP/e8e4jtocnH7499NyUaEFUZB1Nyrvbv1 pc21sJYBJmaHYd9fuRZ/FtEoDkNTZwDJgw0HIFXizatdXRkFkTDa0shgyvV4xEVcSPZE F69l9tReBmd1uCOOv+YKEzKecq/n3vTaRQyP+q3Ob245Qm6SjRsO0+xRtHvtudAH/8Jj qECw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i5rvaMoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dk1-20020a170906f0c100b00711f4c750basi17108118ejb.940.2022.07.27.11.20.29; Wed, 27 Jul 2022 11:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i5rvaMoH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S237555AbiG0Qao (ORCPT + 99 others); Wed, 27 Jul 2022 12:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235743AbiG0QaJ (ORCPT ); Wed, 27 Jul 2022 12:30:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DB42205D8; Wed, 27 Jul 2022 09:25:12 -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 3C1A061A00; Wed, 27 Jul 2022 16:25:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DD8EC433B5; Wed, 27 Jul 2022 16:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939102; bh=XMG+02M3UD6e2ITIRgYttn2ny5b0sKywMMqd2QA8CFY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5rvaMoHbQYvPWjDDT52R2nmS007qDdIoj4AaM/nQt4ccqWq0J4vmzdBjcuJGdgV4 IY/iP+2cWL4bhtf2DaKTXrzfOFU1j/F0qjxbqYMaExmZTtuhmGI3WP7sS4ufp7xaCj FB+w26tOA/I6aYWKisMZNSSmy6r9bU65w/heBb6k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Demi Marie Obenour , Oleksandr Tyshchenko Subject: [PATCH 4.19 02/62] xen/gntdev: Ignore failure to unmap INVALID_GRANT_HANDLE Date: Wed, 27 Jul 2022 18:10:11 +0200 Message-Id: <20220727161004.261003054@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161004.175638564@linuxfoundation.org> References: <20220727161004.175638564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Demi Marie Obenour commit 166d3863231667c4f64dee72b77d1102cdfad11f upstream. The error paths of gntdev_mmap() can call unmap_grant_pages() even though not all of the pages have been successfully mapped. This will trigger the WARN_ON()s in __unmap_grant_pages_done(). The number of warnings can be very large; I have observed thousands of lines of warnings in the systemd journal. Avoid this problem by only warning on unmapping failure if the handle being unmapped is not INVALID_GRANT_HANDLE. The handle field of any page that was not successfully mapped will be INVALID_GRANT_HANDLE, so this catches all cases where unmapping can legitimately fail. Fixes: dbe97cff7dd9 ("xen/gntdev: Avoid blocking in unmap_grant_pages()") Cc: stable@vger.kernel.org Suggested-by: Juergen Gross Signed-off-by: Demi Marie Obenour Reviewed-by: Oleksandr Tyshchenko Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220710230522.1563-1-demi@invisiblethingslab.com Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -416,7 +416,8 @@ static void __unmap_grant_pages_done(int unsigned int offset = data->unmap_ops - map->unmap_ops; for (i = 0; i < data->count; i++) { - WARN_ON(map->unmap_ops[offset+i].status); + WARN_ON(map->unmap_ops[offset+i].status && + map->unmap_ops[offset+i].handle != -1); pr_debug("unmap handle=%d st=%d\n", map->unmap_ops[offset+i].handle, map->unmap_ops[offset+i].status);