From patchwork Mon Jun 4 11:13:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 10446343 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 3B9D760284 for ; Mon, 4 Jun 2018 11:15:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3BF26E74 for ; Mon, 4 Jun 2018 11:15:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E4E128C2A; Mon, 4 Jun 2018 11:15:57 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B75C026E74 for ; Mon, 4 Jun 2018 11:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=CYmhMDXMGB8qdplpjlW96gNMmZftmUYFmGE6gSgIyF0=; b=RU8 RG4xvoHuU30rAe4+Bw1azO4ml8Jm0yblfj/aO+w3nF6PGD827WPiM0qiTAVjnonJCC2Mxy6gGSuTB kcjjMhdOFrNYXhwAPOjGEDtMrjBwAA9RgeORXWDlWEkZpsKd7bgN/IFD3+mp3WctJdbYvactc8KG3 g+Czh8xkMIP6CvMM1Mo7U/ZHZTyrdzFvB3jYVHoQj5y438LPAe79lNpbw2VizfvsEiEn26yaPf0rI ZYc8qXeAiNqUlf4ILKk4mEcen7KImdpSY4HQd+dRtguwrzxDEvgD4yF7T9z5hxeejc2LEXSE9HObW g7FYS6q6urPfdNiYDBY/2p2KudBY+qQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPnSn-0006Nk-PD; Mon, 04 Jun 2018 11:15:49 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fPnSk-0006LS-9D for linux-arm-kernel@lists.infradead.org; Mon, 04 Jun 2018 11:15:48 +0000 Received: by mail-wm0-x244.google.com with SMTP id j15-v6so14122786wme.0 for ; Mon, 04 Jun 2018 04:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WWwRbplkCIj6tECE6ciACyoqRu0p9rYIlE8uf1QFvSA=; b=fmYltAxO5TAHTaI17aDtiAKo4Qk3MhaXoVB30tcQHticHagygKmAkqill70KZqsnbF bbFHrUhs92BmzLc2cfN3CyetX6nGjkFxINsNUu1pfrM+bFMXVK72tjsUiEbnlIOoRopS 6bcB5uKtKagPrqqxrk0r7BsPY+OspiUv3xbRU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WWwRbplkCIj6tECE6ciACyoqRu0p9rYIlE8uf1QFvSA=; b=nifE5UgN/caO5qvzUuRGqwDMkowTTD/cGlNkAVo6aDpXsxpFZUWXujM3MjuzXyDz0E xwnM7y4Y2+OY8dmryIskpI5x68ZYDx2l+uZzyW8wM3oD4fMq6SBz8f6DVc/d26yqSed+ WvRA8RRsGd/nC53OZ+o9pSqY4L3bAg//7oBVR2zsp9eCLy9tzyVfnwnTld78o69Y+nJu kPQ5q+MCqYKzLK8bHwYYufXpnKiItNQoIq2fvr1HVkgYel+EynohD4vG5BMFlhRd8ZPQ 1e/vyIMBVhz8LD5l1kEOi+A7VYTBuCO8R66jeybK6MwIQq3rfLvSc7pXFJ6VVJuFjt7j plGw== X-Gm-Message-State: ALKqPwduRo9L+AfzvI8mecaejdQDCVLKU/08V3b354MLZ9Tzhw1CVqCc RO7kZ+PkLJI1gdSFi/1wqa1unQ== X-Google-Smtp-Source: ADUXVKIv1ziHWp8b+zLXqzMFMWB5eiCe9/9lXZcP3j60E4nKA2CzWjRePo37O9AoaYuRRYGoJva1JA== X-Received: by 2002:a1c:6fce:: with SMTP id c75-v6mr8532811wmi.83.1528110934161; Mon, 04 Jun 2018 04:15:34 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id b204-v6sm8534478wmh.22.2018.06.04.04.15.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Jun 2018 04:15:33 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2] ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it Date: Mon, 4 Jun 2018 12:13:26 +0100 Message-Id: <20180604111326.15708-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180604_041546_343898_D1D2F2C1 X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: rohkumar@qti.qualcomm.com, bgoswami@codeaurora.org, linux-arm-msm@vger.kernel.org, tiwai@suse.com, lgirdwood@gmail.com, perex@perex.cz, Srinivas Kandagatla , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP dapm_kcontrol_data is freed as part of dapm_kcontrol_free(), leaving the paths pointer dangling in the list. This leads to system crash when we try to unload and reload sound card. I hit this bug during ADSP crash/reboot test case on Dragon board DB410c. Without this patch, on SLAB Poisoning enabled build, kernel crashes with "BUG kmalloc-128 (Tainted: G W ): Poison overwritten" Signed-off-by: Srinivas Kandagatla --- Changes since v1: -remove unnecessary very long bug trace. sound/soc/soc-dapm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 1e9a36389667..36a39ba30226 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -433,6 +433,8 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, static void dapm_kcontrol_free(struct snd_kcontrol *kctl) { struct dapm_kcontrol_data *data = snd_kcontrol_chip(kctl); + + list_del(&data->paths); kfree(data->wlist); kfree(data); }