Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3977187pxb; Tue, 25 Jan 2022 00:28:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyujGjrg2mj+nDWp1tGAsLkcTepYSV65miuiK0hav6iNe5EhJq4aVbaYvRy5UQiBnEhlrg0 X-Received: by 2002:a17:90b:3ec2:: with SMTP id rm2mr2381961pjb.141.1643099288144; Tue, 25 Jan 2022 00:28:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099288; cv=none; d=google.com; s=arc-20160816; b=Vw2zAwAsIkcxEjSY2P8yDiZ0AFyFTvCPjPuQs+8mvHMYCIGDi8OS2RfcLgm9pBQoEr X7XX7vz2hTLmb9EL3zCVXFDiK8znC4avd+nEBfRT6VWs7Y/Qch9pbv8O0fGCH9u1MMo0 k/Q/PxuuSyMo588H665ChYMv3AjIOu7CclIv2LUM8SC6IzjDiwM6+4b8ATdJ0vCv6cBF JnLucbEqbLSn2Kx3thQIxUQRrykYW7sZR9GIFcvi3hbSqJ/qA2g5WBdRvxFg+TZy81IC jzGaZaN5pdYj7fy9Bd10T0T9Xu2It5xbaVYjfvSssd36xsn/Fn5ZbOwW4rx9gpmghoTR uTIw== 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=U7L8PCK6kV37WgErpD1UNX1POgfS2dy/FTvK9qks/w0=; b=GU8i44g+s+R0rpB7zrdlw4ofrclMnv28IfTzOp54B5vVJXR/Y6fCCzsHgwh3v+jNjh G0bt0pwjIKWzAE8wXBHvD5iaA2tU4CbN2QMrQjPWYTTkvuzo6hKo+tKeTMd6cOzX573z 6p+YGEvVmbPMygoDi3ts+d6F7AL4dNQPgIdn6vtJnqkAm937LKshyjWNx9P32KEOxFaV 5HQponeH4Vdw/ZnZRpruLnNJ3CFYKP3fVZIfKlvyEdeNCXnoxU/Uh3ALLUZHuFhYBrvJ DabUEBaAIqJ9TqRIiwHOniNR8RcEpMQkpr8nC7RqHkKqmH4RNtjMjz5oThl01uE/MynE q7OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UwP7hphf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v202si2729425pgb.255.2022.01.25.00.27.56; Tue, 25 Jan 2022 00:28:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UwP7hphf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S3423148AbiAYCdD (ORCPT + 99 others); Mon, 24 Jan 2022 21:33:03 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:60264 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345165AbiAXUWn (ORCPT ); Mon, 24 Jan 2022 15:22:43 -0500 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 A288AB810BD; Mon, 24 Jan 2022 20:22:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2EEFC340E8; Mon, 24 Jan 2022 20:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055752; bh=GDdWL9il9DOHbSzgLE5q3dJC5+8l0Mvknrnk8n4buMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UwP7hphfAVYHNwCp1WwThbjPCIsqL/cXJcuOc9ajsyFCc6uCEi4/QJFE+ubXVnfHW Yl7pZ3P75c/ZYnkbshqoLlm7fSR57bw+IYM9PAxLaRfzX07HWR/5lQNtPzC0K5JG0A Hy5hh5I5sTMB0OYfmC/DeJlHVwPSADJS70vFjujU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Sasha Levin Subject: [PATCH 5.15 221/846] drm/msm/gpu: Dont allow zero fence_id Date: Mon, 24 Jan 2022 19:35:38 +0100 Message-Id: <20220124184108.543206462@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark [ Upstream commit ca3ffcbeb0c866d9b0cb38eaa2bd4416597b5966 ] Elsewhere we treat zero as "no fence" and __msm_gem_submit_destroy() skips removal from fence_idr. We could alternately change this to use negative values for "no fence" but I think it is more clear to not allow zero as a valid fence_id. Signed-off-by: Rob Clark Fixes: a61acbbe9cf8 ("drm/msm: Track "seqno" fences by idr") Link: https://lore.kernel.org/r/20211129182344.292609-1-robdclark@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_gem_submit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index d9aef97eb93ad..7fb7ff043bcd7 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -887,7 +887,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, * to the underlying fence. */ submit->fence_id = idr_alloc_cyclic(&queue->fence_idr, - submit->user_fence, 0, INT_MAX, GFP_KERNEL); + submit->user_fence, 1, INT_MAX, GFP_KERNEL); if (submit->fence_id < 0) { ret = submit->fence_id = 0; submit->fence_id = 0; -- 2.34.1