Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2800794rdh; Wed, 27 Sep 2023 13:07:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGreW27aN3RI8KhQKwFlA2rPcoWgnt7Jp9jqLo5N+OP0ZeNE9c5CJj16qHk2HiuMeuqwbR9 X-Received: by 2002:a05:6870:2893:b0:1e0:eb36:a7ed with SMTP id gy19-20020a056870289300b001e0eb36a7edmr1712698oab.29.1695845254711; Wed, 27 Sep 2023 13:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695845254; cv=none; d=google.com; s=arc-20160816; b=AFpPaK+fxwgzU5C9dfm97uVAkOtAwIMQ9LR8fgsHbU8nE5BM0eXwi/UYhvLZzNgbVC 7mdCguGCzC36skvAKCTi9GkfkyeGLNNoGJJSU/UBePFRnsinDrsKLP9jcjez11NbeaOy vb1JBzuQOfv4Pui0CNUUDAxvWrbqL2DB+AxozxvLAsXla9zvP0YxvPAUee7PF0A40/GV EnCSz7uz2t++9GPLedMhaqKlz3FhbSLkQHgoGGsPHVxd8ymhgz6cHqmHHdHgtLE3yBpQ 5O94ySVBeAGQ64aTN9VpUMWSiVM6jSf0c3wTV2piRdsWVjT0HlE5alXAJOvtbp3Mn+59 fI4w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=IxJY09xF9yGBhMKow57Cq8JoDxfzBaujzga3zChE2OA=; fh=UCWI3+7GZymvXSe2wFlTffKMrNgKwC221RTnEp0ri28=; b=xV2+6szNG6SDGyk1Fl7bstoeRM8INvaJkbP02lyKCK+sj6VACivYOO/T8CrUDlmOXZ 5HNcOVGVoS5y4KIVedhf0YJPg7oW0ljWbbLcYwoX70RtZxWxD5FvNjEcTts8LHgCbYoF GI8yF6j+fGOrkuJiWhJlIMzYozkD17CTFpH29ZEdtRi3WXHih/ItmlXpNjGz2uXrsHu4 0eNcBVccBrjOEo/HGIi1oXmAAik7xPO/onm/+ijg0khf9LzFsPXZza1Ue3ZegNhvaEAR 0K7YfAigJXQBmwCm9PbMYIqlM7o8qqR/1z87bQGjjSLB46u9WE7v90SIzDHI17UtcwI0 YR7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="NcwWnc/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id f16-20020a63e310000000b005740e906e46si12525438pgh.358.2023.09.27.13.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 13:07:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="NcwWnc/u"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 634C680F9CB8; Wed, 27 Sep 2023 11:52:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbjI0Swd (ORCPT + 99 others); Wed, 27 Sep 2023 14:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjI0Swc (ORCPT ); Wed, 27 Sep 2023 14:52:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31CEE6; Wed, 27 Sep 2023 11:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695840751; x=1727376751; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=MQ0uyvyitsUR5wpJxHzYcH82109tYU4SRG/CvaLk8sQ=; b=NcwWnc/uR0AdrjhhF1+mpQuSsVfeRSzcOWTVUu+NMflN3Prn/aqdggNU rZkcGMnzZ9Qo5GFWmLx6oeH3CYH4AYIGxATC/mRvsEjZCK8R/CdQYsCdM KGkpv6e42xVx2MZhv3NagMVNEjJu1xZDSXRnaePzBj+qKPKYFxFf9X+IR vNJxMeJKGOIOF8Xc4eYR8c+rwubuWwPRpPvi1CwDkjdWoGlqtY+ip8WQw 8Ds9gNfTnRDlCO9AgohQOaUoIi7+RP/x6to6N3OaXlRlbceJdbyfdt+VE 1ztLTdfsibSs1NdgLINHMF1CC+abvip7OKTxLp1CN3ANDBfj96HrEUehb w==; X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="468186510" X-IronPort-AV: E=Sophos;i="6.03,182,1694761200"; d="scan'208";a="468186510" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 11:52:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10846"; a="725928273" X-IronPort-AV: E=Sophos;i="6.03,182,1694761200"; d="scan'208";a="725928273" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Sep 2023 11:52:30 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH 1/1] platform/x86/intel/ifs: release cpus_read_lock() Date: Wed, 27 Sep 2023 11:48:24 -0700 Message-Id: <20230927184824.2566086-1-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 27 Sep 2023 11:52:52 -0700 (PDT) Couple of error paths in do_core_test() was returning directly without doing a necessary cpus_read_unlock(). Following lockdep warning was observed when exercising these scenarios with PROVE_RAW_LOCK_NESTING enabled: [ 139.304775] ================================================ [ 139.311185] WARNING: lock held when returning to user space! [ 139.317593] 6.6.0-rc2ifs01+ #11 Tainted: G S W I [ 139.324499] ------------------------------------------------ [ 139.330908] bash/11476 is leaving the kernel with locks still held! [ 139.338000] 1 lock held by bash/11476: [ 139.342262] #0: ffffffffaa26c930 (cpu_hotplug_lock){++++}-{0:0}, at: do_core_test+0x35/0x1c0 [intel_ifs] Fix the flow so that all scenarios release the lock prior to returning from the function. Fixes: 5210fb4e1880 ("platform/x86/intel/ifs: Sysfs interface for Array BIST") Cc: stable@vger.kernel.org Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/runtest.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index 1061eb7ec399..43c864add778 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -331,14 +331,15 @@ int do_core_test(int cpu, struct device *dev) switch (test->test_num) { case IFS_TYPE_SAF: if (!ifsd->loaded) - return -EPERM; - ifs_test_core(cpu, dev); + ret = -EPERM; + else + ifs_test_core(cpu, dev); break; case IFS_TYPE_ARRAY_BIST: ifs_array_test_core(cpu, dev); break; default: - return -EINVAL; + ret = -EINVAL; } out: cpus_read_unlock(); base-commit: 6465e260f48790807eef06b583b38ca9789b6072 -- 2.25.1