From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ALSA: control: confirm to return all identical information in 'activate' event data Date: Mon, 09 Feb 2015 16:28:33 +0100 Message-ID: References: <1423494126-24054-1-git-send-email-o-takashi@sakamocchi.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BC3AB260415 for ; Mon, 9 Feb 2015 16:28:33 +0100 (CET) In-Reply-To: <1423494126-24054-1-git-send-email-o-takashi@sakamocchi.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Sakamoto Cc: alsa-devel@alsa-project.org, clemens@ladisch.de List-Id: alsa-devel@alsa-project.org 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 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 >