From: Amit Shah <amit.shah@redhat.com>
To: stable@vger.kernel.org
Cc: Amit Shah <amit.shah@redhat.com>,
linux-kernel@vger.kernel.org,
Virtualization List <virtualization@lists.linux-foundation.org>
Subject: [3.16 stable PATCH v2 2/2] Revert "hwrng: virtio - ensure reads happen after successful probe"
Date: Tue, 12 Aug 2014 13:23:46 +0530 [thread overview]
Message-ID: <8a76f74aea31776b2532f110828161cf9876bcda.1407830026.git.amit.shah@redhat.com> (raw)
In-Reply-To: <e85a877491a10650cd4b14de926707954a91f565.1407830026.git.amit.shah@redhat.com>
In-Reply-To: <e85a877491a10650cd4b14de926707954a91f565.1407830026.git.amit.shah@redhat.com>
This reverts commit e052dbf554610e2104c5a7518c4d8374bed701bb.
Now that we use the virtio ->scan() function to register with the hwrng
core, we will not get read requests till probe is successfully finished.
So revert the workaround we had in place to refuse read requests while
we were not yet setup completely.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit eeec626366ffe558fc3d5685bd2b49a962acf57d)
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
drivers/char/hw_random/core.c | 6 ------
drivers/char/hw_random/virtio-rng.c | 9 ---------
2 files changed, 15 deletions(-)
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index c4419ea..2a451b1 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -68,12 +68,6 @@ static void add_early_randomness(struct hwrng *rng)
unsigned char bytes[16];
int bytes_read;
- /*
- * Currently only virtio-rng cannot return data during device
- * probe, and that's handled in virtio-rng.c itself. If there
- * are more such devices, this call to rng_get_data can be
- * made conditional here instead of doing it per-device.
- */
bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
if (bytes_read > 0)
add_device_randomness(bytes, bytes_read);
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index f4e04f3..f1aa13b 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -39,7 +39,6 @@ struct virtrng_info {
bool hwrng_register_done;
};
-static bool probe_done;
static void random_recv_done(struct virtqueue *vq)
{
@@ -70,13 +69,6 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)
int ret;
struct virtrng_info *vi = (struct virtrng_info *)rng->priv;
- /*
- * Don't ask host for data till we're setup. This call can
- * happen during hwrng_register(), after commit d9e7972619.
- */
- if (unlikely(!probe_done))
- return 0;
-
if (!vi->busy) {
vi->busy = true;
init_completion(&vi->have_data);
@@ -138,7 +130,6 @@ static int probe_common(struct virtio_device *vdev)
return err;
}
- probe_done = true;
return 0;
}
--
1.9.3
next prev parent reply other threads:[~2014-08-12 7:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 7:53 [3.16 stable PATCH v2 1/2] virtio: rng: delay hwrng_register() till driver is ready Amit Shah
2014-08-12 7:53 ` Amit Shah [this message]
2014-08-27 8:55 ` Amit Shah
2014-10-03 19:57 ` Greg KH
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=8a76f74aea31776b2532f110828161cf9876bcda.1407830026.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).