From patchwork Wed May 3 17:35:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Pundir X-Patchwork-Id: 98500 Delivered-To: patch@linaro.org Received: by 10.140.89.200 with SMTP id v66csp166193qgd; Wed, 3 May 2017 10:36:09 -0700 (PDT) X-Received: by 10.98.34.5 with SMTP id i5mr6164895pfi.228.1493832969360; Wed, 03 May 2017 10:36:09 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si12867632pli.35.2017.05.03.10.36.09; Wed, 03 May 2017 10:36:09 -0700 (PDT) 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=pass 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753966AbdECRgI (ORCPT + 6 others); Wed, 3 May 2017 13:36:08 -0400 Received: from mail-pg0-f51.google.com ([74.125.83.51]:36285 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbdECRgI (ORCPT ); Wed, 3 May 2017 13:36:08 -0400 Received: by mail-pg0-f51.google.com with SMTP id t7so81644532pgt.3 for ; Wed, 03 May 2017 10:36:07 -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:in-reply-to:references; bh=trzbLqWeZz0IEe1ikQuYCfee3exUkGgtMQ//RmHvUxI=; b=egJZoYxohn27Ijc+nN6cgggQyd3CrerI96/JMOKeUvzD8Y7eL/SSOZrjQnEWEthKO8 TkRT9oNk/UBsQ7FI/8RYiSZU92JrMhPe/1Xlt43XuumHIJxV9HHPJEMlPE08bSIi7MkA 1+ob6nWJqfAIdpxZpSfkD4xSA3Flyitj31kuo= 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:in-reply-to :references; bh=trzbLqWeZz0IEe1ikQuYCfee3exUkGgtMQ//RmHvUxI=; b=G3Nl9G2g07qIZBzCE63ugXwUgDe9Dha9oLivFeQy1+B0zvtxDoPo1hm10uLC9gSKRV abz68mkQVnlM+fT0UHft3Ic7WQgvcKnOdd+NLWeXHGVjOzl/4UwS2GCg6saMPYTdH2wp jeQKzj3r+X4XFfTOjunAbi46ZgbL8wErQvoZAGKSsyztw7Fl4GPuABc8/hB5dmQmNjcm K96M168o1xes/jXOxz7kvtcxLKhBDx+qiEecQxBUof9kC1bawz2OJUSLmUy2fhogE73k 1EzLfq3HBD2pec3lfHsFYljEv5meRVvO3eH+mfpsqdu61HRIEDgGM3922UQfQegPcBPU FSPA== X-Gm-Message-State: AN3rC/7k8fopVhri4U25NFZLCYUXoqu4NYLqRE4U6bfXqWiEdaPW17e8 BTCPK6HBVJQLRpex X-Received: by 10.84.129.1 with SMTP id 1mr49672986plb.125.1493832967378; Wed, 03 May 2017 10:36:07 -0700 (PDT) Received: from localhost.localdomain ([106.51.135.126]) by smtp.gmail.com with ESMTPSA id c3sm5895206pfg.46.2017.05.03.10.36.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 May 2017 10:36:06 -0700 (PDT) From: Amit Pundir To: Greg KH Cc: stable@vger.kernel.org, Seung-Woo Kim , Mark Brown Subject: [PATCH for-3.18 2/7] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Date: Wed, 3 May 2017 23:05:53 +0530 Message-Id: <1493832958-12489-3-git-send-email-amit.pundir@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493832958-12489-1-git-send-email-amit.pundir@linaro.org> References: <1493832958-12489-1-git-send-email-amit.pundir@linaro.org> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Seung-Woo Kim After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by: Seung-Woo Kim Signed-off-by: Mark Brown (cherry picked from commit 60a2362f769cf549dc466134efe71c8bf9fbaaba) Signed-off-by: Amit Pundir --- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 872e53f15590..b2e183627f53 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1720,6 +1720,8 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev) gpiod_put(pin->gpiod); list_del(&pin->list); kfree(pin); + rdev->ena_pin = NULL; + return; } else { pin->request_count--; }