[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4DC9A8C0.9070502@fastmail.fm>
Date: Tue, 10 May 2011 22:06:08 +0100
From: Jack Stone <jwjstone@...tmail.fm>
To: Tim Gardner <tim.gardner@...onical.com>
CC: linux-fbdev@...r.kernel.org, lethal@...ux-sh.org,
linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>,
Leann Ogasawara <leann.ogasawara@...onical.com>
Subject: Re: [PATCH V2] fbcon -- fix race between open and removal of framebuffers
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(®istered_lock)
+__releases(®istered_lock)
+{
+ struct fb_info *fb_info;
+
+ spin_lock(®istered_lock);
+ fb_info = registered_fb[idx];
+ fb_info->ref_count++;
+ spin_unlock(®istered_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.
Thanks,
Jack
--
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