From patchwork Tue Jun 27 19:12:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: b_lkasam@codeaurora.org X-Patchwork-Id: 9812967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BDA9860329 for ; Tue, 27 Jun 2017 19:12:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B193B2223E for ; Tue, 27 Jun 2017 19:12:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A64B128701; Tue, 27 Jun 2017 19:12:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E77E72223E for ; Tue, 27 Jun 2017 19:12:28 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3CBE6266D9B; Tue, 27 Jun 2017 21:12:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E28E2266D9D; Tue, 27 Jun 2017 21:12:22 +0200 (CEST) Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by alsa0.perex.cz (Postfix) with ESMTP id 1EBD2266838 for ; Tue, 27 Jun 2017 21:12:20 +0200 (CEST) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 273BF609FD; Tue, 27 Jun 2017 19:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498590739; bh=GaVg9I0xBG6ehsn7vmYFlV3t/a5gQChaxRP8u1tYHhE=; h=Date:From:To:Cc:Subject:From; b=eSUmbrqau8S3BFpl5dEl8tagFsBOCboTYnykf6oeSKDcrSq5cPu/uxTAapm7onSxw UmVY56ZZqKnwTuIQplH3IpPCDJ5kymfr6yYeuUT7SiPVMx5Nm1FSf0VxDQVXfF+Mas uaeRokTDIarKCVUuwyvzC3Z0RO58nmRqlVcKkDsM= Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id E2D18602B9; Tue, 27 Jun 2017 19:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498590738; bh=GaVg9I0xBG6ehsn7vmYFlV3t/a5gQChaxRP8u1tYHhE=; h=Date:From:To:Cc:Subject:From; b=PHLnH0W+2qmj6BDWw0UyzQdqrJEmFiflfVADuTg1VRIDiYqiSp7k9wleFdB8ygOGb yz0Ro+XN3ZWKNFc3USwTmqUuLj3yXV+GOuaQ6lCv/Y0sdqBeNHSYMXPStQdGXY0GNS k3rf0yOui7BUXFV+GGiPOqaDRi/lQhj6m+bpgWI4= MIME-Version: 1.0 Date: Wed, 28 Jun 2017 00:42:18 +0530 From: b_lkasam@codeaurora.org To: alsa-devel@alsa-project.org Message-ID: <70ff31e5f7fb35774cc0a9f3764ed144@codeaurora.org> X-Sender: b_lkasam@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Cc: lkasam@qti.qualcomm.com, b_lkasam@codeaurora.org Subject: [alsa-devel] ALSA core info race condition X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" 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 X-Virus-Scanned: ClamAV using ClamSMTP 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. Please check above logic looks fine, and help comment accordingly. Thanks Kasam 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; }