Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2175342iof; Tue, 7 Jun 2022 22:13:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8vhESVmbH+VPoyeJvQN6Wn4hgBYZogO+UpYGbAqDd/Aed7t1eYesGBiut/GaMtdxIW1mm X-Received: by 2002:a17:90b:1a8d:b0:1e8:a809:af4b with SMTP id ng13-20020a17090b1a8d00b001e8a809af4bmr6610177pjb.76.1654665186212; Tue, 07 Jun 2022 22:13:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665186; cv=none; d=google.com; s=arc-20160816; b=Wb8ofUy5xBZBuxB0mTsqmb+euuykxzGSBplLU/eVDb6lz7vM/wdSnyh9PjwHfNJ/yv XDxNPudR3t43Dr4YV1Ae5aVuZtKvcDeoHR+2F72/XzXgS17PNfwRxtuQ6zcWw3CUN0nl nSkvVEYsXCwywhvg1smvutG1KCFUjqQLL6gaqklusHWE2XddyBmC9dxUtpSZPJFqosb/ dnI03GvEFYxaGXLhnKSrQ+akjHJ+4gIdHwlceXJAlTQQldIwuMAF/jgYAgyMHFmHauKc SODeVTCKfjiX7Drgc+67Q6M39WGT+DxmWlo1f4eIM2q39ydsPDorYihfJxWxdY3k5xY9 TLfQ== 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=q/xjo1nrJM9zwtR3s61XUwNFMuNDnZMYZNdQLbRwul0=; b=JnSfKE8H+eaosU2OBHqhXgNegjphG4lwtVG14X+QyfpLf68ujLbsmrjdmK8xQB2UI5 NBuCVlSGNofwARt1cDXrnlL5+6FLiJ1wB0uP4+fRbjo+bdYSMs6xvJh5XG1HZXadc9MY d8fCQBhO/2ty4fy2jhBpHPkcjXJQZKNd+0nae8vTlo+UhL3IkT9b1onkmjmuUo4CUbpf EUnbNRRUe25zaSgO9Qng2c/NqXPfmV2JjxeZggWSmNZOoRWVwJbHA2kZM7XsT7Cs2RGN A9sU8sQhsSBC6jE/ZfGKqX8QW1XY3K5BDf5R2fhafkA0bYw9bo6al9yx4N4AUDq8lKEu j0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdOE6Al3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c7-20020a6566c7000000b003fcd6212317si26325439pgw.304.2022.06.07.22.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:13:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdOE6Al3; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C91540F269; Tue, 7 Jun 2022 21:43:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348988AbiFGSIw (ORCPT + 99 others); Tue, 7 Jun 2022 14:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348811AbiFGRuK (ORCPT ); Tue, 7 Jun 2022 13:50:10 -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 B261B136E84; Tue, 7 Jun 2022 10:37:28 -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 91A65B822AD; Tue, 7 Jun 2022 17:37:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03666C385A5; Tue, 7 Jun 2022 17:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623445; bh=dH0S1Yx6zrSM5IxdG+1OP2rxQf/4LsW0I4ixaV6Elkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdOE6Al3rBjr+y1Eu6U5Xl80NJ2c9rCO5QPPL9jCJtjhMVVBTeVZxBPwn5DZpvwSu qxXkTVD4wZfK7JvaLxr7gwCLYWckJ46LPWP8acwlGFA5o31YzesJsii1SG7CqfwrYl bbEHa3f6EiBKHbccNTu5KojTklVwWBvnBat4DNVA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Philipp Zabel , =?UTF-8?q?Guido=20G=C3=BCnther?= Subject: [PATCH 5.10 379/452] drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem Date: Tue, 7 Jun 2022 19:03:56 +0200 Message-Id: <20220607164919.857703213@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Lucas Stach commit e168c25526cd0368af098095c2ded4a008007e1b upstream. When the mapping is already reaped the unmap must be a no-op, as we would otherwise try to remove the mapping twice, corrupting the involved data structures. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach Reviewed-by: Philipp Zabel Tested-by: Guido Günther Acked-by: Guido Günther Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c @@ -282,6 +282,12 @@ void etnaviv_iommu_unmap_gem(struct etna mutex_lock(&context->lock); + /* Bail if the mapping has been reaped by another thread */ + if (!mapping->context) { + mutex_unlock(&context->lock); + return; + } + /* If the vram node is on the mm, unmap and remove the node */ if (mapping->vram_node.mm == &context->mm) etnaviv_iommu_remove_mapping(context, mapping);