From patchwork Tue Nov 17 13:06:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 325377 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp4178725ils; Tue, 17 Nov 2020 05:43:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvcIK8eJnWB5ntHYWPac4ElBaSymcuHoylQoIWrbCLJz49/slSqbVLyua8rmfATe/Mz91Y X-Received: by 2002:a17:906:3a8d:: with SMTP id y13mr2562187ejd.542.1605620638481; Tue, 17 Nov 2020 05:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620638; cv=none; d=google.com; s=arc-20160816; b=IrruFXO6by3Nt6/oz/tT+fx2lXi4uIs/mBwecy2WmmEdBQH+i8DUoXTBDNk9gYAlm3 ru4iTe/2AI53MW/SerCRwE1ONYbKwpi4131KddUKjVvLymyTBRpJysGwNkakvLgbQQDI NqVvl3yyXZbOoIbgvCMzGwFqPPNgud6O0Tjo+Z+wcFKa1d+SaXJYHn+WhR3iaBeGoT9i zp/zeqSZcD/nRv7v7rtkJedbh3aD7LJC2IY1s5wAgE5G9ATGWE3KTIyRJKYHkLITEMjM Fg3HzvEbLpdPYl1sRTPGRHNhsbEseZfWJeDDg/jSN7mzASKJCub1fdgTriP+oP9IXYSo oU2g== 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=VdNRsDEZ/DUKQG19oTq0fVyKHPNvCEt5vyBtvLnWpv/bLyEGmiQI1oxSCO9WDQb7ze S7mIew4avuqi4xb6PpJJxZvsKEZhY2pk1XFrldPF4EcRIbXdGQih3Iok2oN7uJzHu/YT DE6c/UQHVewEHF7+2ET3+d4y4rq+NHsSyglf/DS9TJ3Hkqkw3zy1+ClGEZ4dDhxhpvlA MHMV/AvmjTDpaLW39fPdhGgc9Q4VIPB2sPuYFTx3IQFFNHE08Mgow/jIBbOoGhV11qHT 2Qw+3EQ8M8HLEXjKRwtNN5cEXA/xHNKzI86kO8TUrW4IRQgkZ/z9gpkZlObKIiDv4mu8 a1Lw== 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 stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 ce6si13885849ejb.133.2020.11.17.05.43.58; Tue, 17 Nov 2020 05:43:58 -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=@kernel.org header.s=default header.b="Y/RPhNVf"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387471AbgKQNmq (ORCPT + 14 others); Tue, 17 Nov 2020 08:42:46 -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 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 --- 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);