linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jack Stone <jwjstone@fastmail.fm>
To: Tim Gardner <tim.gardner@canonical.com>
Cc: linux-fbdev@vger.kernel.org, lethal@linux-sh.org,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>,
	Leann Ogasawara <leann.ogasawara@canonical.com>
Subject: Re: [PATCH V2] fbcon -- fix race between open and removal of framebuffers
Date: Tue, 10 May 2011 21:08:03 +0000	[thread overview]
Message-ID: <4DC9A933.5030706@fastmail.fm> (raw)
In-Reply-To: <4DC9A8C0.9070502@fastmail.fm>

On 10/05/2011 22:06, Jack Stone wrote:
> Hi Tim,
> 
> One more quick question:
> 
> On 10/05/2011 13:47, Tim Gardner wrote:
> +static struct fb_info *get_framebuffer_info(int idx)
> +__acquires(&registered_lock)
> +__releases(&registered_lock)
> +{
> +	struct fb_info *fb_info;
> +
> +	spin_lock(&registered_lock);
> +	fb_info = registered_fb[idx];
> +	fb_info->ref_count++;
> +	spin_unlock(&registered_lock);
> +
> +	return fb_info;
> +}
> 
> [snip]
> 
>  static int
>  fb_open(struct inode *inode, struct file *file)
>  __acquires(&info->lock)
> @@ -1363,13 +1421,18 @@ __releases(&info->lock)
> 
>  	if (fbidx >= FB_MAX)
>  		return -ENODEV;
> -	info = registered_fb[fbidx];
> -	if (!info)
> +	info = get_framebuffer_info(fbidx);
> +	if (!info) {
>  		request_module("fb%d", fbidx);
> -	info = registered_fb[fbidx];
> +		info = get_framebuffer_info(fbidx);
> +	}
>  	if (!info)
>  		return -ENODEV;
> 
> This section of code implies that get_framebuffer_info can return NULL
> but in that case wouldn't the fb_info->ref_count++ have oopsed?
> 
> You could add the simple case of
> 
> if(fb_info)
> 	fb_info->ref_count++
> 
> to get_framebuffer_info. That should cover it.
> 

Just read your later patch. Sorry for the extra email.

Thanks,

Jack

  reply	other threads:[~2011-05-10 21:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05 17:41 [PATCH 0/1] fbcon -- fix race between open and removal of framebuffers tim.gardner
2011-05-05 17:41 ` [PATCH] " tim.gardner
2011-05-05 18:30   ` [PATCH] fbcon -- fix race between open and removal of Bruno Prémont
2011-05-05 21:00   ` [PATCH] fbcon -- fix race between open and removal of framebuffers Jack Stone
2011-05-06  1:09     ` Anca Emanuel
2011-05-06  1:44       ` [PATCH] fbcon -- fix race between open and removal of Greg KH
2011-05-10 12:47     ` [PATCH V2] fbcon -- fix race between open and removal of framebuffers Tim Gardner
2011-05-10 21:06       ` Jack Stone
2011-05-10 21:08         ` Jack Stone [this message]
2011-05-06  0:21   ` [PATCH] " Anca Emanuel
2011-05-10 13:52 ` [PATCH V3] " Tim Gardner
2011-05-10 21:44   ` [PATCH V3] fbcon -- fix race between open and removal of Bruno Prémont
2011-05-11 14:09     ` [PATCH V3] fbcon -- fix race between open and removal of framebuffers Tim Gardner
2011-05-11 14:27       ` [PATCH V3] fbcon -- fix race between open and removal of Bruno Prémont

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=4DC9A933.5030706@fastmail.fm \
    --to=jwjstone@fastmail.fm \
    --cc=apw@canonical.com \
    --cc=leann.ogasawara@canonical.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim.gardner@canonical.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;
as well as URLs for NNTP newsgroup(s).