1
The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4:
1
The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b:
2
2
3
arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100)
3
Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700)
4
4
5
are available in the git repository at:
5
are available in the Git repository at:
6
6
7
git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request
7
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
8
8
9
for you to fetch changes up to 56faeb9bb6872b3f926b3b3e0452a70beea10af2:
9
for you to fetch changes up to 9b06d0d076271d76e5384d767ef94a676f0a9efd:
10
10
11
block/gluster.c: Handle qdict_array_entries() failure (2017-06-09 08:41:29 -0400)
11
block/blkio: add more comments on the fd passing handling (2023-08-03 11:28:43 -0400)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Gluster patch
14
Pull request
15
16
Fix for an fd leak in the blkio block driver.
17
15
----------------------------------------------------------------
18
----------------------------------------------------------------
16
19
17
Peter Maydell (1):
20
Stefano Garzarella (2):
18
block/gluster.c: Handle qdict_array_entries() failure
21
block/blkio: close the fd when blkio_connect() fails
22
block/blkio: add more comments on the fd passing handling
19
23
20
block/gluster.c | 3 +--
24
block/blkio.c | 28 +++++++++++++++++++++-------
21
1 file changed, 1 insertion(+), 2 deletions(-)
25
1 file changed, 21 insertions(+), 7 deletions(-)
22
26
23
--
27
--
24
2.9.3
28
2.41.0
25
26
diff view generated by jsdifflib
New patch
1
From: Stefano Garzarella <sgarzare@redhat.com>
1
2
3
libblkio drivers take ownership of `fd` only after a successful
4
blkio_connect(), so if it fails, we are still the owners.
5
6
Fixes: cad2ccc395 ("block/blkio: use qemu_open() to support fd passing for virtio-blk")
7
Suggested-by: Hanna Czenczek <hreitz@redhat.com>
8
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
9
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
10
Message-id: 20230803082825.25293-2-sgarzare@redhat.com
11
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
12
---
13
block/blkio.c | 11 ++++++++---
14
1 file changed, 8 insertions(+), 3 deletions(-)
15
16
diff --git a/block/blkio.c b/block/blkio.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/block/blkio.c
19
+++ b/block/blkio.c
20
@@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
21
const char *path = qdict_get_try_str(options, "path");
22
BDRVBlkioState *s = bs->opaque;
23
bool fd_supported = false;
24
- int fd, ret;
25
+ int fd = -1, ret;
26
27
if (!path) {
28
error_setg(errp, "missing 'path' option");
29
@@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
30
if (ret < 0) {
31
fd_supported = false;
32
qemu_close(fd);
33
+ fd = -1;
34
}
35
}
36
}
37
@@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
38
}
39
40
ret = blkio_connect(s->blkio);
41
+ if (ret < 0 && fd >= 0) {
42
+ /* Failed to give the FD to libblkio, close it */
43
+ qemu_close(fd);
44
+ fd = -1;
45
+ }
46
+
47
/*
48
* If the libblkio driver doesn't support the `fd` property, blkio_connect()
49
* will fail with -EINVAL. So let's try calling blkio_connect() again by
50
* directly setting `path`.
51
*/
52
if (fd_supported && ret == -EINVAL) {
53
- qemu_close(fd);
54
-
55
/*
56
* We need to clear the `fd` property we set previously by setting
57
* it to -1.
58
--
59
2.41.0
diff view generated by jsdifflib
1
From: Peter Maydell <peter.maydell@linaro.org>
1
From: Stefano Garzarella <sgarzare@redhat.com>
2
2
3
In qemu_gluster_parse_json(), the call to qdict_array_entries()
3
As Hanna pointed out, it is not clear in the code why qemu_open()
4
could return a negative error code, which we were ignoring
4
can fail, and why blkio_set_int("fd") is not enough to discover
5
because we assigned the result to an unsigned variable.
5
the `fd` property support.
6
Fix this by using the 'int' type instead, which matches the
7
return type of qdict_array_entries() and also the type
8
we use for the loop enumeration variable 'i'.
9
6
10
(Spotted by Coverity, CID 1360960.)
7
Let's fix them by adding more details in the code comments.
11
8
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Suggested-by: Hanna Czenczek <hreitz@redhat.com>
13
Reviewed-by: Eric Blake <eblake@redhat.com>
10
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
14
Reviewed-by: Jeff Cody <jcody@redhat.com>
11
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
15
Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org
12
Message-id: 20230803082825.25293-3-sgarzare@redhat.com
16
Signed-off-by: Jeff Cody <jcody@redhat.com>
13
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
17
---
14
---
18
block/gluster.c | 3 +--
15
block/blkio.c | 15 ++++++++++++---
19
1 file changed, 1 insertion(+), 2 deletions(-)
16
1 file changed, 12 insertions(+), 3 deletions(-)
20
17
21
diff --git a/block/gluster.c b/block/gluster.c
18
diff --git a/block/blkio.c b/block/blkio.c
22
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
23
--- a/block/gluster.c
20
--- a/block/blkio.c
24
+++ b/block/gluster.c
21
+++ b/block/blkio.c
25
@@ -XXX,XX +XXX,XX @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
22
@@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
26
Error *local_err = NULL;
23
*/
27
char *str = NULL;
24
fd = qemu_open(path, O_RDWR, NULL);
28
const char *ptr;
25
if (fd < 0) {
29
- size_t num_servers;
26
+ /*
30
- int i, type;
27
+ * qemu_open() can fail if the user specifies a path that is not
31
+ int i, type, num_servers;
28
+ * a file or device, for example in the case of Unix Domain Socket
32
29
+ * for the virtio-blk-vhost-user driver. In such cases let's have
33
/* create opts info from runtime_json_opts list */
30
+ * libblkio open the path directly.
34
opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort);
31
+ */
32
fd_supported = false;
33
} else {
34
ret = blkio_set_int(s->blkio, "fd", fd);
35
@@ -XXX,XX +XXX,XX @@ static int blkio_virtio_blk_connect(BlockDriverState *bs, QDict *options,
36
}
37
38
/*
39
- * If the libblkio driver doesn't support the `fd` property, blkio_connect()
40
- * will fail with -EINVAL. So let's try calling blkio_connect() again by
41
- * directly setting `path`.
42
+ * Before https://gitlab.com/libblkio/libblkio/-/merge_requests/208
43
+ * (libblkio <= v1.3.0), setting the `fd` property is not enough to check
44
+ * whether the driver supports the `fd` property or not. In that case,
45
+ * blkio_connect() will fail with -EINVAL.
46
+ * So let's try calling blkio_connect() again by directly setting `path`
47
+ * to cover this scenario.
48
*/
49
if (fd_supported && ret == -EINVAL) {
50
/*
35
--
51
--
36
2.9.3
52
2.41.0
37
38
diff view generated by jsdifflib