Received: by 10.223.164.202 with SMTP id h10csp3337206wrb; Sun, 19 Nov 2017 19:46:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMa47W0tIpTXb0dkA+qA8TekQBIlAYTWUyKp8cN3S4Nmu+VyPeq4yo52YRxY56UzgBFnEYut X-Received: by 10.99.127.85 with SMTP id p21mr12283216pgn.425.1511149614705; Sun, 19 Nov 2017 19:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511149614; cv=none; d=google.com; s=arc-20160816; b=a39ybrNdPyDefsvahX5TWC15hXF9UUnJRnAkm5CP5WC1HUlXUejt7urH0jT2mg0Lyj SeTE/nTp8bRa3V5zPJLrpVr3yhBdkxv+HMkRLyJyIk6DkgUd6bB8HVfCcrSOv3APbwjX 3bZodXxOtpD0sUF6M5pcFMfFpf3lN5l3O8NfKfRqeiAqj8/WjZQbKxX33EIdEFZ239/t r1pwMR3xeg1x5DxxV6KxenfY/uopkanCKtZrNfhI7uFS35/6Ua7zeSndSmoxo9BrOMUs Ro07vz0bARw6zyBO8mAaYFdoKw5U+XBej66lI6itqzdL/TcnlSsh6iji+YAuXoXVo573 vu7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=XD+087Y5IGKuPq2ohTMeS33npxw36UcY6q/JDds2BU8=; b=cPWDwJRIY/TrChzL/yv/Sbd+ysgvQqZgtUiZLibu0zDUdhjj0loosBB1TD37w/PB+3 d2ESyQ0d8+CuarWgL1bOfmjLSEeRKy8/F4FY+PUvtw0oraBefDCe1AIKw7q1xuSXEuId O9hjgpWmi4vQ0pkrXov79CWeJFNRgfKeCBwRgfLbYfqIhsbv+/zJXvvGUSewbiduzlfl weqx9cN8ThHfMlZDbbDOMHIkS+ds2vS2GgqSsVGO8AJWfTj6V6Cr/BqT25T/dXMZtsxR e+0Q1J4eJx0gjINTXguDHFOnz7qrf+dEo1gNzJcJIpDds/UTws6j1zShEZtW3aMz42e7 1DnA== 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 m8si7930971pfi.343.2017.11.19.19.46.44; Sun, 19 Nov 2017 19:46:54 -0800 (PST) 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 S1751145AbdKTDpc (ORCPT + 68 others); Sun, 19 Nov 2017 22:45:32 -0500 Received: from sci-ig2.spreadtrum.com ([222.66.158.135]:13628 "EHLO SHSQR01.spreadtrum.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751105AbdKTDpa (ORCPT ); Sun, 19 Nov 2017 22:45:30 -0500 Received: from ig2.spreadtrum.com (shmbx01.spreadtrum.com [10.0.1.203]) by SHSQR01.spreadtrum.com with ESMTP id vAK3hTJ2054940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Nov 2017 11:43:29 +0800 (CST) (envelope-from Chunyan.Zhang@spreadtrum.com) Received: from SHCAS02.spreadtrum.com (10.0.1.202) by SHMBX01.spreadtrum.com (10.0.1.203) with Microsoft SMTP Server (TLS) id 15.0.847.32; Mon, 20 Nov 2017 11:43:37 +0800 Received: from localhost (10.0.73.143) by SHCAS02.spreadtrum.com (10.0.1.250) with Microsoft SMTP Server (TLS) id 15.0.847.32 via Frontend Transport; Mon, 20 Nov 2017 11:43:36 +0800 From: Chunyan Zhang To: Stephen Boyd , Michael Turquette CC: , , Cai Li , Orson Zhai , Chunyan Zhang Subject: [PATCH] clk: fix a panic error caused by accessing NULL pointer Date: Mon, 20 Nov 2017 11:38:16 +0800 Message-ID: <20171120033816.28414-1-chunyan.zhang@spreadtrum.com> X-Mailer: git-send-email 2.12.2 MIME-Version: 1.0 Content-Type: text/plain X-MAIL: SHSQR01.spreadtrum.com vAK3hTJ2054940 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cai Li In some cases the clock parent would be set NULL when doing re-parent, it will cause a NULL pointer accessing if clk_set trace event is enabled, since the trace event function would not check the input parameter. Signed-off-by: Cai Li Signed-off-by: Chunyan Zhang --- drivers/clk/clk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index c8d83ac..64efaf0 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1242,13 +1242,12 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent, old_parent = __clk_set_parent_before(core, parent); - trace_clk_set_parent(core, parent); - /* change clock input source */ - if (parent && core->ops->set_parent) + if (parent && core->ops->set_parent) { + trace_clk_set_parent(core, parent); ret = core->ops->set_parent(core->hw, p_index); - - trace_clk_set_parent_complete(core, parent); + trace_clk_set_parent_complete(core, parent); + } if (ret) { flags = clk_enable_lock(); -- 2.7.4 From 1585933812534556052@xxx Tue Dec 05 08:59:04 +0000 2017 X-GM-THRID: 1585829883368977566 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread