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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF109C3DA41 for ; Thu, 11 Jul 2024 13:08:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3989B10EA5A; Thu, 11 Jul 2024 13:08:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="jC2jnlXX"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6B4D10EA5A for ; Thu, 11 Jul 2024 13:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=f7Ctq/lLP50wIXaiTDSHG4T4+belqO4CtXtJoZYkhY0=; b=jC2jnlXXh7/1IG97QxPa345X6/ hUQwrKRtgJtkSkgzcvEPaNhqAMUKrgdXnDHVKas3srXe/1KiZapmvZQTd4njoz9ObcAfFAn5zgxHe 1Mkq5W0qlPXuTss5bBfA6fhLT7yWabp7+bzhWnU9PX5bOh0v17VLetT2j4VVQbtzF7juvcw9UXAhg iZMEJk9I3T5BKDBAnXOd62bgmg/x+TaDwHAUo6bBsVQajYTjOzczjtZ4lRB4SLy76OeoHmOunF/p7 UriThI8ZwvoGMOrhQK6WMpx7mop2ourF0dOH5PfbknWg50mjhrEO3KPvh7BOgSELyDMC19NRrPlW6 e4iKxIlA==; Received: from [187.36.213.55] (helo=[192.168.1.212]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1sRtWn-00Dhaq-NS; Thu, 11 Jul 2024 15:08:06 +0200 Message-ID: Date: Thu, 11 Jul 2024 10:07:59 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 04/11] drm/v3d: Validate passed in drm syncobj handles in the timestamp extension To: Tvrtko Ursulin , dri-devel@lists.freedesktop.org Cc: kernel-dev@igalia.com, Tvrtko Ursulin , Iago Toral Quiroga , stable@vger.kernel.org References: <20240711091542.82083-1-tursulin@igalia.com> <20240711091542.82083-5-tursulin@igalia.com> Content-Language: en-US From: =?UTF-8?Q?Ma=C3=ADra_Canal?= Autocrypt: addr=mcanal@igalia.com; keydata= xjMEZIsaeRYJKwYBBAHaRw8BAQdAGU6aY8oojw61KS5rGGMrlcilFqR6p6ID45IZ6ovX0h3N H01haXJhIENhbmFsIDxtY2FuYWxAaWdhbGlhLmNvbT7CjwQTFggANxYhBDMCqFtIvFKVRJZQ hDSPnHLaGFVuBQJkixp5BQkFo5qAAhsDBAsJCAcFFQgJCgsFFgIDAQAACgkQNI+cctoYVW5u GAEAwpaC5rI3wD8zqETKwGVoXd6+AbmGfZuVD40xepy7z/8BAM5w95/oyPsHUqOsg/xUTlNp rlbhA+WWoaOXA3XgR+wCzjgEZIsaeRIKKwYBBAGXVQEFAQEHQGoOK0jgh0IorMAacx6WUUWb s3RLiJYWUU6iNrk5wWUbAwEIB8J+BBgWCAAmFiEEMwKoW0i8UpVEllCENI+cctoYVW4FAmSL GnkFCQWjmoACGwwACgkQNI+cctoYVW6cqwD/Q9R98msvkhgRvi18fzUPFDwwogn+F+gQJJ6o pwpgFkAA/R2zOfla3IT6G3SBoV5ucdpdCpnIXFpQLbmfHK7dXsAC In-Reply-To: <20240711091542.82083-5-tursulin@igalia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 7/11/24 06:15, Tvrtko Ursulin wrote: > From: Tvrtko Ursulin > > If userspace provides an unknown or invalid handle anywhere in the handle > array the rest of the driver will not handle that well. > > Fix it by checking handle was looked up successfully or otherwise fail the > extension by jumping into the existing unwind. I'm not a English-native speaker, but again I need to say that it feels to me that it is something missing in this sentence. I suggested "Fix it by checking if the handle..." > > Signed-off-by: Tvrtko Ursulin Reviewed-by: Maíra Canal Best Regards, - Maíra > Fixes: 9ba0ff3e083f ("drm/v3d: Create a CPU job extension for the timestamp query job") > Cc: Maíra Canal > Cc: Iago Toral Quiroga > Cc: # v6.8+ > --- > drivers/gpu/drm/v3d/v3d_submit.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/v3d_submit.c > index d626c8539b04..e3a00c8394a5 100644 > --- a/drivers/gpu/drm/v3d/v3d_submit.c > +++ b/drivers/gpu/drm/v3d/v3d_submit.c > @@ -498,6 +498,10 @@ v3d_get_cpu_timestamp_query_params(struct drm_file *file_priv, > } > > job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); > + if (!job->timestamp_query.queries[i].syncobj) { > + err = -ENOENT; > + goto error; > + } > } > job->timestamp_query.count = timestamp.count; > > @@ -552,6 +556,10 @@ v3d_get_cpu_reset_timestamp_params(struct drm_file *file_priv, > } > > job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); > + if (!job->timestamp_query.queries[i].syncobj) { > + err = -ENOENT; > + goto error; > + } > } > job->timestamp_query.count = reset.count; > > @@ -616,6 +624,10 @@ v3d_get_cpu_copy_query_results_params(struct drm_file *file_priv, > } > > job->timestamp_query.queries[i].syncobj = drm_syncobj_find(file_priv, sync); > + if (!job->timestamp_query.queries[i].syncobj) { > + err = -ENOENT; > + goto error; > + } > } > job->timestamp_query.count = copy.count; >