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]
Date:	Tue, 24 May 2011 22:45:45 +0200
From:	Bruno Prémont <bonbons@...ux-vserver.org>
To:	Fabio Erculiani <lxnay@...ayon.org>
Cc:	linux-fbdev@...r.kernel.org, lethal@...ux-sh.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fbmem: fix race condition between
 register_framebuffer() and fb_open()

On Tue, 24 May 2011 Fabio Erculiani <lxnay@...ayon.org> wrote:
> register_framebuffer() acquires registration_lock, then calls
> do_register_framebuffer() which calls fb_notifier_call_chain()
> which calls fb_open() which calls get_fb_info() which tries
> (at last) to acquire registration_lock again.
> This is a workaround.

What calls fb_open() instead of just calling fb_info->fbops->fb_open
when it is set?
In other words what kernel handler of fb_notifier chain does file-based
open of the framebuffer or is the event pushed out synchronously to
userspace?

> Signed-off-by: Fabio Erculiani <lxnay@...ayon.org>
> ---
>  drivers/video/fbmem.c |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 5aac00e..b9831a0 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -1628,6 +1628,11 @@ static int do_register_framebuffer(struct fb_info *fb_info)
>  	event.info = fb_info;
>  	if (!lock_fb_info(fb_info))
>  		return -ENODEV;
> +
> +	/* FIXME: unlock registration mutex before registration
> +	 * notification is sent, in order to avoid deadlock.
> +	 */
> +	mutex_unlock(&registration_lock);
>  	fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
>  	unlock_fb_info(fb_info);
>  	return 0;
> @@ -1692,7 +1697,13 @@ register_framebuffer(struct fb_info *fb_info)
>  
>  	mutex_lock(&registration_lock);
>  	ret = do_register_framebuffer(fb_info);
> -	mutex_unlock(&registration_lock);
> +	if (ret != 0)
> +		/*
> +		 * FIXME: mutex is unlocked only if ret == 0.
> +		 * This is the second part of the workaround
> +		 * that prevents deadlocking.
> +		 */
> +		mutex_unlock(&registration_lock);
>  
>  	return ret;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ