All of lore.kernel.org
 help / color / mirror / Atom feed
From: b_lkasam@codeaurora.org
To: alsa-devel@alsa-project.org
Cc: lkasam@qti.qualcomm.com, b_lkasam@codeaurora.org
Subject: ALSA core info race condition
Date: Wed, 28 Jun 2017 00:42:18 +0530	[thread overview]
Message-ID: <70ff31e5f7fb35774cc0a9f3764ed144@codeaurora.org> (raw)

hi ALSA team,
there is a race condition in below API when accessing list API.

In file sound/core/info.c:

Added below patch to avoid list access of same parent node
by two threads at same time causing list_debug crash.

diff --git a/sound/core/info.c b/sound/core/info.c
index b5158b5..c1fd671 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -747,8 +747,11 @@ snd_info_create_entry(const char *name, struct 
snd_info_entry *parent)
  	INIT_LIST_HEAD(&entry->children);
  	INIT_LIST_HEAD(&entry->list);
  	entry->parent = parent;
-	if (parent)
+	if (parent) {
+		mutex_lock(&parent->access);
  		list_add_tail(&entry->list, &parent->children);
+		mutex_unlock(&parent->access);
+	}
  	return entry;
  }

Please check above logic looks fine, and help comment accordingly.


Thanks
Kasam

             reply	other threads:[~2017-06-27 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 19:12 b_lkasam [this message]
2017-06-28  5:36 ` ALSA core info race condition Takashi Iwai
2017-06-28  5:58   ` b_lkasam
2017-06-28  6:26     ` Takashi Iwai

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=70ff31e5f7fb35774cc0a9f3764ed144@codeaurora.org \
    --to=b_lkasam@codeaurora.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=lkasam@qti.qualcomm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.