Linux Framebuffer Layer development
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Peter Jones" <pjones@redhat.com>,
	"Daniel Vetter" <daniel@ffwll.ch>
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] fbdev/efifb: Register sysfs groups through driver core
Date: Wed, 28 Aug 2024 19:50:29 +0200	[thread overview]
Message-ID: <d1cab5f1-2b3a-413a-8ccf-3152fd8b95df@gmx.de> (raw)
In-Reply-To: <20240827-efifb-sysfs-v1-2-c9cc3e052180@weissschuh.net>

On 8/27/24 17:25, Thomas Weißschuh wrote:
> The driver core can register and cleanup sysfs groups already.
> Make use of that functionality to simplify the error handling and
> cleanup.
>
> Also avoid a UAF race during unregistering where the sysctl attributes
> were usable after the info struct was freed.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

I've added your patches #2, #3, #4 and #5 of this series to the fbdev git tree.
I tend to not take patch #1 as already explained there...

Thanks!
Helge



> ---
>   drivers/video/fbdev/efifb.c | 11 ++---------
>   1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
> index 8bfe0ccbc67a..d36b95856dd0 100644
> --- a/drivers/video/fbdev/efifb.c
> +++ b/drivers/video/fbdev/efifb.c
> @@ -561,15 +561,10 @@ static int efifb_probe(struct platform_device *dev)
>   		break;
>   	}
>
> -	err = sysfs_create_groups(&dev->dev.kobj, efifb_groups);
> -	if (err) {
> -		pr_err("efifb: cannot add sysfs attrs\n");
> -		goto err_unmap;
> -	}
>   	err = fb_alloc_cmap(&info->cmap, 256, 0);
>   	if (err < 0) {
>   		pr_err("efifb: cannot allocate colormap\n");
> -		goto err_groups;
> +		goto err_unmap;
>   	}
>
>   	err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
> @@ -587,8 +582,6 @@ static int efifb_probe(struct platform_device *dev)
>
>   err_fb_dealloc_cmap:
>   	fb_dealloc_cmap(&info->cmap);
> -err_groups:
> -	sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
>   err_unmap:
>   	if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC))
>   		iounmap(info->screen_base);
> @@ -608,12 +601,12 @@ static void efifb_remove(struct platform_device *pdev)
>
>   	/* efifb_destroy takes care of info cleanup */
>   	unregister_framebuffer(info);
> -	sysfs_remove_groups(&pdev->dev.kobj, efifb_groups);
>   }
>
>   static struct platform_driver efifb_driver = {
>   	.driver = {
>   		.name = "efi-framebuffer",
> +		.dev_groups = efifb_groups,
>   	},
>   	.probe = efifb_probe,
>   	.remove_new = efifb_remove,
>


  reply	other threads:[~2024-08-28 17:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 15:25 [PATCH 0/5] fbdev: devm_register_framebuffer() and some fixes for efifb Thomas Weißschuh
2024-08-27 15:25 ` [PATCH 1/5] fbdev/efifb: Use stack memory for screeninfo structs Thomas Weißschuh
2024-08-28 17:42   ` Helge Deller
2024-08-29  7:52     ` Thomas Weißschuh
2024-08-27 15:25 ` [PATCH 2/5] fbdev/efifb: Register sysfs groups through driver core Thomas Weißschuh
2024-08-28 17:50   ` Helge Deller [this message]
2024-08-27 15:25 ` [PATCH 3/5] fbdev: Introduce devm_register_framebuffer() Thomas Weißschuh
2024-08-30  7:17   ` Thomas Weißschuh
2024-08-30  8:25     ` Bert Karwatzki
2024-08-30  8:44       ` Helge Deller
2024-08-27 15:25 ` [PATCH 4/5] fbdev/efifb: Use devm_register_framebuffer() Thomas Weißschuh
2024-08-27 15:25 ` [PATCH 5/5] fbdev/efifb: Use driver-private screen_info for sysfs Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d1cab5f1-2b3a-413a-8ccf-3152fd8b95df@gmx.de \
    --to=deller@gmx.de \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox