Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3297276pxk; Mon, 21 Sep 2020 09:59:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSTQNVtCwLU30f5KLuDDNycwPeQSNiUvYiDPiRKW/F+cabqfWeWCa7BfzymSE+AiTznf6d X-Received: by 2002:a17:906:8682:: with SMTP id g2mr426614ejx.110.1600707580066; Mon, 21 Sep 2020 09:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707580; cv=none; d=google.com; s=arc-20160816; b=aCzcBSClgS6TqXSnc5zBnwoNh9EU/t+uFW4AeSCTPhHjtYo7tvTiIIAvdZ9lT8oTpW AH9I+D2NtUvx6V4LFBeBMoaVjuYdWYSSZpFV5qt3UXDPeZuEkrB3bmKecyZe1HVqPp9K S0nmlxbHJk9xNixHim/X5GoZZKOQtUuKyyoz5fy9ZAaZEXEZLcyoPY81AKQwsb2VTy9b rRv4fIVDGlRAGwDUzB2xKitQuqxDv+rWKvJu28vh3l16j4FsGdcQ+sKmWKm46fPqUjfp +yYwcp1kLpFYhl721jzcRLVfZcwUWEpr8u1LDLnIKf0DpfqCNOlUzgjB0B/kGhqlKPoY rh+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8t7oz6hm4vlmdm/2lmezkdeYcY4L1K1ESpeCxI4nAaM=; b=swXrZDgv5tE9Uj2SiA5SYuSZ3/0lN0hP653AmCT+0b8TISTUUTPRSrIC3uaMSR8zpm 77pvw5xJ1iFmA647BHAwSN6WnkWUN7Lusb1n0QCjQQ7XgeExkUVJZkHyBaxiJp1N2FUf 6Gh5+qTI36GH2wDDh4AHSL1ejYFx7H0wFQlFnU7+tWdMzyA3IYTsmFw20Km8ELpnKD3J Zc1oxpZSzmHnwN7fnZs0Gxik7g9aM+qMoO30SSe5CiyfVpg17uTHk6cKPWrYMeAxeZhi QHs/c3zNNq77MNcJdHCZE23iCqmnWpEq15eSD9Gy1TM4jkv0h1twncfxLqeIEj+7k3DG bs6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gWyLsnPY; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si8303394edx.591.2020.09.21.09.59.16; Mon, 21 Sep 2020 09:59:40 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gWyLsnPY; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729013AbgIUQ5F (ORCPT + 99 others); Mon, 21 Sep 2020 12:57:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729330AbgIUQob (ORCPT ); Mon, 21 Sep 2020 12:44:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F81923A03; Mon, 21 Sep 2020 16:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706665; bh=3ioXhZTkuCbwVoUSCKevH6YI1Uibc46lPepIcXAm9mo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gWyLsnPYVbo+uqSBeyRAdo4/SSJiRRB71Oct/MNYZLuAiXvaPiqJx94+OAyRvR7p3 KuqFKBmMPvkkVLn+YIEbr4Np1IAz7VLGQdqB9UX2Q4Tgi1vMs4nPkUoYvoDhV08i0Q n55AV/FNa4L52BCIy7+M7fzqnqmqiMxJMVvnfV+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Mark Brown , Sasha Levin Subject: [PATCH 5.8 044/118] ASoC: qcom: common: Fix refcount imbalance on error Date: Mon, 21 Sep 2020 18:27:36 +0200 Message-Id: <20200921162038.358828139@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinghao Liu [ Upstream commit c1e6414cdc371f9ed82cefebba7538499a3059f9 ] for_each_child_of_node returns a node pointer np with refcount incremented. So when devm_kzalloc fails, a pairing refcount decrement is needed to keep np's refcount balanced. Fixes: 16395ceee11f8 ("ASoC: qcom: common: Fix NULL pointer in of parser") Signed-off-by: Dinghao Liu Link: https://lore.kernel.org/r/20200820042828.10308-1-dinghao.liu@zju.edu.cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/qcom/common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 8ada4ecba8472..10322690c0eaa 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -45,8 +45,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card) for_each_child_of_node(dev->of_node, np) { dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); - if (!dlc) - return -ENOMEM; + if (!dlc) { + ret = -ENOMEM; + goto err; + } link->cpus = &dlc[0]; link->platforms = &dlc[1]; -- 2.25.1