public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jiwei Sun <sunjw10@lenovo.com>,
	Adrian Huang <ahuang12@lenovo.com>,
	Giovanni Cabiddu <giovanni.cabiddu@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Sasha Levin <sashal@kernel.org>,
	davem@davemloft.net, damian.muszynski@intel.com,
	tero.kristo@linux.intel.com, xin.zeng@intel.com,
	siming.wan@intel.com, ciunas.bennett@intel.com,
	adam.guerin@intel.com, qat-linux@intel.com,
	linux-crypto@vger.kernel.org
Subject: [PATCH AUTOSEL 6.10 17/23] crypto: qat - initialize user_input.lock for rate_limiting
Date: Sun, 28 Jul 2024 12:04:58 -0400	[thread overview]
Message-ID: <20240728160538.2051879-17-sashal@kernel.org> (raw)
In-Reply-To: <20240728160538.2051879-1-sashal@kernel.org>

From: Jiwei Sun <sunjw10@lenovo.com>

[ Upstream commit ccacbbc3176277bbfc324f85fa827d1a2656bedf ]

If the following configurations are set,
CONFIG_DEBUG_RWSEMS=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_RWSEM_SPIN_ON_OWNER=y

And run the following command,
[root@localhost sys]# cat /sys/devices/pci0000:6b/0000:6b:00.0/qat_rl/pir
The following warning log appears,

------------[ cut here ]------------
DEBUG_RWSEMS_WARN_ON(sem->magic != sem): count = 0x0, magic = 0x0, owner = 0x1, curr 0xff11000119288040, list not empty
WARNING: CPU: 131 PID: 1254984 at kernel/locking/rwsem.c:1280 down_read+0x439/0x7f0
CPU: 131 PID: 1254984 Comm: cat Kdump: loaded Tainted: G        W          6.10.0-rc4+ #86 b2ae60c8ceabed15f4fd2dba03c1c5a5f7f4040c
Hardware name: Lenovo ThinkServer SR660 V3/SR660 V3, BIOS T8E166X-2.54 05/30/2024
RIP: 0010:down_read+0x439/0x7f0
Code: 44 24 10 80 3c 02 00 0f 85 05 03 00 00 48 8b 13 41 54 48 c7 c6 a0 3e 0e b4 48 c7 c7 e0 3e 0e b4 4c 8b 4c 24 08 e8 77 d5 40 fd <0f> 0b 59 e9 bc fc ff ff 0f 1f 44 00 00 e9 e2 fd ff ff 4c 8d 7b 08
RSP: 0018:ffa0000035f67a78 EFLAGS: 00010286
RAX: 0000000000000000 RBX: ff1100012b03a658 RCX: 0000000000000000
RDX: 0000000080000002 RSI: 0000000000000008 RDI: 0000000000000001
RBP: 1ff4000006becf53 R08: fff3fc0006becf17 R09: fff3fc0006becf17
R10: fff3fc0006becf16 R11: ffa0000035f678b7 R12: ffffffffb40e3e60
R13: ffffffffb627d1f4 R14: ff1100012b03a6d0 R15: ff1100012b03a6c8
FS:  00007fa9ff9a6740(0000) GS:ff1100081e600000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa9ff984000 CR3: 00000002118ae006 CR4: 0000000000771ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
 <TASK>
 pir_show+0x5d/0xe0 [intel_qat 9e297e249ab040329cf58b657b06f418fd5c5855]
 dev_attr_show+0x3f/0xc0
 sysfs_kf_seq_show+0x1ce/0x400
 seq_read_iter+0x3fa/0x10b0
 vfs_read+0x6f5/0xb20
 ksys_read+0xe9/0x1d0
 do_syscall_64+0x8a/0x170
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7fa9ff6fd9b2
Code: c0 e9 b2 fe ff ff 50 48 8d 3d ea 1d 0c 00 e8 c5 fd 01 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24
RSP: 002b:00007ffc0616b968 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007fa9ff6fd9b2
RDX: 0000000000020000 RSI: 00007fa9ff985000 RDI: 0000000000000003
RBP: 00007fa9ff985000 R08: 00007fa9ff984010 R09: 0000000000000000
R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000022000
R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000020000
 </TASK>
irq event stamp: 0
hardirqs last  enabled at (0): [<0000000000000000>] 0x0
hardirqs last disabled at (0): [<ffffffffb102c126>] copy_process+0x21e6/0x6e70
softirqs last  enabled at (0): [<ffffffffb102c176>] copy_process+0x2236/0x6e70
softirqs last disabled at (0): [<0000000000000000>] 0x0
---[ end trace 0000000000000000 ]---

The rate_limiting->user_input.lock rwsem lock is not initialized before
use. Let's initialize it.

Signed-off-by: Jiwei Sun <sunjw10@lenovo.com>
Reviewed-by: Adrian Huang <ahuang12@lenovo.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/crypto/intel/qat/qat_common/adf_rl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_rl.c b/drivers/crypto/intel/qat/qat_common/adf_rl.c
index 346ef8bee99d9..e782c23fc1bfc 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_rl.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_rl.c
@@ -1106,6 +1106,7 @@ int adf_rl_init(struct adf_accel_dev *accel_dev)
 	mutex_init(&rl->rl_lock);
 	rl->device_data = &accel_dev->hw_device->rl_data;
 	rl->accel_dev = accel_dev;
+	init_rwsem(&rl->user_input.lock);
 	accel_dev->rate_limiting = rl;
 
 err_ret:
-- 
2.43.0


  parent reply	other threads:[~2024-07-28 16:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-28 16:04 [PATCH AUTOSEL 6.10 01/23] PCI: Add ACS quirk for Broadcom BCM5760X NIC Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 02/23] ASoC: Intel: sof_sdw: Add quirks for some new Dell laptops Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 03/23] PCI: Use preserve_config in place of pci_flags Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 04/23] usb: cdns3: Add quirk flag to enable suspend residency Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 05/23] usb: cdns3-ti: Add workaround for Errata i2409 Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 06/23] usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 07/23] usb: typec: tcpm: avoid resets for missing source capability messages Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 08/23] usb: typec: ucsi: Fix null pointer dereference in trace Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 09/23] MIPS: Loongson64: DTS: Fix msi node for ls7a Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 10/23] MIPS: Loongson64: DTS: Fix PCIe port nodes " Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 11/23] PCI: Add INTEL_HDA_PTL to pci_ids.h Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 12/23] PCI/AER: Disable AER service on suspend Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 13/23] PCI/DPC: Disable DPC " Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 14/23] ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 15/23] ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C Sasha Levin
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 16/23] usb: gadget: aspeed_udc: validate endpoint index for ast udc Sasha Levin
2024-07-28 16:04 ` Sasha Levin [this message]
2024-07-28 16:04 ` [PATCH AUTOSEL 6.10 18/23] PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0) Sasha Levin
2024-07-28 16:05 ` [PATCH AUTOSEL 6.10 19/23] scsi: ufs: core: Remove SCSI host only if added Sasha Levin
2024-07-28 16:05 ` [PATCH AUTOSEL 6.10 20/23] PCI: qcom: Override NO_SNOOP attribute for SA8775P RC Sasha Levin
2024-07-28 16:05 ` [PATCH AUTOSEL 6.10 21/23] PCI: vmd: Create domain symlink before pci_bus_add_devices() Sasha Levin
2024-07-28 16:05 ` [PATCH AUTOSEL 6.10 22/23] PCI: Add missing bridge lock to pci_bus_lock() Sasha Levin
2024-07-28 16:05 ` [PATCH AUTOSEL 6.10 23/23] ALSA: usb: Fix UBSAN warning in parse_audio_unit() Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240728160538.2051879-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=adam.guerin@intel.com \
    --cc=ahuang12@lenovo.com \
    --cc=ciunas.bennett@intel.com \
    --cc=damian.muszynski@intel.com \
    --cc=davem@davemloft.net \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=siming.wan@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=sunjw10@lenovo.com \
    --cc=tero.kristo@linux.intel.com \
    --cc=xin.zeng@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox