Skip to content

Commit

Permalink
staging/xgifb: Add mutext for fb_mmap locking
Browse files Browse the repository at this point in the history
This adds a mutex for fb_mmap around smem_start and smem_len
so the mutex inside the fb_mmap() is actually used.  Changing of
these fields before calling the framebuffer_register() are not mutexed.

We check whether framebuffer_register has been called by reading
fbinfo->count.

See 537a1bf - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt
for details.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Huewe authored and Greg Kroah-Hartman committed Jun 14, 2012
1 parent 176f784 commit 95649c4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/staging/xgifb/XGI_main_26.c
Original file line number Diff line number Diff line change
Expand Up @@ -1350,10 +1350,17 @@ static int XGIfb_get_fix(struct fb_fix_screeninfo *fix, int con,

strncpy(fix->id, "XGI", sizeof(fix->id) - 1);

fix->smem_start = xgifb_info->video_base;
/* if register_framebuffer has been called, we must lock */
if (atomic_read(&info->count))
mutex_lock(&info->mm_lock);

fix->smem_start = xgifb_info->video_base;
fix->smem_len = xgifb_info->video_size;

/* if register_framebuffer has been called, we can unlock */
if (atomic_read(&info->count))
mutex_unlock(&info->mm_lock);

fix->type = FB_TYPE_PACKED_PIXELS;
fix->type_aux = 0;
if (xgifb_info->video_bpp == 8)
Expand Down

0 comments on commit 95649c4

Please sign in to comment.