From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF0AC388F7 for ; Fri, 13 Nov 2020 14:56:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7F2582222F for ; Fri, 13 Nov 2020 14:56:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbgKMO4H (ORCPT ); Fri, 13 Nov 2020 09:56:07 -0500 Received: from asavdk4.altibox.net ([109.247.116.15]:49626 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgKMO4E (ORCPT ); Fri, 13 Nov 2020 09:56:04 -0500 Received: from ravnborg.org (unknown [188.228.123.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id 21780804F9; Fri, 13 Nov 2020 15:55:58 +0100 (CET) Date: Fri, 13 Nov 2020 15:55:57 +0100 From: Sam Ravnborg To: Colin King Cc: Anitha Chrisanthus , Edmund Dea , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] drm/kmb: fix array out-of-bounds writes to kmb->plane_status[] Message-ID: <20201113145557.GB3647624@ravnborg.org> References: <20201113120121.33212-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201113120121.33212-1-colin.king@canonical.com> X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=VafZwmh9 c=1 sm=1 tr=0 a=S6zTFyMACwkrwXSdXUNehg==:117 a=S6zTFyMACwkrwXSdXUNehg==:17 a=kj9zAlcOel0A:10 a=DfNHnWVPAAAA:8 a=fighymmnzFzAkJHgI4oA:9 a=CjuIK1q_8ugA:10 a=rjTVMONInIDnV1a_A2c_:22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Colin. On Fri, Nov 13, 2020 at 12:01:21PM +0000, Colin King wrote: > From: Colin Ian King > > Writes to elements in the kmb->plane_status array in function > kmb_plane_atomic_disable are overrunning the array when plane_id is > more than 1 because currently the array is KMB_MAX_PLANES elements > in size and this is currently #defined as 1. Fix this by defining > KMB_MAX_PLANES to 4. I fail to follow you here. In kmb_plane_init() only one plane is allocated - with id set to 0. So for now only one plane is allocated thus kmb_plane_atomic_disable() is only called for this plane. With your change we will start allocating four planes, something that is not tested. Do I miss something? Sam