Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2520849imm; Mon, 24 Sep 2018 05:52:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV61XaMdkRckuPp+TFcGuQs6BA/vVkJ6deNsNghdM4z8DAGLLTdC7zrfxWMYLkS2RbF+uYk+f X-Received: by 2002:a63:3e06:: with SMTP id l6-v6mr2081586pga.96.1537793530755; Mon, 24 Sep 2018 05:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793530; cv=none; d=google.com; s=arc-20160816; b=JkC6avBibbruCdYWR5e+Ggg8lLW6+xVMLuq+ID+9GQl6fKoEGGMTj2iYNcRnWHY1Xr ApBvCqvt3i3sTpKJM6oyYBD3QP+vj7x9LGOkZWptOVb/uprph+tjzvQHFD0/HBeCdk07 lj6vXX7N85mejd1b8daCWh1L5zGoZ1vysNEzen446G8GVUI8L8hHgFqP3zENvge0Wvrb sZMm9uXpALfxjAbgO53RcZyZDwcv1NvsGY4VKiDo2ZN8giZigomWEqCppOmHCuJnytS5 e3Wcaakm9QEpKwV3+5nW7O1SARcBcR/SxVCcoDMkV4rzMXRhCBgjHbSYh/6k1OBrj46G 5TGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=vN9Savb8xUSnpZXbkYMu4V29YCekhMCZhN9PaE9cat8=; b=Chp2q9zgRxN5FegZnlXt3Ovqa//ZeYtm39xuYMIbTrbGJNAitt9mmCVRDI4YBHIxe+ zbDSAKMkGLrQajRZpgdYuBJze+2g8+jy4SiELcGisPyHVngTud9gY/a9VNuecDdPe/Rd yFBNg23lE0Z9P/J9cHXV73SgdGI7GF4M25iyXAXBHQm1GM4hQVEzVgtmWj7CgFu3FG+Y Ro+51LAcpvc1c19URO2oYKxMhLXrSTHRk4R+F1LYRiPBZwvd4AK/E5FNeJMyXMgQ8ycg ghJNZfKCyGwvn/kO28KdcZYiJjdGdzSsGk8hn/Wa+LvZnA26Q9161PrgXVtf7uRfGb96 +JWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e186-v6si37121748pfa.107.2018.09.24.05.51.54; Mon, 24 Sep 2018 05:52:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387539AbeIXSaX (ORCPT + 99 others); Mon, 24 Sep 2018 14:30:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57452 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730974AbeIXSaW (ORCPT ); Mon, 24 Sep 2018 14:30:22 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3BFA11018; Mon, 24 Sep 2018 12:28:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikko Perttunen , Leonard Crestez , Stephen Boyd , Sasha Levin Subject: [PATCH 4.18 032/235] clk: core: Potentially free connection id Date: Mon, 24 Sep 2018 13:50:18 +0200 Message-Id: <20180924113108.106343137@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikko Perttunen [ Upstream commit 365f7a89c881e84f1ebc925f65f899d5d7ce547e ] Patch "clk: core: Copy connection id" made it so that the connector id 'con_id' is kstrdup_const()ed to cater to drivers that pass non-constant connection ids. The patch added the corresponding kfree_const to __clk_free_clk(), but struct clk's can be freed also via __clk_put(). Add the kfree_const call to __clk_put() and add comments to both functions to remind that the logic in them should be kept in sync. Fixes: 253160a8ad06 ("clk: core: Copy connection id") Signed-off-by: Mikko Perttunen Reviewed-by: Leonard Crestez Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -2933,6 +2933,7 @@ struct clk *__clk_create_clk(struct clk_ return clk; } +/* keep in sync with __clk_put */ void __clk_free_clk(struct clk *clk) { clk_prepare_lock(); @@ -3312,6 +3313,7 @@ int __clk_get(struct clk *clk) return 1; } +/* keep in sync with __clk_free_clk */ void __clk_put(struct clk *clk) { struct module *owner; @@ -3345,6 +3347,7 @@ void __clk_put(struct clk *clk) module_put(owner); + kfree_const(clk->con_id); kfree(clk); }