mirror of
https://github.com/torvalds/linux.git
synced 2024-12-16 08:02:17 +00:00
1ab87298cb
hwrng kthread can be waiting via hwrng_fillfn for some data from a rng like virtio-rng: hwrng D ffff880093e17798 0 382 2 0x00000000 ... Call Trace: [<ffffffff817339c6>] wait_for_completion_killable+0x96/0x210 [<ffffffffa00aa1b7>] virtio_read+0x57/0xf0 [virtio_rng] [<ffffffff814f4a35>] hwrng_fillfn+0x75/0x130 [<ffffffff810aa243>] kthread+0xf3/0x110 And when some user program tries to read the /dev node in this state, we get: rngd D ffff880093e17798 0 762 1 0x00000004 ... Call Trace: [<ffffffff817351ac>] mutex_lock_nested+0x15c/0x3e0 [<ffffffff814f478e>] rng_dev_read+0x6e/0x240 [<ffffffff81231958>] __vfs_read+0x28/0xe0 [<ffffffff81232393>] vfs_read+0x83/0x130 And this is indeed unkillable. So use mutex_lock_interruptible instead of mutex_lock in rng_dev_read and exit immediatelly when interrupted. And possibly return already read data, if any (as POSIX allows). v2: use ERESTARTSYS instead of EINTR Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Matt Mackall <mpm@selenic.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: <linux-crypto@vger.kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> |
||
---|---|---|
.. | ||
amd-rng.c | ||
atmel-rng.c | ||
bcm63xx-rng.c | ||
bcm2835-rng.c | ||
core.c | ||
exynos-rng.c | ||
geode-rng.c | ||
intel-rng.c | ||
iproc-rng200.c | ||
ixp4xx-rng.c | ||
Kconfig | ||
Makefile | ||
msm-rng.c | ||
mxc-rnga.c | ||
n2-asm.S | ||
n2-drv.c | ||
n2rng.h | ||
nomadik-rng.c | ||
octeon-rng.c | ||
omap3-rom-rng.c | ||
omap-rng.c | ||
pasemi-rng.c | ||
powernv-rng.c | ||
ppc4xx-rng.c | ||
pseries-rng.c | ||
st-rng.c | ||
stm32-rng.c | ||
timeriomem-rng.c | ||
tpm-rng.c | ||
tx4939-rng.c | ||
via-rng.c | ||
virtio-rng.c | ||
xgene-rng.c |