diff options
Diffstat (limited to 'recipes-extended/libvirt/libvirt/CVE-2023-3750.patch')
-rw-r--r-- | recipes-extended/libvirt/libvirt/CVE-2023-3750.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/recipes-extended/libvirt/libvirt/CVE-2023-3750.patch b/recipes-extended/libvirt/libvirt/CVE-2023-3750.patch new file mode 100644 index 00000000..13ead87b --- /dev/null +++ b/recipes-extended/libvirt/libvirt/CVE-2023-3750.patch | |||
@@ -0,0 +1,59 @@ | |||
1 | From 3fe8b15323a4666564c519f32fd4ab072c472051 Mon Sep 17 00:00:00 2001 | ||
2 | From: Peter Krempa <pkrempa@redhat.com> | ||
3 | Date: Thu, 13 Jul 2023 16:16:37 +0200 | ||
4 | Subject: [PATCH] storage: Fix returning of locked objects from | ||
5 | 'virStoragePoolObjListSearch' | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | CVE-2023-3750 | ||
11 | |||
12 | 'virStoragePoolObjListSearch' explicitly documents that it's returning | ||
13 | a pointer to a locked and ref'd pool that maches the lookup function. | ||
14 | |||
15 | This was not the case as in commit 0c4b391e2a9 (released in | ||
16 | libvirt-8.3.0) the code was accidentally converted to use 'VIR_LOCK_GUARD' | ||
17 | which auto-unlocked it when leaving the scope, even when the code was | ||
18 | originally "leaking" the lock. | ||
19 | |||
20 | Revert the corresponding conversion and add a comment that this function | ||
21 | is intentionally leaking a locked object. | ||
22 | |||
23 | Fixes: 0c4b391e2a9 | ||
24 | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2221851 | ||
25 | Signed-off-by: Peter Krempa <pkrempa@redhat.com> | ||
26 | Reviewed-by: Ján Tomko <jtomko@redhat.com> | ||
27 | |||
28 | CVE: CVE-2023-3750 | ||
29 | Upstream-Status: Backport [https://gitlab.com/libvirt/libvirt/-/commit/9a47442366fcf8a7b6d7422016d7bbb6764a1098] | ||
30 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
31 | --- | ||
32 | src/conf/virstorageobj.c | 7 ++++++- | ||
33 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
34 | |||
35 | diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c | ||
36 | index 7010e97..59fa5da 100644 | ||
37 | --- a/src/conf/virstorageobj.c | ||
38 | +++ b/src/conf/virstorageobj.c | ||
39 | @@ -454,11 +454,16 @@ virStoragePoolObjListSearchCb(const void *payload, | ||
40 | virStoragePoolObj *obj = (virStoragePoolObj *) payload; | ||
41 | struct _virStoragePoolObjListSearchData *data = | ||
42 | (struct _virStoragePoolObjListSearchData *)opaque; | ||
43 | - VIR_LOCK_GUARD lock = virObjectLockGuard(obj); | ||
44 | |||
45 | + virObjectLock(obj); | ||
46 | + | ||
47 | + /* If we find the matching pool object we must return while the object is | ||
48 | + * locked as the caller wants to return a locked object. */ | ||
49 | if (data->searcher(obj, data->opaque)) | ||
50 | return 1; | ||
51 | |||
52 | + virObjectUnlock(obj); | ||
53 | + | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | -- | ||
58 | 2.25.1 | ||
59 | |||