From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77E491BC073; Tue, 27 Aug 2024 15:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724771813; cv=none; b=Hd0Y6z5Pv1GHexi2tt0vXL4iZvMiK+09vQW3V07OAFBKry63Kf8LHzvtZHidDvjgQbYVUX0lTell5TvDvaHlvI/2q5z3PfvA0TLggPr4OkQeorO26Xau5QGhIJFkD6Sd7EXMwZkSHHJqa+PQx8L/e30b2marYvB/KFmqG8n04oU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724771813; c=relaxed/simple; bh=cd/AVjZ49/6TZHlnk2zoCT2Tb1xmRVCWFGdo2fU0aNQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=drtqyg+xetsxVtaWsscoglt/6XfJK4mEGrkGecF28RL+eSiPUthHic+6cwAz9Vf3FXe66cK1RWv4SJYJI39jOTmWci6jTNpD44ryaNFyTIz4zvFeVbfE2GQzaZkq7gSrgdsuCJf11SWQe7Jx3VigElZafpvVxc+K8amU3lDymIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sAQnbJR9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sAQnbJR9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF474C4DE1F; Tue, 27 Aug 2024 15:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724771813; bh=cd/AVjZ49/6TZHlnk2zoCT2Tb1xmRVCWFGdo2fU0aNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sAQnbJR9RDMPR/b3kAdRZjckit/e1H2U2w9cdQrobQ6ggo5b4yw86qpBxAMoWXQ51 VEIkNB/jNa1uaU7VAYM2z703JMIGc9bCoc7H8a1LLwaVPmhBdznmbWfzpJcc3ESmrd tZaVgvmKS/RHvwvRaU0bHI3PKQH6871rQROGtKUM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bas Nieuwenhuizen , Alex Deucher Subject: [PATCH 6.1 028/321] drm/amdgpu: Actually check flags for all context ops. Date: Tue, 27 Aug 2024 16:35:36 +0200 Message-ID: <20240827143839.287780840@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240827143838.192435816@linuxfoundation.org> References: <20240827143838.192435816@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bas Nieuwenhuizen commit 0573a1e2ea7e35bff08944a40f1adf2bb35cea61 upstream. Missing validation ... Checked libdrm and it clears all the structs, so we should be safe to just check everything. Signed-off-by: Bas Nieuwenhuizen Signed-off-by: Alex Deucher (cherry picked from commit c6b86421f1f9ddf9d706f2453159813ee39d0cf9) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -656,16 +656,24 @@ int amdgpu_ctx_ioctl(struct drm_device * switch (args->in.op) { case AMDGPU_CTX_OP_ALLOC_CTX: + if (args->in.flags) + return -EINVAL; r = amdgpu_ctx_alloc(adev, fpriv, filp, priority, &id); args->out.alloc.ctx_id = id; break; case AMDGPU_CTX_OP_FREE_CTX: + if (args->in.flags) + return -EINVAL; r = amdgpu_ctx_free(fpriv, id); break; case AMDGPU_CTX_OP_QUERY_STATE: + if (args->in.flags) + return -EINVAL; r = amdgpu_ctx_query(adev, fpriv, id, &args->out); break; case AMDGPU_CTX_OP_QUERY_STATE2: + if (args->in.flags) + return -EINVAL; r = amdgpu_ctx_query2(adev, fpriv, id, &args->out); break; case AMDGPU_CTX_OP_GET_STABLE_PSTATE: