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: 137626 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1374532lji; Mon, 4 Jun 2018 04:15:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKxB2XZd6BI994K6sRJYU+gScu9CqhPluQkwC+c7ZgbngRXFkwG/Xcjl2HZlSbtGPwGmN89 X-Received: by 2002:a63:a344:: with SMTP id v4-v6mr17192733pgn.442.1528110937155; Mon, 04 Jun 2018 04:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528110937; cv=none; d=google.com; s=arc-20160816; b=KWTxzVxEGm1+e/LScNgSH6YeSNRSuFYBMLj0bmNW1tc8htS0wqzY+46mDYUYaUIs+P 47O5SLHlO1YhiMCcaDSFdK3wbUweoZ9ldQDafZKch7Co6/SieflYaJ+X39P0wxUFVH8I Z1BrUKSlIobKr/Lds4rYC4aU9v79djNPo4h2vk3wSbkH80vV1oEJK2vkULUyVy5lSGaj 4nj0MdxtIRri9fyvMAR4xVQSQXOaNSZRqqdC2IDZzWiecSj9gkXVEVM37Eli5nsqtz3o BooDhTS85xLd4uPnLgVLumlr9Ga6rNxgMCI5v++7+vtEIrLdr6Cy39KogbUP68HIKuHB 9GWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=A4V5XWDIwI228PEUZUk/JNtF99C+cJJgxFONDOpGfVI=; b=YgQnhXx0UpZHQUrJKej/c5yDonXwf6lebM+yPYwmF/nyrpso+Xd3sgEArA/uC2vVWr e6/tIYtYjbeB9+EH86uokNo9maedSttiI7uNECatZCiHWJ6mxUPb+bHJj/Ps9ws2ltpF PBm/GFXHrM1Bt/bzt43Hh+gjtlMHz/jU11Y2saIiXz2BkuCE2vORiay45KFQRP/JIA4u gmS7IKmzmTVZ9TvF3wKgLoeZlXH89oY/DjFouNHaaoirTV6UMVm7127sDyEKeaRsDc6T fXB3NOMq/dsnVfL/TEyNTj4oMrc8Yumh8KvK8rKm8+wZ5uAUfNNWcF1TGbuaQ5l3l5EV C9tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fmYltAxO; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si45879987plp.25.2018.06.04.04.15.36; Mon, 04 Jun 2018 04:15:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fmYltAxO; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752261AbeFDLPg (ORCPT + 13 others); Mon, 4 Jun 2018 07:15:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52809 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752179AbeFDLPf (ORCPT ); Mon, 4 Jun 2018 07:15:35 -0400 Received: by mail-wm0-f67.google.com with SMTP id p126-v6so5824135wmb.2 for ; Mon, 04 Jun 2018 04:15:34 -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=f2S/5ASGjqWtU9g9RQoSv7gUydd26uqp0TiPn+FXHZ9Ot1m8yiSH3vpfONV3SoLxBE YvoILD1nSC2nsMo5PtAhzI+k3l7XmnBvRm0T2BnfuUCz8CO5f+oqdoXS0RL/s92UzC2I W1O0rhldg44IJv7UnBVfG2X8aurBlXBeQBYV/fL3rkwLdEjTrApsQ4YrPD2I0Tl+B3xV wLDvsq6D/FOxq5MeMKPQ+Sl7a5Q+7AKg2lCGSjzRMR2FbvdqbE4ZKcF9d0A8fHe1DgDq AWQZ+VIj2GzXQPZcWs1IM/SFGkrRoGsgKWEs5BEGdU5ddZPjwQfpJXCb5H1V28UzIMwx JDDw== X-Gm-Message-State: ALKqPwfTbbdSFBSyF04INIKDL0ZYh6HkptHl3cxhI6S0CKan/UuJKPD/ 0UYs/dy1Xa05oEtHZlVDrajY4Q== 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 Cc: linux-arm-msm@vger.kernel.org, lgirdwood@gmail.com, bgoswami@codeaurora.org, tiwai@suse.com, perex@perex.cz, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, rohkumar@qti.qualcomm.com, Srinivas Kandagatla 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(+) -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }