From patchwork Mon Nov 16 12:35:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linu Cherian X-Patchwork-Id: 324384 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp3280226ils; Mon, 16 Nov 2020 04:36:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzizmo8MWwlXg2LM4YrQMWa+wAu5FpmL89YNb1UIWGGUdZlpmNysiMzAsweJ2J74tNop1Y/ X-Received: by 2002:a17:906:b294:: with SMTP id q20mr14376206ejz.234.1605530161139; Mon, 16 Nov 2020 04:36:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605530161; cv=none; d=google.com; s=arc-20160816; b=AOJtlMIhk5x01FqCFQW++ozy++3YI8BAnRC/CeyplqhuSTY4tXIgIumhx/Mlgj+TlJ IujhTnsXoy5RXN2GW6/aviq0M5Tl+z/9C1cOJUXeIuC89JdUWExNJKztkF2u/sUIkVKT hdVZHwd/bvvXEQFSp+Yy9L39gmk4JSnJlzEs7Fe3AFdkZ6lbEC5qeSS3eCTeEDLizKwY S1b4gCKAsqj+rtX0mukl8AZGpGnLZZHQv0sE0ysnezMvdMQACDikFhn5JsoBNo5JTaBg 3NumlyxgG+UDMsQPolprnaFbpdQpQsKluhm8EdLz6M/a47ly8Ne01j8ZWnXs8bqcYom+ ohfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bMiMF6bHUEJrWeAPNW+vYTur1i8lIXjWzs+JyUKd0jo=; b=bALzRk0wdHyaaZ5TZyxaK0w6bPuVyXs3irOu5BermKoQ5stvFK+tAu3WsEBLYD+69/ eLEWRM2zgGhlbQQRWy8FWkq2WxGyA1bjtnCqghMkBU0Px54CIqJyfy1ZjvAr8WyF+bg/ vllm3s1NWYwu0flNKrpg+PbCtVswyZFwwznlbkZa/7YoPy3EHbFlbhHL5q2ZiYCA+Gwd IXDvuz9ulRcMH1DYJIBMW5bK+wlZdb1vluC6lGoWmC1xTuQl7oZCVyl2RrZSTuWjUQtP vX4hpTkf75Hprs+8fqrzOr/w0CLwdktpC6wI4AheXQB2t1gJfXUxITF/y9W17uJt1xfH Ruhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=WILndzDa; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si11776395edq.305.2020.11.16.04.36.00; Mon, 16 Nov 2020 04:36:01 -0800 (PST) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=WILndzDa; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729531AbgKPMgA (ORCPT + 15 others); Mon, 16 Nov 2020 07:36:00 -0500 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:26914 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728329AbgKPMgA (ORCPT ); Mon, 16 Nov 2020 07:36:00 -0500 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0AGCU5v1022152; Mon, 16 Nov 2020 04:35:49 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=bMiMF6bHUEJrWeAPNW+vYTur1i8lIXjWzs+JyUKd0jo=; b=WILndzDaEHmtt7ZMcCL1eNEq3zw01ROj5f6S1aHkn5Vx6MoX2s9dWrsWxZ1RamwE7d5w cgpzteeynboUbSsa49g/4O2YFiaFcsXBTGSvCxpxsGl5lx9HgC+MCKE5hYyfycLnJKR4 9lg0+hgmChVBcLIEySd2v1se+gMmE3sU6/JfhjJFlSUoUGJ41MxNgbTfJepm18nTBVBE n7Mlyh24tTB7utKleP0lSJfl0uGGvys4ZxN6IywckkFy0bLlCwI7l+Cx+DzU6MJqTeVQ FI7cyuPnLOt9uuGI8r+Ac1mOfVAvV8xL/+WQECi1XSeijLk+RNDf6CTBQ4njitGE/yrE Bw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 34tfmscxcs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 16 Nov 2020 04:35:49 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Nov 2020 04:35:48 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Nov 2020 04:35:47 -0800 Received: from virtx40.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 16 Nov 2020 04:35:44 -0800 From: Linu Cherian To: , CC: , , , , , , kernel test robot Subject: [PATCH stable-v5.9 2/2] coresight: Fix uninitialised pointer bug in etm_setup_aux() Date: Mon, 16 Nov 2020 18:05:10 +0530 Message-ID: <20201116123510.28980-2-lcherian@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201116123510.28980-1-lcherian@marvell.com> References: <20201116123510.28980-1-lcherian@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312, 18.0.737 definitions=2020-11-16_05:2020-11-13,2020-11-16 signatures=0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mike Leach commit 39a7661dcf655c8198fd5d72412f5030a8e58444 upstream. Commit [bb1860efc817] changed the sink handling code introducing an uninitialised pointer bug. This results in the default sink selection failing. Prior to commit: static void etm_setup_aux(...) struct coresight_device *sink; /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } else { sink = coresight_get_enabled_sink(true); } *sink always initialised - possibly to NULL which triggers the automatic sink selection. After commit: static void etm_setup_aux(...) struct coresight_device *sink; /* First get the selected sink from user space. */ if (event->attr.config2) { id = (u32)event->attr.config2; sink = coresight_get_sink_by_id(id); } *sink pointer uninitialised when not providing a sink on the perf command line. This breaks later checks to enable automatic sink selection. Fixes: bb1860efc817 ("coresight: etm: perf: Sink selection using sysfs is deprecated") Signed-off-by: Mike Leach Signed-off-by: Mathieu Poirier Link: https://lore.kernel.org/r/20201029164559.1268531-3-mathieu.poirier@linaro.org Signed-off-by: Greg Kroah-Hartman Reported-by: kernel test robot --- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 75379184f391..9a8d03e62a75 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -210,7 +210,7 @@ static void *etm_setup_aux(struct perf_event *event, void **pages, u32 id; int cpu = event->cpu; cpumask_t *mask; - struct coresight_device *sink; + struct coresight_device *sink = NULL; struct etm_event_data *event_data = NULL; event_data = alloc_event_data(cpu);