Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp220852pxu; Fri, 4 Dec 2020 01:21:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpnk7d4Nyt936Rrt9L8j3MtRVN3qSOu+s+fZDwBNm8bT5SJimLDby8bzMAhOJ7Agm/TuFv X-Received: by 2002:a17:906:3ec8:: with SMTP id d8mr6323809ejj.32.1607073715047; Fri, 04 Dec 2020 01:21:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607073715; cv=none; d=google.com; s=arc-20160816; b=shp9f1lm2OH9vbXasHEs0OTYYT7/rlXuCoFPXypbdZPsdjvjPpONqnUvxsMjzigR6w twEvbXeczU2X2dG46S72f1XZ51ssN/GOkjOa57fuQ+rSVtSJASwbIg2/6ZqPf8SoP2ee EdVSIi+3aqKP7y7qdk7jYzi3epIKmNSmAD5SkDlU5/7oWPg99NW0wKbaiBWuk9Guwkob 4egxtOERAgMVWVt+igXPyTds46NWse7NWThUW0i4B1bfyiWlpNo4pfqmPniaVnQJD3np m+GABrnCaHY/tap/WY5eZfsNAjoZH65lGTwrCdVfLCXYxybOzcMjQyqHQk0t682zEiAq SCsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=Kdtz3HARqFbALKv/+aEZLsJpjgTlMzqyev1sm5H8V9w=; b=OuPy+O/ZEH+Ecnbsv6z8N/QR0tqCb7Mrug3GdjVFbnO0ZohuDNr7m7owLmwYHtfzh4 ltQBO6A1Dp6oOR2UqPEubKLhRs87FQ1yn1HY5nDAgV0EMM3AUqoVGP9zvzxIiJ2taVIQ p89zPviEZRw/liPqRbQCufNNoQHGwU/Ds9IUL++RqU2fHoya2w0wQ3Xsdq/+y35e+PF/ zCD55KmwN/YOxryIRmuSlJYonruXPGgK5OdFLlyUvMIbcYjV8Ig/hmBTdt29tvCUt8XV YK0pCxXh3YOLHQmuOnFZyo3x+Puj6m55jLxtFkKFJ2yY93gut26irYi64AWs2dprOfNR macA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si980879ejb.322.2020.12.04.01.21.32; Fri, 04 Dec 2020 01:21:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729527AbgLDJUL (ORCPT + 99 others); Fri, 4 Dec 2020 04:20:11 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:8648 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728279AbgLDJUK (ORCPT ); Fri, 4 Dec 2020 04:20:10 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CnRwN0GQKz15XR8; Fri, 4 Dec 2020 17:19:00 +0800 (CST) Received: from [10.174.179.81] (10.174.179.81) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Fri, 4 Dec 2020 17:19:25 +0800 Subject: Re: [PATCH] staging: greybus: audio: Add missing unlock in gbaudio_dapm_free_controls() To: Johan Hovold , Vaibhav Agarwal CC: , , , , , , References: <20201204021350.28182-1-wanghai38@huawei.com> From: "wanghai (M)" Message-ID: Date: Fri, 4 Dec 2020 17:19:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.81] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ?? 2020/12/4 16:40, Johan Hovold ะด??: > On Fri, Dec 04, 2020 at 10:13:50AM +0800, Wang Hai wrote: >> Add the missing unlock before return from function >> gbaudio_dapm_free_controls() in the error handling case. >> >> Fixes: 510e340efe0c ("staging: greybus: audio: Add helper APIs for dynamic audio module") >> Reported-by: Hulk Robot >> Signed-off-by: Wang Hai >> --- >> drivers/staging/greybus/audio_helper.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/staging/greybus/audio_helper.c b/drivers/staging/greybus/audio_helper.c >> index 237531ba60f3..293675dbea10 100644 >> --- a/drivers/staging/greybus/audio_helper.c >> +++ b/drivers/staging/greybus/audio_helper.c >> @@ -135,6 +135,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, >> if (!w) { >> dev_err(dapm->dev, "%s: widget not found\n", >> widget->name); >> + mutex_unlock(&dapm->card->dapm_mutex); >> return -EINVAL; >> } >> widget++; > This superficially looks correct, but there seems to be another bug in > this function. It can be used free an array of widgets, but if one of > them isn't found we just leak the rest. Perhaps that return should > rather be "widget++; continue;". > I think this is a good idea, should I send a v2 patch? >