From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CDE53B42CC for ; Tue, 28 Jul 2026 15:01:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785250866; cv=none; b=g2+xi3n1ZQOTPzZp+ZwphY0KImF/ZWXWLoahXtv2YdeK3oH4ymdBMni/XCpUtnDRupgZifbQZIUJwXpOq5OVkoBrqQsVNmbG0e2Y1cCYBJF5FBNjPL8ZRd+77IDtobEhoh/cfxE0mvAVxslkQf4EIy3zO0TqvqicpTUY48IZJDs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785250866; c=relaxed/simple; bh=muMds9Q8qqHS5oVKnVTUfqVni5Cch5hCBUt9tlDFF70=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hFCps1Dtm5xUbq7mWjFSfxIJyCpIJkc5SveW274FZf/OGnisrY13It1vMfak1kRR71qY2gwBhMiagKMhVKDe6o8I/BrNkTF16YX/Kf/8QHHSAkHYReqi2G5kc0di2Yi9pB9d2jLn7P/PmrdjNSox7c76qtH2BdhwSs71HB5VOhA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=jciatwPU; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jciatwPU" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-47f707e5d75so2722584f8f.1 for ; Tue, 28 Jul 2026 08:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785250862; x=1785855662; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=H6jmnEPT7fD3xBv3ETDFiEGiqoLQ+7NgCOKIiQ+7Jw4=; b=jciatwPUMxWvNjd0H4FNkiLr0FTrqlpQjyHMm4bVaONNY2iqWzA1eV3TEwF/e68Adx 2HapCI/VIWPf70g/QCpfPbZ2d6ameSrb/3/niaVpp/GN2lymLCaR3q0j/Jwlz+jvaFjo 5/pusa5Wx9Mw1iqdfecNGE/f7u9TF7HdC3LasOjL+dD1Rmk7fNMPtpt5AXsY6GiOBWIZ sF1hyqYVvuKpDV5ZvyTvApYCg1WjOY50Ao2QnyPuRbHuUyzOEAB0f1lubnha0FXwtAx2 dgs7hkyyxYRAb9oj5Uw0ktPL1S5eOa+iWRu/k2PhpdaplkMm5cpwAl10sMls62T9zwC+ tnfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785250862; x=1785855662; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=H6jmnEPT7fD3xBv3ETDFiEGiqoLQ+7NgCOKIiQ+7Jw4=; b=aWjv7vloCl37kFVW2S9RGqA23ZNCOlCUdWPAUtKWVAkiy1K8xxgR4A8BvZd6Geog8+ 88aUl78UYinrsa6huujAhzxvWyEBb+6+2OXh+QHCdHv9sc9FTpKloiJK7gpV9X7uy+Pg NsI1tvhgt+L1q8kkEKRP0OBKKUH2uTeuE1/k/a/TPxeCOHfC3FvSiq0uAspvp7xm9jZs HkjiH2JmEopG3AWTaWmdPiroHcu+OS99Lo3rGPPqQd/vHGl6Bso3HiT1ueyFkk66Vu0p EzjAWpOdA8IUiz2Y7awrEPLUJq2VronOJO2nehmPLWlsgADPAf8Ea46lNxuAveTUGi7e 9s9g== X-Forwarded-Encrypted: i=1; AHgh+Rp2Cph8Xq85Rvk6+9cOaMsRC3PFpXA9Fx5kG5QXz7SbGRvbuRKFF1OyMcKAUBYpaunX10/gGkVyIk/LVGk=@vger.kernel.org X-Gm-Message-State: AOJu0YycmPNONUBKmF8n4mA2bfVR+M4yqCqUvjCttt2UtmyWJAv1teO4 I5sZn/T1yTego+h+hXg3WjG5BYeJq1RCwpKm0JrE7yDBUpcR7y5cJUL7ugJ+diayAsI= X-Gm-Gg: AR+sD13Olgiouqbzzs1e+cbCKy2x0mblsyjFQpEy4sIkUNC/c6RQcTpPBk+3oQKhEmY RBrZN18sglOA4DWgiRZUf+RapZ/3CizBU6Mzz4zoDHX/84lOv0hOejJ3WEKMCs9RQkWttQPo5aO z7q3tvGj/d/WCCHi4KnLVVD6eikv/QeJWp54iHspiAnjyS8+Kf2KPztHaDYQGleaiVlPW/hcMV+ 2Ug8zcIwN6Zvv7Z1mWKbr2DuuzJ6/KYJo6d1Bqy0L3KhWQ8QZa3+uStNe2Ikgt4eFzLVL9HNSSR emvbZ8Sg5w/dOQ9ESpDx0IR3l/J3AmIiUwXl9x2wz982x0F4E19kPCwGSeCvay+VK2pmaIu477q dHSj9b05a5pb38A4bcRfMh7vPJeXVfm6J2xBBI36BtDSzV1cB5ohO+BBO5a+byryvfR4IkKe2DQ fu/KTBMGc= X-Received: by 2002:a05:600c:8b41:b0:493:a613:56b2 with SMTP id 5b1f17b1804b1-496c653e2a0mr31514365e9.8.1785250862436; Tue, 28 Jul 2026 08:01:02 -0700 (PDT) Received: from [192.168.1.3] ([37.18.141.193]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c52fa9sm61036324f8f.20.2026.07.28.08.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 08:01:01 -0700 (PDT) From: James Clark Date: Tue, 28 Jul 2026 16:00:14 +0100 Subject: [PATCH v3 2/8] coresight: configfs: Don't assume active until cscfg_mgr is set Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260728-james-cs-multiple-per-threads-v3-2-6aee7579f1dc@linaro.org> References: <20260728-james-cs-multiple-per-threads-v3-0-6aee7579f1dc@linaro.org> In-Reply-To: <20260728-james-cs-multiple-per-threads-v3-0-6aee7579f1dc@linaro.org> To: Suzuki K Poulose , Mike Leach , Leo Yan , Suyash Mahar , Yeoreum Yun Cc: Greg Kroah-Hartman , Qi Liu , Junhao He , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, James Clark , Jonathan Cameron , sashiko-bot X-Mailer: b4 0.14.0 Perf's etm_setup_aux() calls cscfg_activate_config() and dereferences cscfg_mgr, which can be done after coresight_init() has initialized the Perf PMU but before cscfg_init() has finished while the driver is still loading. Fix it by only assuming cscfg is initialized if cscfg_mgr is set. Reported-by: sashiko-bot Fixes: a0114b4740dd ("coresight: etm-perf: Update to activate selected configuration") Signed-off-by: James Clark --- drivers/hwtracing/coresight/coresight-syscfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c index 2bfdd7b45e49..475e8fefa100 100644 --- a/drivers/hwtracing/coresight/coresight-syscfg.c +++ b/drivers/hwtracing/coresight/coresight-syscfg.c @@ -581,7 +581,7 @@ int cscfg_load_config_sets(struct cscfg_config_desc **config_descs, int err = 0; mutex_lock(&cscfg_mutex); - if (cscfg_mgr->load_state != CSCFG_NONE) { + if (!cscfg_mgr || cscfg_mgr->load_state != CSCFG_NONE) { mutex_unlock(&cscfg_mutex); return -EBUSY; } @@ -662,7 +662,7 @@ int cscfg_unload_config_sets(struct cscfg_load_owner_info *owner_info) struct cscfg_load_owner_info *load_list_item = NULL; mutex_lock(&cscfg_mutex); - if (cscfg_mgr->load_state != CSCFG_NONE) { + if (!cscfg_mgr || cscfg_mgr->load_state != CSCFG_NONE) { mutex_unlock(&cscfg_mutex); return -EBUSY; } @@ -902,7 +902,7 @@ static int _cscfg_activate_config(unsigned long cfg_hash) struct cscfg_config_desc *config_desc; int err = -EINVAL; - if (cscfg_mgr->load_state == CSCFG_UNLOAD) + if (!cscfg_mgr || cscfg_mgr->load_state == CSCFG_UNLOAD) return -EBUSY; list_for_each_entry(config_desc, &cscfg_mgr->config_desc_list, item) { -- 2.34.1