lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250313-enlightened-shrewd-skunk-b6ed72@houat>
Date: Thu, 13 Mar 2025 15:34:44 +0100
From: Maxime Ripard <mripard@...nel.org>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>
Cc: Anusha Srivatsa <asrivats@...hat.com>, 
	Neil Armstrong <neil.armstrong@...aro.org>, Jessica Zhang <quic_jesszhan@...cinc.com>, 
	Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>, Thomas Zimmermann <tzimmermann@...e.de>, 
	David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, dri-devel@...ts.freedesktop.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 1/2] drm/panel: Add new helpers for refcounted panel
 allocatons

On Thu, Mar 13, 2025 at 11:09:44AM +0100, Luca Ceresoli wrote:
> Hello Anusha,
> 
> On Wed, 12 Mar 2025 20:54:42 -0400
> Anusha Srivatsa <asrivats@...hat.com> wrote:
> 
> > Introduce reference counted allocations for panels to avoid
> > use-after-free. The patch adds the macro devm_drm_bridge_alloc()
> > to allocate a new refcounted panel. Followed the documentation for
> > drmm_encoder_alloc() and devm_drm_dev_alloc and other similar
> > implementations for this purpose.
> > 
> > Also adding drm_panel_get() and drm_panel_put() to suitably
> > increment and decrement the refcount
> > 
> > Signed-off-by: Anusha Srivatsa <asrivats@...hat.com>
> 
> I'm very happy to see the very first step of the panel rework mentioned
> by Maxime see the light! :-)
> 
> This patch looks mostly good to me, and the similarity with my bridge
> refcounting work is by itself reassuring.
> 
> I have a few notes, one is relevant and the others are minor details,
> see below.
> 
> In the Subject line: s/allocatons/allocations/
> 
> [...]
> 
> > +void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
> > +			     const struct drm_panel_funcs *funcs)
> > +{
> > +	void *container;
> > +	struct drm_panel *panel;
> > +	int err;
> > +
> > +	if (!funcs) {
> > +		dev_warn(dev, "Missing funcs pointer\n");
> > +		return ERR_PTR(-EINVAL);
> > +	}
> > +
> > +	container = kzalloc(size, GFP_KERNEL);
> > +	if (!container)
> > +		return ERR_PTR(-ENOMEM);
> > +
> > +	panel = container + offset;
> > +	panel->container_offset = offset;
> > +	panel->funcs = funcs;
> > +	kref_init(&panel->refcount);
> > +
> > +	err = devm_add_action_or_reset(dev, drm_panel_put_void, panel);
> > +	if (err)
> > +		return ERR_PTR(err);
> > +
> > +	drm_panel_init(panel, dev, funcs, panel->connector_type);
> 
> panel->connector_type here is uninitialized. You are passing
> panel->connector_type to drm_panel_init(), which will then copy it into
> panel->connector_type itself.

Yeah, we need to have the connector type as a parameter.

Maxime

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ