From patchwork Sun Jan 22 21:17:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 92194 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1071647qgi; Sun, 22 Jan 2017 21:16:56 -0800 (PST) X-Received: by 10.84.238.203 with SMTP id l11mr16329807pln.95.1485148616224; Sun, 22 Jan 2017 21:16:56 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si12380950pgi.336.2017.01.22.21.16.55; Sun, 22 Jan 2017 21:16:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S1750708AbdAWFQy (ORCPT + 3 others); Mon, 23 Jan 2017 00:16:54 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:34118 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbdAWFQy (ORCPT ); Mon, 23 Jan 2017 00:16:54 -0500 Received: by mail-pg0-f48.google.com with SMTP id 14so41617315pgg.1 for ; Sun, 22 Jan 2017 21:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=AdtjTG7h/PowMIpObTHFAD5FykXwupMSCRG6BRy6RVI=; b=VUeXNG8EHbr9srxCRAJNvsiNqaDjPSu+80NgCYZaPVfuHwVHBr100xqkJDlZ1WAh3T toJEJKWe9cPvgFvKUSGaR+bQBqtvFDC9dKWlcKgK1QwRMTceEOxNoxnDSizBuZExocqK DAut5KiDqWyatqOlMSQaL2+znsRaCrS8VGHw4= 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=AdtjTG7h/PowMIpObTHFAD5FykXwupMSCRG6BRy6RVI=; b=hg2tjJ4Y8xZuhI6T+HuKxxntZOd509iDlLCivPy5xM9sPsSQL+aHeGvbOD7Ws3D4go /Q9ysd7fi8iDRuG48yR+PyjqYLsAfQJliOlt9kMU2SvpvsaLkPcljHLl5f+I9Frphlol HtBQEgFcuyBcZj1QUG863hSuMY6c7FcFFLWpyhQFeLdY6bvPYyuk133RbiM6ZfkeYKp+ 26ZFZyHMToqWqtMQ/5N6f5rkRq65TrQ5ZMrtEIwwf8dTfJ0kqWF0LFIjTEmEjihf8WjO x4Wp78g14tRB7/XkCDvTDCMTQhjNpSfskLWaJzrm3GN4KRSXNNdRuVvX7X9vk5+Xyicm rldA== X-Gm-Message-State: AIkVDXKvQaDG6xkQba2eGvI1ioegj/UxGd1Pb7if4n8bT1X3XW2Ab27RYiE51aK3QJR11nmJ X-Received: by 10.99.42.78 with SMTP id q75mr30328679pgq.144.1485148613523; Sun, 22 Jan 2017 21:16:53 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id 18sm33169100pgf.28.2017.01.22.21.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jan 2017 21:16:52 -0800 (PST) From: Bjorn Andersson To: Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 1/4] phy: qcom-ufs: Don't kfree devres resource Date: Sun, 22 Jan 2017 13:17:46 -0800 Message-Id: <20170122211749.22803-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Upon failing to acquire regulator supplies the qcom-ufs driver calls kfree() on the devm allocated memory used to store the name of the regulator, leading to devres corruption. Rather than switching to using the appropriate free function the patch acknowledge the fact that "name" is always a constant string and we don't actually need to create a local copy of it, but rather just reference the constant string. Fixes: add78fc05702 ("phy: qcom-ufs: Use devm sibling of kstrdup for regulator names") Cc: stable@vger.kernel.org Reviewed-by: Subhash Jadavani Signed-off-by: Bjorn Andersson --- Changes since v1: - Added fixes and Cc: stable@ - Added Subhash's reviewed-by drivers/phy/phy-qcom-ufs.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe stable" 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/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c index c69568b8543d..4d7f3c018223 100644 --- a/drivers/phy/phy-qcom-ufs.c +++ b/drivers/phy/phy-qcom-ufs.c @@ -217,12 +217,7 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, char prop_name[MAX_PROP_NAME]; - vreg->name = devm_kstrdup(dev, name, GFP_KERNEL); - if (!vreg->name) { - err = -ENOMEM; - goto out; - } - + vreg->name = name; vreg->reg = devm_regulator_get(dev, name); if (IS_ERR(vreg->reg)) { err = PTR_ERR(vreg->reg); @@ -265,8 +260,6 @@ static int __ufs_qcom_phy_init_vreg(struct device *dev, } out: - if (err) - kfree(vreg->name); return err; }