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>] [day] [month] [year] [list]
Date:	Thu, 22 May 2008 21:34:11 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org
Subject: [PATCH] ds1286: push down BKL

Not one I can test but hopefully someone can check this on the mips side
and better still eliminate the BKL in the ioctl handler entirely

Signed-off-by: Alan Cox <alan@...hat.com>

diff --git a/drivers/char/ds1286.c b/drivers/char/ds1286.c
index ea35ab2..775b3f6 100644
--- a/drivers/char/ds1286.c
+++ b/drivers/char/ds1286.c
@@ -40,8 +40,8 @@
 #include <linux/bcd.h>
 #include <linux/proc_fs.h>
 #include <linux/jiffies.h>
-
-#include <asm/uaccess.h>
+#include <linux/smp_lock.h>
+#include <linux/uaccess.h>
 #include <asm/system.h>
 
 #define DS1286_VERSION		"1.0"
@@ -58,8 +58,8 @@ static DECLARE_WAIT_QUEUE_HEAD(ds1286_wait);
 static ssize_t ds1286_read(struct file *file, char *buf,
 			size_t count, loff_t *ppos);
 
-static int ds1286_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long arg);
+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+						unsigned long arg);
 
 static unsigned int ds1286_poll(struct file *file, poll_table *wait);
 
@@ -97,8 +97,8 @@ static ssize_t ds1286_read(struct file *file, char *buf,
 	return -EIO;
 }
 
-static int ds1286_ioctl(struct inode *inode, struct file *file,
-                        unsigned int cmd, unsigned long arg)
+static long do_ds1286_ioctl(struct file *file, unsigned int cmd,
+						unsigned long arg)
 {
 	struct rtc_time wtime;
 
@@ -244,6 +244,16 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
 	return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
 }
 
+static long ds1286_ioctl(struct file *file, unsigned int cmd,
+						unsigned long arg)
+{
+	long ret;
+	lock_kernel();
+	ret = ds1286_do_ioctl(file, cmd, arg);
+	unlock_kernel();
+	return ret;
+}
+
 /*
  *	We enforce only one user at a time here with the open/close.
  *	Also clear the previous interrupt data on an open, and clean
@@ -289,7 +299,7 @@ static const struct file_operations ds1286_fops = {
 	.llseek		= no_llseek,
 	.read		= ds1286_read,
 	.poll		= ds1286_poll,
-	.ioctl		= ds1286_ioctl,
+	.unlocked_ioctl	= ds1286_ioctl,
 	.open		= ds1286_open,
 	.release	= ds1286_release,
 };
--
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