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, 10 May 2011 14:47:42 +0200
From:	Tim Gardner <tim.gardner@...onical.com>
To:	Jack Stone <jwjstone@...tmail.fm>
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: [PATCH V2] fbcon -- fix race between open and removal of framebuffers

On 05/05/2011 11:00 PM, Jack Stone wrote:
> On 05/05/2011 18:41, tim.gardner@...onical.com 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;
>> +}
>> +
>>   static int
>>   fb_open(struct inode *inode, struct file *file)
>>   __acquires(&info->lock)
>> @@ -1363,13 +1421,17 @@ __releases(&info->lock)
>>
>>   	if (fbidx>= FB_MAX)
>>   		return -ENODEV;
>> -	info = registered_fb[fbidx];
>> +	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;
>
> If the first get_framebuffer_info succeeds don't you up the ref count
> twice? Shouldn't this be:
>
> info = get_framebuffer_info(fbidx);
> if (!info) {
> 	request_module("fb%d", fbidx);
> 	info = get_framebuffer_info(fbidx);
> }
> if (!info)
> 	return -ENODEV;
>
> Thanks,
>
> Jack

Good catch. See attached.

rtg
-- 
Tim Gardner tim.gardner@...onical.com

View attachment "0001-fbcon-fix-race-between-open-and-removal-of-framebuff.patch" of type "text/x-patch" (9993 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ