Patch not upstream: fix race between open and removal of framebuffers

Tim Gardner tim.gardner at canonical.com
Thu Apr 7 14:00:58 UTC 2011


On 04/02/2011 09:37 AM, Anca Emanuel wrote:
> This patch: http://is.gd/otIfGc is not in mainline. Any reason for that ?
>
> see: https://lkml.org/lkml/2011/2/24/445
>
> Please post c5a742b5f78e161d6a13853a7e3e6e1dfa429e69
> UBUNTU: SAUCE: fbcon -- fix race between open and removal of framebuffers
> to lkml with CC: stable at kernel.org
>
> -----------------------------------------------------------------
>
>
>  From c5a742b5f78e161d6a13853a7e3e6e1dfa429e69 Mon Sep 17 00:00:00 2001
> From: Andy Whitcroft<apw at canonical.com>
> Date: Thu, 29 Jul 2010 16:48:20 +0100
> Subject: [PATCH 1/1] UBUNTU: SAUCE: fbcon -- fix race between open and
> removal of framebuffers
>
> Currently there is no locking for updates to the registered_fb list.
> This allows an open through /dev/fbN to pick up a registered framebuffer
> pointer in parallel with it being released, as happens when a conflicting
> framebuffer is ejected or on module unload.  There is also no reference
> counting on the framebuffer descriptor which is referenced from all open
> files, leading to references to released or reused memory to persist on
> these open files.
>
> This patch adds a reference count to the framebuffer descriptor to prevent
> it from being released until after all pending opens are closed.  This
> allows the pending opens to detect the closed status and unmap themselves.
> It also adds locking to the framebuffer lookup path, locking it against
> the removal path such that it is possible to atomically lookup and take a
> reference to the descriptor.  It also adds locking to the read and write
> paths which currently could access the framebuffer descriptor after it
> has been freed.  Finally it moves the device to FBINFO_STATE_REMOVED to
> indicate that all access should be errored for this device.
>
> Signed-off-by: Andy Whitcroft<apw at canonical.com>
> Acked-by: Stefan Bader<stefan.bader at canonical.com>
> Signed-off-by: Leann Ogasawara<leann.ogasawara at canonical.com>
> ---
>   drivers/video/fbmem.c |  132 ++++++++++++++++++++++++++++++++++++++-----------
>   include/linux/fb.h    |    2 +
>   2 files changed, 105 insertions(+), 29 deletions(-)
>

The patch author is away on vacation. I'm gonna leave it up to him to 
pursue upstreaming upon his return.

rtg
-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list