Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp681246ybm; Wed, 22 May 2019 09:43:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMH4rQcHlc1Z738apHwpXx63tSVnI0+3mfKz60Y7zJM8sIOB2Q6o468NdPjwO/fPsg28N0 X-Received: by 2002:a63:a849:: with SMTP id i9mr90421246pgp.205.1558543386096; Wed, 22 May 2019 09:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558543386; cv=none; d=google.com; s=arc-20160816; b=yyMlTF+dyq6uo+aJwccmJk6a3/oOQN5kOnd8FO1hrlzbanTmHgMeD6xSQQWBN9rwKn CcecUGVUz8q8gsyjgc930jV8RgOXktycTBn977WVTAbWKdH0wdu6NmZymHJ+uRmhfpdh zWM7XtYdjGZln16uHKEyptf9wJX7O7m9tHZIVBP0SD/gh7n1vuK8ntx4C2dvPHqMhlw1 QXauk/uHbOCKssc1cLYSEoJuzdAPWhHFOJKplgTZQZBa4LdnwJYBRb3vM3+5m57qihUA SYvKwVBnviq9Ueu/BeQ8MmburGp7k5wbuTHG5abwLaXGsRq0yHmRDXXv+tgeRmoezlHS UYog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=GdRKoxEYkGtSotzRDZgkFDT/s2LpLXEMXjfU5tTjVx8=; b=j7S+zEpmX3b3IYaHl0t1Pk/V0otvvqCleuzQB7PxigmG0cPCLec08ja2MqkxZ0vCTB Tgg4TuLtWXFkurXrH3k92f6r6uFCd4EgJenSAaqoTzmGBvTa+5orkViaFCNcktRfuaAQ oafCs0eqg3AJI0vIvB/8GMu0T6TNQGId+//a7YeRbLSfgsQdAPPD3efQZbaufbz7QoKZ SXO1xF1bdd2z23C77MXJImFYkq6J8RTN3R+/cKQMZn+6CpRWoUbcvBp3gYVRx2lXQetf bzoy+hlf/isFpr/gzJGYE601dIExk3zvpXkAbovvUWRauukyaUr5NETxnB+b0cqE3VnA d/rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w69si18439542pgd.165.2019.05.22.09.42.49; Wed, 22 May 2019 09:43:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730127AbfEVQlk (ORCPT + 99 others); Wed, 22 May 2019 12:41:40 -0400 Received: from mga09.intel.com ([134.134.136.24]:4136 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbfEVQlj (ORCPT ); Wed, 22 May 2019 12:41:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 09:41:39 -0700 X-ExtLoop1: 1 Received: from sydneywa-mobl1.amr.corp.intel.com (HELO [10.252.132.240]) ([10.252.132.240]) by orsmga004.jf.intel.com with ESMTP; 22 May 2019 09:41:38 -0700 Subject: Re: [PATCH] soundwire: stream: fix bad unlock balance To: Srinivas Kandagatla , vkoul@kernel.org Cc: sanyog.r.kale@intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org References: <20190522162528.5892-1-srinivas.kandagatla@linaro.org> From: Pierre-Louis Bossart Message-ID: <4744834c-36b1-dd8d-45fa-76c75eb3d5cb@linux.intel.com> Date: Wed, 22 May 2019 11:41:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190522162528.5892-1-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/22/19 11:25 AM, Srinivas Kandagatla wrote: > This patch fixes below warning due to unlocking without locking. > > ===================================== > WARNING: bad unlock balance detected! > 5.1.0-16506-gc1c383a6f0a2-dirty #1523 Tainted: G W > ------------------------------------- > aplay/2954 is trying to release lock (&bus->msg_lock) at: > do_bank_switch+0x21c/0x480 > but there are no more locks to release! > > Signed-off-by: Srinivas Kandagatla > --- > drivers/soundwire/stream.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c > index 544925ff0b40..d16268f30e4f 100644 > --- a/drivers/soundwire/stream.c > +++ b/drivers/soundwire/stream.c > @@ -814,7 +814,8 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) > goto error; > } > > - mutex_unlock(&bus->msg_lock); > + if (mutex_is_locked(&bus->msg_lock)) > + utex_unlock(&bus->msg_lock); Does this even compile? should be mutex_unlock, no? We also may want to identify the issue in more details without pushing it under the rug. The locking mechanism is far from simple and it's likely there are a number of problems with it. > } > > return ret; >