From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (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 CA6A5309F1D; Tue, 5 May 2026 18:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778006213; cv=none; b=j63+8jOYFFka6cvmV+nxKkNp9tHbCQfCFJNOntMQvEFJyksfA8EQV++r81pvaDwRhMzRdNA31DDba6sjFyOZCTxDZh+PyXor6sj68LpMDu96R+GC9/M5dLpdcYLWrp1yy/aIZd+uxemk5slXxHbH7XpZjBJgafWf74NZwFUl69k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778006213; c=relaxed/simple; bh=o++R2kdIsGcoEgZOQS/gVadcVMIJ9Ue5B/7IYTA3YXA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SWzqbZlFhUJKjXqtVsjIDiyXXd6XVWrRnxBnL1wOIgAqTucxi58xfTiYkiTICN8PxXPC2WAuhjMXIUCBJG/6tOBlx2aKVICbKkzk8/r+DRYuzD9iGmi9TmLM/sezktH7FUPURsEb4GHpRC4rY3uknUb8TL+I29y4EETnt8nJPpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Igalia.com; spf=pass smtp.mailfrom=Igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=FlNdiboT; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=Igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="FlNdiboT" 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=0wouRkC7R6R6za9vKUGUIKSOanWTfI6K8Vjgu6fhaJA=; b=FlNdiboThWj2nJU5anXICAiYK/ 36hxMKS+lEATI1venbZfWbtLPV3XLJ67PTiLl1F7EVQwmzjxBYyrqITl/hxY6wmh5WFbdHjqauFBc r7t1JGAPeXhKql9vyI7t+BA5Fi7Wf4qBlR/cbNNvux8Fv2Z/jmS/kcVNRHg0db2wVJWJ0eWS3fA4m w6wwPRy/+ZBqzkNDiwvNkY6ZeZGT2byLfHvUBlPXqwR8r6wtn1EzklNl0L4IU/RzpV/pmQZwOrubS B7GY3flB3hsh4a63lQQCmyJwgsRehd40KmbAvvjWV5Viv53elLTia7pxNoHBhn0Nl5ib1A3s7E4+b +mYc+XPQ==; Received: from c-73-157-168-91.hsd1.or.comcast.net ([73.157.168.91] helo=[192.168.1.133]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1wKKck-006ZHM-Py; Tue, 05 May 2026 20:36:02 +0200 Message-ID: <8c429335-2516-49a0-b2dc-4a09fd14749e@Igalia.com> Date: Tue, 5 May 2026 11:35:51 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/8] drm/msm/dpu: don't mix devm and drmm functions To: Dmitry Baryshkov , Jani Nikula , "Kandpal, Suraj" , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Airlie , Simona Vetter , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Sean Paul , Marijn Suijten , Laurent Pinchart , Tomi Valkeinen , Kieran Bingham , Geert Uytterhoeven , Magnus Damm , Dave Stevenson , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Christophe JAILLET , Jessica Zhang , Louis Chauvet Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, kernel-dev@igalia.com References: <20260505-wb-drop-encoder-v5-0-42567b7c7af2@oss.qualcomm.com> <20260505-wb-drop-encoder-v5-1-42567b7c7af2@oss.qualcomm.com> Content-Language: en-GB From: John Harrison In-Reply-To: <20260505-wb-drop-encoder-v5-1-42567b7c7af2@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 5/4/26 17:24, Dmitry Baryshkov wrote: > Mixing devm and drmm functions will result in a use-after-free on msm > driver teardown if userspace keeps a reference on the drm device: > The WB connector data will be destroyed because of the use of > devm_kzalloc()), while the usersoace still can try interacting with the extra ) on devm_kzalloc()) typo: userspace Otherwise the description looks good to me and the two typos can be fixed when merging, so: Reviewed-by: John.Harrison@Igalia.com But should wait for at least an ack from Laurent as the person originally requesting an extended description. John. > WB connector (which uses drmm_ functions). > > Change dpu_writeback_init() to use drmm_. > > Fixes: 0b37ac63fc9d ("drm/msm/dpu: use drmm_writeback_connector_init()") > Reported-by: Christophe JAILLET > Closes: https://lore.kernel.org/r/78c764b8-44cf-4db5-88e7-807a85954518@wanadoo.fr > Signed-off-by: Dmitry Baryshkov > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c > index 7545c0293efb..6f2370c9dd98 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_writeback.c > @@ -5,6 +5,7 @@ > > #include > #include > +#include > > #include "dpu_writeback.h" > > @@ -125,7 +126,7 @@ int dpu_writeback_init(struct drm_device *dev, struct drm_encoder *enc, > struct dpu_wb_connector *dpu_wb_conn; > int rc = 0; > > - dpu_wb_conn = devm_kzalloc(dev->dev, sizeof(*dpu_wb_conn), GFP_KERNEL); > + dpu_wb_conn = drmm_kzalloc(dev, sizeof(*dpu_wb_conn), GFP_KERNEL); > if (!dpu_wb_conn) > return -ENOMEM; > >