1
0
Fork 0
remarkable-linux/drivers/crypto/ccp
Sebastian Andrzej Siewior 41b6f0ffb3 crypto: ccp - don't disable interrupts while setting up debugfs
[ Upstream commit 79eb382b5e ]

I don't why we need take a single write lock and disable interrupts
while setting up debugfs. This is what what happens when we try anyway:

|ccp 0000:03:00.2: enabling device (0000 -> 0002)
|BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:69
|in_atomic(): 1, irqs_disabled(): 1, pid: 3, name: kworker/0:0
|irq event stamp: 17150
|hardirqs last  enabled at (17149): [<0000000097a18c49>] restore_regs_and_return_to_kernel+0x0/0x23
|hardirqs last disabled at (17150): [<000000000773b3a9>] _raw_write_lock_irqsave+0x1b/0x50
|softirqs last  enabled at (17148): [<0000000064d56155>] __do_softirq+0x3b8/0x4c1
|softirqs last disabled at (17125): [<0000000092633c18>] irq_exit+0xb1/0xc0
|CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.16.0-rc2+ #30
|Workqueue: events work_for_cpu_fn
|Call Trace:
| dump_stack+0x7d/0xb6
| ___might_sleep+0x1eb/0x250
| down_write+0x17/0x60
| start_creating+0x4c/0xe0
| debugfs_create_dir+0x9/0x100
| ccp5_debugfs_setup+0x191/0x1b0
| ccp5_init+0x8a7/0x8c0
| ccp_dev_init+0xb8/0xe0
| sp_init+0x6c/0x90
| sp_pci_probe+0x26e/0x590
| local_pci_probe+0x3f/0x90
| work_for_cpu_fn+0x11/0x20
| process_one_work+0x1ff/0x650
| worker_thread+0x1d4/0x3a0
| kthread+0xfe/0x130
| ret_from_fork+0x27/0x50

If any locking is required, a simple mutex will do it.

Cc: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 16:17:44 +02:00
..
Kconfig crypto: ccp - select CONFIG_CRYPTO_RSA 2017-08-09 20:17:59 +08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ccp-crypto-aes-cmac.c crypto: ccp - Prevent information leakage on export 2016-04-15 22:13:56 +08:00
ccp-crypto-aes-galois.c crypto: ccp - Update copyright dates for 2017. 2017-07-28 17:58:01 +08:00
ccp-crypto-aes-xts.c crypto: ccp - Add XTS-AES-256 support for CCP version 5 2017-08-04 09:27:44 +08:00
ccp-crypto-aes.c crypto: ccp - CCP versioning support 2016-03-11 21:19:16 +08:00
ccp-crypto-des3.c crypto: ccp - Update copyright dates for 2017. 2017-07-28 17:58:01 +08:00
ccp-crypto-main.c crypto: ccp - Add support for RSA on the CCP 2017-07-28 17:58:05 +08:00
ccp-crypto-rsa.c crypto: ccp - return an actual key size from RSA max_size callback 2018-04-08 14:26:32 +02:00
ccp-crypto-sha.c crypto: ccp - Update copyright dates for 2017. 2017-07-28 17:58:01 +08:00
ccp-crypto.h crypto: ccp - Add XTS-AES-256 support for CCP version 5 2017-08-04 09:27:44 +08:00
ccp-debugfs.c crypto: ccp - don't disable interrupts while setting up debugfs 2018-05-25 16:17:44 +02:00
ccp-dev-v3.c csrypto: ccp - Expand RSA support for a v5 ccp 2017-07-28 17:58:06 +08:00
ccp-dev-v5.c crypto: ccp - Fix XTS-AES-128 support on v5 CCPs 2017-08-04 09:27:41 +08:00
ccp-dev.c crypto: ccp - remove duplicate module version and author entry 2017-08-03 13:47:21 +08:00
ccp-dev.h crypto: ccp - Fix XTS-AES-128 support on v5 CCPs 2017-08-04 09:27:41 +08:00
ccp-dmaengine.c dmaengine updates for 4.14-rc1 2017-09-07 14:03:05 -07:00
ccp-ops.c crypto: ccp - use dma_mapping_error to check map error 2017-08-17 16:53:33 +08:00
sp-dev.c crypto: ccp - remove ccp_present() check from device initialize 2017-07-18 18:15:55 +08:00
sp-dev.h csrypto: ccp - Expand RSA support for a v5 ccp 2017-07-28 17:58:06 +08:00
sp-pci.c crypto: ccp - rename ccp driver initialize files as sp device 2017-07-18 18:15:54 +08:00
sp-platform.c crypto: ccp - rename ccp driver initialize files as sp device 2017-07-18 18:15:54 +08:00