Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: Re: [PATCH] ALSA: control: confirm to return all identical information in 'activate' event data
Date: Mon, 09 Feb 2015 16:28:33 +0100	[thread overview]
Message-ID: <s5hsiefrtni.wl-tiwai@suse.de> (raw)
In-Reply-To: <1423494126-24054-1-git-send-email-o-takashi@sakamocchi.jp>

At Tue, 10 Feb 2015 00:02:06 +0900,
Takashi Sakamoto wrote:
> 
> When event originator doesn't set numerical ID in identical information,
> the event data includes no numerical ID, thus userspace applications
> cannot identify the control just by unique ID in event data.
> 
> This commit fix this bug so as the event data includes all of identical
> information.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

You can't overwrite id pointer in this case.  It's a caller's object.

One way to fix would be to copy the id instance.  Another way would be
to change up/down_write() with _read(), and include snd_ctl_notify()
call with kctl->id inside the semaphore lock.

The former would be less changes but consume the stack significantly.


thanks,

Takashi


> ---
>  sound/core/control.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/core/control.c b/sound/core/control.c
> index 6a72b3e..884fddd 100644
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -587,6 +587,7 @@ int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id,
>  	}
>  	ret = 1;
>   unlock:
> +	*id = kctl->id;
>  	up_write(&card->controls_rwsem);
>  	if (ret > 0)
>  		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, id);
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-02-09 15:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 15:02 [PATCH] ALSA: control: confirm to return all identical information in 'activate' event data Takashi Sakamoto
2015-02-09 15:28 ` Takashi Iwai [this message]
2015-02-09 16:01   ` Takashi Sakamoto
2015-02-09 16:02     ` Takashi Iwai
2015-02-09 16:18       ` Takashi Iwai
2015-02-10  5:24         ` Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hsiefrtni.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=o-takashi@sakamocchi.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox