aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2023-09-13 13:41:57 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2023-09-13 13:41:57 -0400
commit005ad32358f12fe9313a4a01918a55e60d4f39e5 (patch)
tree1802ca330234c3711321a208fdbaf577de09cf3f
parent6a2557c2387d566774d468748ccff597dc8ede10 (diff)
parent8e32ddff69b6b4547cc00592ad816484e160817a (diff)
Merge tag 'pull-tpm-2023-09-12-3' of https://github.com/stefanberger/qemu-tpm into staging
Merge tpm 2023/09/12 v3 # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEuBi5yt+QicLVzsZrda1lgCoLQhEFAmUBrwgACgkQda1lgCoL # QhG9PQgA5drE1s0dYGkAIZimOsRKvduMV/kqeTmqnhGSUBM9jnYLWssnuG7/nDAi # IXTqoKOzw27TGZKNiKuCO7PvlKCeirPEk7KmHk2JrxjC/QjtExMZLF700eLemP9/ # RBKwHerT8mLAkVuIGFvFgU9nQRrg/YX6kSvOFBJEl4XBn4w/vyY7gp3QbJgqcl36 # jrL7qJXrxQnT0BRRy+NlmmG3WswIY6xZpURdYKWMAINeNSH2DW2JxiDov2+fUVWH # jp7SKBzCsXvD/RjRz1WWRpsrz3EtC7LiaLiB685XZsMcavb1zy0Pj7pchjr6NkwF # 2gTWFPr/YG/eYoodtix2r2ElG4hyJQ== # =WBnS # -----END PGP SIGNATURE----- # gpg: Signature made Wed 13 Sep 2023 08:46:00 EDT # gpg: using RSA key B818B9CADF9089C2D5CEC66B75AD65802A0B4211 # gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: B818 B9CA DF90 89C2 D5CE C66B 75AD 6580 2A0B 4211 * tag 'pull-tpm-2023-09-12-3' of https://github.com/stefanberger/qemu-tpm: tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--backends/tpm/tpm_util.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index a6e6d3e72f..1856589c3b 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -112,12 +112,8 @@ static int tpm_util_request(int fd,
void *response,
size_t responselen)
{
- fd_set readfds;
+ GPollFD fds[1] = { {.fd = fd, .events = G_IO_IN } };
int n;
- struct timeval tv = {
- .tv_sec = 1,
- .tv_usec = 0,
- };
n = write(fd, request, requestlen);
if (n < 0) {
@@ -127,11 +123,8 @@ static int tpm_util_request(int fd,
return -EFAULT;
}
- FD_ZERO(&readfds);
- FD_SET(fd, &readfds);
-
/* wait for a second */
- n = select(fd + 1, &readfds, NULL, NULL, &tv);
+ n = RETRY_ON_EINTR(g_poll(fds, 1, 1000));
if (n != 1) {
return -errno;
}