Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3865992pxb; Tue, 17 Nov 2020 05:44:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxG7+Jn25PsvCOyGZ1uc7EtySmbwDJkHyxmR0MGMNziBD4wg088jG9vvO8aD3VvbzT7Idj4 X-Received: by 2002:a50:d74c:: with SMTP id i12mr21829189edj.236.1605620680011; Tue, 17 Nov 2020 05:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620680; cv=none; d=google.com; s=arc-20160816; b=KrPuJYALWrV0l7AAGnC1aXlZCZvx35/ZB+eQ5DiR2bFwBxr4NgITBNmhw7HKfVfb/j tfxH/kbaCCQ2CC4PWSWe8DvXMO9MKYA7y+B2smt7XuwDqvOFX6qiTEOA2bx89cGSaEGr LZDzSHzPhHqb4tBwGAhJ4gcS6eeuP9wJj/6P6CgU6wqK66booElfTA8llRKZcdf1oPCG 2LMsZFwVMxLquIeo1GZ2WSCsvpzJzSE/82ibAcMx/+QEBiS8f835+qc8Dpm7apThntSE sopFpNI0imbZMiD4sTCaztjQogG9BUMrMR7Ex41Bv/8DAx5qCx4IJc0GHa6V5ESQsamQ zkIA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2ajRDrI4J3lsQsSRVWdN8y+tHLIaya/JJ5EjC9qi1V4=; b=sbCCSxMhE0D27bnIClk1xfD9bvSuDLqh1UCGP8jiZHugUhYUlC/R4xGrjjHdSTEGKi +UMTyltcCiaWR5c5o9dWTLiZPEZLPYDDqqVAJbtYgaNle5+aKXIvq9HuteNRStvTf24B QpD6EZ/m9TYryAn9c++twc8yfWJbmN/R+IW1wbDpwf5PimbJ9nt5Ly1XiK0EgbPgBDIn ik/nHRveb+hJDyI2ZNup3+8FYo23/P3h2fK8yucGUDSqGueOUnmg1GOvp1rG/04vuyOP 0XpOUy+aeMp0O8jja3G7R5rO7IU4wb0FDXUKdPOTXeIwlKKlY3hRIMFtVP9ZYnRnWamP r6hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y/RPhNVf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a6si13416494ejj.398.2020.11.17.05.44.17; Tue, 17 Nov 2020 05:44:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=default header.b="Y/RPhNVf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387489AbgKQNmy (ORCPT + 99 others); Tue, 17 Nov 2020 08:42:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:55316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387465AbgKQNmp (ORCPT ); Tue, 17 Nov 2020 08:42:45 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 122B72468D; Tue, 17 Nov 2020 13:42:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620563; bh=TW0kadzJVG5/0T+RUDy7xRV2L7Vy902zfmm/D1KQlZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/RPhNVf9xhXVKV4oP6dHtjGDokjhioydIITHhSuD2VnORRlqb0pvw0uZpwl0IXkJ IagHh2Zoz7IXiJOXxPm8CVgaMSFdeg/mcDAMckjRTZmavNowSXxBMS9cbLphUQ6OSD G2JLDHdtDqni5zcMIb5wjmlgpnKVk1IpkucYbQjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Leach , Mathieu Poirier Subject: [PATCH 5.9 254/255] coresight: Fix uninitialised pointer bug in etm_setup_aux() Date: Tue, 17 Nov 2020 14:06:34 +0100 Message-Id: <20201117122151.294783768@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- drivers/hwtracing/coresight/coresight-etm-perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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_e 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);