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:	Sun, 4 Jul 2010 13:08:35 +0200
From:	Sam Ravnborg <sam@...nborg.org>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	linux-kernel@...r.kernel.org, John Kacur <jkacur@...hat.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
	alsa-devel@...a-project.org
Subject: Re: [PATCH 2/6] sound/oss: convert to unlocked_ioctl

> 
> diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
> index c1070e3..3547450 100644
> --- a/sound/oss/au1550_ac97.c
> +++ b/sound/oss/au1550_ac97.c
> @@ -824,22 +824,26 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
>  	return codec->mixer_ioctl(codec, cmd, arg);
>  }
>  
> -static int
> -au1550_ioctl_mixdev(struct inode *inode, struct file *file,
> -			       unsigned int cmd, unsigned long arg)
> +static long
> +au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg)
>  {
>  	struct au1550_state *s = (struct au1550_state *)file->private_data;
>  	struct ac97_codec *codec = s->codec;
> +	int ret;
> +
> +	lock_kernel();
> +	ret = mixdev_ioctl(codec, cmd, arg);
> +	unlock_kernel();
>  
> -	return mixdev_ioctl(codec, cmd, arg);
> +	return ret;
>  }

General comment...
In several places you declare a local variable of type "int",
but the function return a long.

I know that mixdev_ioctl() return an int so nothing is lost but
it just looks wrong.

> diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
> index 3f3c3f7..b5464fb 100644
> --- a/sound/oss/dmasound/dmasound_core.c
> +++ b/sound/oss/dmasound/dmasound_core.c
> @@ -337,8 +337,8 @@ static int mixer_release(struct inode *inode, struct file *file)
>  	unlock_kernel();
>  	return 0;
>  }
> -static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
> -		       u_long arg)
> +
> +static long mixer_ioctl(struct file *file, u_int cmd, u_long arg)
>  {
>  	if (_SIOC_DIR(cmd) & _SIOC_WRITE)
>  	    mixer.modify_counter++;
> @@ -362,11 +362,22 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
>  	return -EINVAL;
>  }
>  
> +static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
> +{
> +	int ret;
> +
> +	lock_kernel();
> +	ret = mixer_ioctl(file, cmd, arg);
> +	unlock_kernel();
> +
> +	return ret;
> +}

Here it looks like a potential but.
mixer_ioctl() return a long which is stored in an int and then we return a long.


> -static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
> -		    u_long arg)
> +static long sq_ioctl(struct file *file, u_int cmd, u_long arg)
>  {
>  	int val, result;
>  	u_long fmt;
> @@ -1114,18 +1124,29 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
>  		return IOCTL_OUT(arg,val);
>  
>  	default:
> -		return mixer_ioctl(inode, file, cmd, arg);
> +		return mixer_ioctl(file, cmd, arg);
>  	}
>  	return -EINVAL;
>  }
>  
> +static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
> +{
> +	int ret;
> +
> +	lock_kernel();
> +	ret = sq_ioctl(file, cmd, arg);
> +	unlock_kernel();
> +
> +	return ret;
> +}
ditto: long -> int -> long


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