<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/char/hw_random, branch v6.1.2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-12-31T12:32:37+00:00</updated>
<entry>
<title>hwrng: geode - Fix PCI device refcount leak</title>
<updated>2022-12-31T12:32:37+00:00</updated>
<author>
<name>Xiongfeng Wang</name>
<email>wangxiongfeng2@huawei.com</email>
</author>
<published>2022-12-02T13:22:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=19b7b85773b18457ff85a9ff4f5e2a2d4bf7ed0c'/>
<id>urn:sha1:19b7b85773b18457ff85a9ff4f5e2a2d4bf7ed0c</id>
<content type='text'>
[ Upstream commit 9f6ec8dc574efb7f4f3d7ee9cd59ae307e78f445 ]

for_each_pci_dev() is implemented by pci_get_device(). The comment of
pci_get_device() says that it will increase the reference count for the
returned pci_dev and also decrease the reference count for the input
pci_dev @from if it is not NULL.

If we break for_each_pci_dev() loop with pdev not NULL, we need to call
pci_dev_put() to decrease the reference count. We add a new struct
'amd_geode_priv' to record pointer of the pci_dev and membase, and then
add missing pci_dev_put() for the normal and error path.

Fixes: ef5d862734b8 ("[PATCH] Add Geode HW RNG driver")
Signed-off-by: Xiongfeng Wang &lt;wangxiongfeng2@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>hwrng: amd - Fix PCI device refcount leak</title>
<updated>2022-12-31T12:32:37+00:00</updated>
<author>
<name>Xiongfeng Wang</name>
<email>wangxiongfeng2@huawei.com</email>
</author>
<published>2022-12-02T13:22:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2e10ecd012ae2b2a374b34f307e9bc1e6096c03d'/>
<id>urn:sha1:2e10ecd012ae2b2a374b34f307e9bc1e6096c03d</id>
<content type='text'>
[ Upstream commit ecadb5b0111ea19fc7c240bb25d424a94471eb7d ]

for_each_pci_dev() is implemented by pci_get_device(). The comment of
pci_get_device() says that it will increase the reference count for the
returned pci_dev and also decrease the reference count for the input
pci_dev @from if it is not NULL.

If we break for_each_pci_dev() loop with pdev not NULL, we need to call
pci_dev_put() to decrease the reference count. Add the missing
pci_dev_put() for the normal and error path.

Fixes: 96d63c0297cc ("[PATCH] Add AMD HW RNG driver")
Signed-off-by: Xiongfeng Wang &lt;wangxiongfeng2@huawei.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax()</title>
<updated>2022-10-14T11:03:09+00:00</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-10-10T15:06:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96cb9d0554457086664d3bd10630b11193d863f1'/>
<id>urn:sha1:96cb9d0554457086664d3bd10630b11193d863f1</id>
<content type='text'>
Rather than busy looping, yield back to the scheduler and sleep for a
bit in the event that there's no data. This should hopefully prevent the
stalls that Mark reported:

&lt;6&gt;[    3.362859] Freeing initrd memory: 16196K
&lt;3&gt;[   23.160131] rcu: INFO: rcu_sched self-detected stall on CPU
&lt;3&gt;[   23.166057] rcu:  0-....: (2099 ticks this GP) idle=03b4/1/0x40000002 softirq=28/28 fqs=1050
&lt;4&gt;[   23.174895]       (t=2101 jiffies g=-1147 q=2353 ncpus=4)
&lt;4&gt;[   23.180203] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1
&lt;4&gt;[   23.186125] Hardware name: BCM2835
&lt;4&gt;[   23.189837] PC is at bcm2835_rng_read+0x30/0x6c
&lt;4&gt;[   23.194709] LR is at hwrng_fillfn+0x71/0xf4
&lt;4&gt;[   23.199218] pc : [&lt;c07ccdc8&gt;]    lr : [&lt;c07cb841&gt;]    psr: 40000033
&lt;4&gt;[   23.205840] sp : f093df70  ip : 00000000  fp : 00000000
&lt;4&gt;[   23.211404] r10: c3c7e800  r9 : 00000000  r8 : c17e6b20
&lt;4&gt;[   23.216968] r7 : c17e6b64  r6 : c18b0a74  r5 : c07ccd99  r4 : c3f171c0
&lt;4&gt;[   23.223855] r3 : 000fffff  r2 : 00000040  r1 : c3c7e800  r0 : c3f171c0
&lt;4&gt;[   23.230743] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment none
&lt;4&gt;[   23.238426] Control: 50c5387d  Table: 0020406a  DAC: 00000051
&lt;4&gt;[   23.244519] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1

Link: https://lore.kernel.org/all/Y0QJLauamRnCDUef@sirena.org.uk/
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Acked-by: Florian Fainelli &lt;f.fainelli@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - start hwrng kthread also for untrusted sources</title>
<updated>2022-09-30T05:59:12+00:00</updated>
<author>
<name>Dominik Brodowski</name>
<email>linux@dominikbrodowski.net</email>
</author>
<published>2022-09-22T13:59:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b006c439d58db625318bf2207feabf847510a8a6'/>
<id>urn:sha1:b006c439d58db625318bf2207feabf847510a8a6</id>
<content type='text'>
Start the hwrng kthread even if the hwrng source has a quality setting
of zero. Then, every crng reseed interval, one batch of data from this
zero-quality hwrng source will be mixed into the CRNG pool.

This patch is based on the assumption that data from a hwrng source
will not actively harm the CRNG state. Instead, many hwrng sources
(such as TPM devices), even though they are assigend a quality level of
zero, actually provide some entropy, which is good enough to mix into
the CRNG pool every once in a while.

Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Dominik Brodowski &lt;linux@dominikbrodowski.net&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()</title>
<updated>2022-09-02T10:37:23+00:00</updated>
<author>
<name>Kshitiz Varshney</name>
<email>kshitiz.varshney@nxp.com</email>
</author>
<published>2022-08-22T11:19:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10a2199caf437e893d9027d97700b3c6010048b7'/>
<id>urn:sha1:10a2199caf437e893d9027d97700b3c6010048b7</id>
<content type='text'>
Issue:
While servicing interrupt, if the IRQ happens to be because of a SEED_DONE
due to a previous boot stage, you end up completing the completion
prematurely, hence causing kernel to crash while booting.

Fix:
Moving IRQ handler registering after imx_rngc_irq_mask_clear()

Fixes: 1d5449445bd0 (hwrng: mx-rngc - add a driver for Freescale RNGC)
Signed-off-by: Kshitiz Varshney &lt;kshitiz.varshney@nxp.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: imx-rngc - use devres for hwrng registration</title>
<updated>2022-08-26T10:49:10+00:00</updated>
<author>
<name>Martin Kaiser</name>
<email>martin@kaiser.cx</email>
</author>
<published>2022-08-15T19:37:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d5eb916d889f12f27275e2049b9c4df43b7cfa13'/>
<id>urn:sha1:d5eb916d889f12f27275e2049b9c4df43b7cfa13</id>
<content type='text'>
Replace hwrng_register with devm_hwrng_register and let devres unregister
our hwrng when the device is removed.

It's possible to do this now that devres also handles clock
disable+uprepare. When we had to disable+unprepare the clock ourselves,
we had to unregister the hwrng before this and couldn't use devres.

There's nothing left to do for imx_rngc_remove, this function can go.

Signed-off-by: Martin Kaiser &lt;martin@kaiser.cx&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: imx-rngc - use devm_clk_get_enabled</title>
<updated>2022-08-26T10:49:10+00:00</updated>
<author>
<name>Martin Kaiser</name>
<email>martin@kaiser.cx</email>
</author>
<published>2022-08-15T19:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6a2bc448423cea44e7dba0f72d7c82ae04ab201e'/>
<id>urn:sha1:6a2bc448423cea44e7dba0f72d7c82ae04ab201e</id>
<content type='text'>
Use the new devm_clk_get_enabled function to get our clock.

We don't have to disable and unprepare the clock ourselves any more in
error paths and in the remove function.

Signed-off-by: Martin Kaiser &lt;martin@kaiser.cx&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: imx-rngc - use KBUILD_MODNAME as driver name</title>
<updated>2022-08-19T10:39:39+00:00</updated>
<author>
<name>Martin Kaiser</name>
<email>martin@kaiser.cx</email>
</author>
<published>2022-08-14T17:03:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=47d35bf22b6913aa9fa2389431377d4189102a15'/>
<id>urn:sha1:47d35bf22b6913aa9fa2389431377d4189102a15</id>
<content type='text'>
Use KBUILD_MODNAME instead of hard coding the driver name.

Signed-off-by: Martin Kaiser &lt;martin@kaiser.cx&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: arm-smccc-trng - fix NO_ENTROPY handling</title>
<updated>2022-08-19T10:39:35+00:00</updated>
<author>
<name>James Cowgill</name>
<email>james.cowgill@blaize.com</email>
</author>
<published>2022-08-01T20:04:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=042b4b169c6fb9d4df268d66282d7302dd73d37b'/>
<id>urn:sha1:042b4b169c6fb9d4df268d66282d7302dd73d37b</id>
<content type='text'>
The SMCCC_RET_TRNG_NO_ENTROPY switch arm is never used because the
NO_ENTROPY return value is negative and negative values are handled
above the switch by immediately returning.

Fix by handling errors using a default arm in the switch.

Fixes: 0888d04b47a1 ("hwrng: Add Arm SMCCC TRNG based driver")
Signed-off-by: James Cowgill &lt;james.cowgill@blaize.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>hwrng: core - let sleep be interrupted when unregistering hwrng</title>
<updated>2022-08-19T10:39:34+00:00</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2022-07-28T10:22:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=36cb6494429bd64b27b7ff8b4af56f8e526da2b4'/>
<id>urn:sha1:36cb6494429bd64b27b7ff8b4af56f8e526da2b4</id>
<content type='text'>
There are two deadlock scenarios that need addressing, which cause
problems when the computer goes to sleep, the interface is set down, and
hwrng_unregister() is called. When the deadlock is hit, sleep is delayed
for tens of seconds, causing it to fail. These scenarios are:

1) The hwrng kthread can't be stopped while it's sleeping, because it
   uses msleep_interruptible() which does not react to kthread_stop.

2) A normal user thread can't be interrupted by hwrng_unregister() while
   it's sleeping, because hwrng_unregister() is called from elsewhere.

We solve both issues by add a completion object called dying that
fulfils waiters once we have started the process in hwrng_unregister.

At the same time, we should cleanup a common and useless dmesg splat
in the same area.

Cc: &lt;stable@vger.kernel.org&gt;
Reported-by: Gregory Erwin &lt;gregerwin256@gmail.com&gt;
Fixes: fcd09c90c3c5 ("ath9k: use hw_random API instead of directly dumping into random.c")
Link: https://lore.kernel.org/all/CAO+Okf6ZJC5-nTE_EJUGQtd8JiCkiEHytGgDsFGTEjs0c00giw@mail.gmail.com/
Link: https://lore.kernel.org/lkml/CAO+Okf5k+C+SE6pMVfPf-d8MfVPVq4PO7EY8Hys_DVXtent3HA@mail.gmail.com/
Link: https://bugs.archlinux.org/task/75138
Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Acked-by: Toke Høiland-Jørgensen &lt;toke@toke.dk&gt;
Acked-by: Kalle Valo &lt;kvalo@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
