Re: [PATCH 06/39] ALSA: seq: obsolete address mode in compatibility layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 07 Aug 2016 11:48:42 +0200,
Takashi Sakamoto wrote:
> 
> In a 32/64 bit compatibility layer of ALSA sequencer core, data for some
> ioctls is copied to kernel stack and passed to core operations. Then,
> address limit of running task is changed because core implementation
> expected arguments in userspace.
> 
> In this case, snd_seq_kernel_client_ctl() is available. This commit
> replaces with it.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
> ---
>  sound/core/seq/seq_compat.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c
> index 70d3ddb..6cc7302 100644
> --- a/sound/core/seq/seq_compat.c
> +++ b/sound/core/seq/seq_compat.c
> @@ -42,13 +42,11 @@ struct snd_seq_port_info32 {
>  	char reserved[59];		/* for future use */
>  };
>  
> -static int seq_call_port_info_ioctl(struct snd_seq_client *client,
> -				    unsigned int cmd,
> +static int seq_call_port_info_ioctl(int clientid, unsigned int cmd,
>  				    struct snd_seq_port_info32 __user *data32)
>  {
>  	int err = -EFAULT;
>  	struct snd_seq_port_info *data;
> -	mm_segment_t fs;
>  
>  	data = kmalloc(sizeof(*data), GFP_KERNEL);
>  	if (!data)
> @@ -60,9 +58,7 @@ static int seq_call_port_info_ioctl(struct snd_seq_client *client,
>  		goto error;
>  	data->kernel = NULL;
>  
> -	fs = snd_enter_user();
> -	err = seq_do_ioctl(client, cmd, data);
> -	snd_leave_user(fs);
> +	err = snd_seq_kernel_client_ctl(clientid, cmd, data);
>  	if (err < 0)
>  		goto error;

It's better to pass a snd_seq_client pointer to this function and
evaluate client->port in the function instead of referencing to
client->port from each caller.


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux