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:	Wed, 21 Oct 2009 02:06:29 +0200 (CEST)
From:	John Kacur <jkacur@...hat.com>
To:	Arnd Bergmann <arndbergmann@...glemail.com>
cc:	linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
	Alan Cox <alan@...rguk.ukuu.org.uk>,
	Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Mattia Dongili <malattia@...ux.it>
Subject: Re: [PATCH] sony_pi: Remove the BKL from sonypi_misc_open



On Tue, 20 Oct 2009, Arnd Bergmann wrote:

> On Tuesday 20 October 2009, Arnd Bergmann wrote:
> > On Monday 19 October 2009, John Kacur wrote:
> > > How does this look? (Version 2 of the patch follows)
> > 
> > Looks good now.
> > 
> 
> A bit of background:
> 
> Doing only one of the two conversions is a correct patch as well
> of course, I just want to make sure you don't have to go through all
> the same files again once someone does a blind pushdown into the ioctl
> and llseek functions, so once you prove that a specific driver doesn't
> need the BKL, please always make sure to remove it from all three places.
> 
> I fear that the llseek part will get interesting as well, just because
> we call default_llseek instead of no_ll by default currently.
> It might be a good idea to add one of .llseek=no_llseek or 
> .llseek=generic_file_llseek in any file_operations that you prove
> to not require the BKL.
> 

Good point.

@Thomas: I'm sending this as a separate patch, but I can combine it with
the one that removes the bkl in the open and ioctl functions if you 
prefer.

>From 11e6a3b690413c3926e6db1c53a53410b5214c3d Mon Sep 17 00:00:00 2001
From: John Kacur <jkacur@...hat.com>
Date: Wed, 21 Oct 2009 01:51:41 +0200
Subject: [PATCH] sonypi: Use non-BKL version of llseek.

The default version of llseek uses the BKL.
We have removed the use of the BKL in open and the ioctl.
Now lets remove the last use of the BKL by explictly calling the
generic unlocked llseek, under the sonypi_device.lock mutex

Signed-off-by: John Kacur <jkacur@...hat.com>
---
 drivers/char/sonypi.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 593cbb5..55b08cd 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -1061,6 +1061,16 @@ static long sonypi_misc_ioctl(struct file *fp,
 	return ret;
 }
 
+static loff_t sonypi_misc_llseek(struct file *fp, loff_t offset, int origin)
+{
+	loff_t loff;
+	mutex_lock(&sonypi_device.lock);
+	loff = generic_file_llseek_unlocked(fp, offset, origin);
+	mutex_unlock(&sonypi_device.lock);
+
+	return loff;
+}
+
 static const struct file_operations sonypi_misc_fops = {
 	.owner		= THIS_MODULE,
 	.read		= sonypi_misc_read,
@@ -1069,6 +1079,7 @@ static const struct file_operations sonypi_misc_fops = {
 	.release	= sonypi_misc_release,
 	.fasync		= sonypi_misc_fasync,
 	.unlocked_ioctl	= sonypi_misc_ioctl,
+	.llseek		= sonypi_misc_llseek,
 };
 
 static struct miscdevice sonypi_misc_device = {
-- 
1.6.0.6


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

Powered by Openwall GNU/*/Linux Powered by OpenVZ