Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2187154iof; Tue, 7 Jun 2022 22:34:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqglABKfhF40B/r41QT5AZkLoz8Qr3LlB+36i7fK7nIw/azVNcbKtIZpXe9SqbjjE4V+jB X-Received: by 2002:a17:902:8bc2:b0:167:7645:e76a with SMTP id r2-20020a1709028bc200b001677645e76amr15865837plo.115.1654666475346; Tue, 07 Jun 2022 22:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666475; cv=none; d=google.com; s=arc-20160816; b=hTgPoG3A98v7TgGW95e2bjqbTVVgjgot/5BHPdlmT4aZs6JKN459k9RvDgo7gxO09C X52OFtcagISCERn/jCTW8HEgq9cYeRLrGMOfcq/jopi1EYQ4iMMUx/kvusj0bgydWQvI I+LfbHqPkCPR9itkWA/jn+XlGpgIHDaXRMSV7ME6GBPTUfK8iuS6SnUtSZG4f8sSPHYs vQjhNXKIGv4FBxYVg16pAZsIpIl4xfuRWbmqVtJEp2vQ1cm4+9bTzHQkdMtCA4I7PiPn KJj+LKDzZzME/3FE+8tkJRHsOeI46D5+/kKWQglZj+UWwCvTJUX708C0xOeIHqYOjPzB Z2kA== 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=GtaTKektVh80nh9QYjp1jul6rZnm73qH+ESVcNhNz3c=; b=kwq1b8G6E2WipaqsTmOPyIIhN5AzBPIqWJrSjWoLRZ+5KKFlVyC6MVhqrdjoOSfVAF yl3RYv6prswySpK3mFJxo4IJMOxHfgBrvbMr5Q+n6cJc0N5SNR8QkDbr6H+f82RaoHbY M2QkrvYMPcv+jl4kGp5VrxcE39bf/7YjokJ0HgEnrydgM+UpnwlkmX3AIbtDKfhqSrFc wK/s1VKU5iRnDff8/R5QVY6g6E0r96OUCIgcxH+tu2PxrUWAjBpGSmIr91xFiDwYv1a4 9DAsp/Op1+T7JDTeofSyASUSrQbhivy/jLW13lOt6J8tAzuYdUMrOKYylKDQ+ZzjO6dI EAqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t0w4zFan; 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 g8-20020a636b08000000b003daeb2bb972si27195419pgc.699.2022.06.07.22.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:34:35 -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=t0w4zFan; 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 0813B4158A2; Tue, 7 Jun 2022 22:13:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389200AbiFHAfW (ORCPT + 99 others); Tue, 7 Jun 2022 20:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382104AbiFGWVt (ORCPT ); Tue, 7 Jun 2022 18:21:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD79C26ACAF; Tue, 7 Jun 2022 12:22:18 -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 ABE5660906; Tue, 7 Jun 2022 19:22:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2ED3C385A2; Tue, 7 Jun 2022 19:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629725; bh=wROjKPocEJBbittAMQhxhJUUWC4+PmUgeUKiA0tkmOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t0w4zFangu9AY/4utoyv1AKEx/QgHTAlCKYxUqX+Vxyiz7iOOMPQCJEdutYrux/Dh nBtP857psSbBgHUtKx2taykubmg98WmT5wQjsQ42DURH8Bhw9PVORNH1h7WCVSzlQW +yancJFOZMQlYu8sKl1zHFSW11v5BRHywLyJcjp8= 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.18 793/879] drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem Date: Tue, 7 Jun 2022 19:05:11 +0200 Message-Id: <20220607165025.881262493@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 @@ -286,6 +286,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);