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 22:29:20 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	perex@...ex.cz, linux-kernel@...r.kernel.org
Subject: [PATCH] tea575x: Switch to unlocked_ioctl

Not sure why this is hiding in the sound directory or why it has an
ancient and buggy V4L1 interface on it but it is and it needs to use
unlocked_ioctl.

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

diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 87e3aef..c1d6184 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -25,6 +25,7 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <sound/core.h>
+#include <linux/smp_lock.h>
 #include <sound/tea575x-tuner.h>
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@...ex.cz>");
@@ -84,12 +85,14 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
  * Linux Video interface
  */
 
-static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
-			     unsigned int cmd, unsigned long data)
+static long snd_tea575x_ioctl(struct file *file, unsigned int cmd,
+						unsigned long data)
 {
 	struct video_device *dev = video_devdata(file);
 	struct snd_tea575x *tea = video_get_drvdata(dev);
 	void __user *arg = (void __user *)data;
+
+#warning "Video4Linux 1 is obsolete. Please update this driver"
 	
 	switch(cmd) {
 		case VIDIOCGCAP:
@@ -103,7 +106,9 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
 			v.maxheight = 0;
 			v.minwidth = 0;
 			v.minheight = 0;
+			lock_kernel();
 			strcpy(v.name, tea->tea5759 ? "TEA5759" : "TEA5757");
+			unlock_kernel();
 			if (copy_to_user(arg,&v,sizeof(v)))
 				return -EFAULT;
 			return 0;
@@ -136,13 +141,16 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
 			return 0;
 		}
 		case VIDIOCGFREQ:
+			/* FIXME: freq locking is needed ?? */
 			if(copy_to_user(arg, &tea->freq, sizeof(tea->freq)))
 				return -EFAULT;
 			return 0;
 		case VIDIOCSFREQ:
 			if(copy_from_user(&tea->freq, arg, sizeof(tea->freq)))
 				return -EFAULT;
+			lock_kernel();
 			snd_tea575x_set_freq(tea);
+			unlock_kernel();
 			return 0;
 		case VIDIOCGAUDIO:
 		{	
@@ -158,16 +166,18 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
 			struct video_audio v;
 			if(copy_from_user(&v, arg, sizeof(v))) 
 				return -EFAULT;	
+			lock_kernel();
 			if (tea->ops->mute)
 				tea->ops->mute(tea,
 					       (v.flags &
 						VIDEO_AUDIO_MUTE) ? 1 : 0);
+			unlock_kernel();
 			if(v.audio) 
 				return -EINVAL;
 			return 0;
 		}
 		default:
-			return -ENOIOCTLCMD;
+			return -ENOTTY;
 	}
 }
 
@@ -198,7 +208,7 @@ void snd_tea575x_init(struct snd_tea575x *tea)
 	tea->fops.owner = tea->card->module;
 	tea->fops.open = video_exclusive_open;
 	tea->fops.release = video_exclusive_release;
-	tea->fops.ioctl = snd_tea575x_ioctl;
+	tea->fops.unlocked_ioctl = snd_tea575x_ioctl;
 	if (video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->dev_nr - 1) < 0) {
 		snd_printk(KERN_ERR "unable to register tea575x tuner\n");
 		return;
--
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