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:	Thu, 14 Jun 2012 00:21:40 +0200
From:	Peter Huewe <peterhuewe@....de>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	Arnaud Patard <arnaud.patard@...-net.org>,
	Aaro Koskinen <aaro.koskinen@....fi>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	Peter Huewe <peterhuewe@....de>, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 02/14] staging/xgifb: Add mutext for fb_mmap locking

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 537a1bf0 - "fbdev: add mutex for fb_mmap locking" by Krzysztof Helt
for details.

Signed-off-by: Peter Huewe <peterhuewe@....de>
---
 drivers/staging/xgifb/XGI_main_26.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index ff88f1d..f427b85 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -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)
-- 
1.7.3.4

--
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