* [Devel] [PATCH vz10 v2 1/2] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() [not found] <20260706110002.1024515-21-khorenko@virtuozzo.com> @ 2026-08-19 16:56 ` Konstantin Khorenko 2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early Konstantin Khorenko 2026-08-19 16:57 ` [Devel] [PATCH RHEL10 COMMIT] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko 0 siblings, 2 replies; 4+ messages in thread From: Konstantin Khorenko @ 2026-08-19 16:56 UTC (permalink / raw) ploop_get_delta_file() returns a valid struct file * or an ERR_PTR(), never NULL, and its only caller relies on exactly that. The function, however, is annotated as ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO_NULL); So injecting a failure the default way makes the function return NULL, the NULL sails past IS_ERR() and vfs_fsync() dereferences it. This is the annotation misdescribing the function rather than a missing check in the caller: NULL is not a value ploop_get_delta_file() can ever return. Use the ERRNO class, which injects error pointers only. Fixes: 4fc49f0700e2 ("dm-ploop: Allow fault injection for all ploop functions") Feature: dm-ploop: ploop target driver https://virtuozzo.atlassian.net/browse/VSTOR-137234 Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com> Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> --- drivers/md/dm-ploop-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c index 0de0e84d440d0..7dab95402def7 100644 --- a/drivers/md/dm-ploop-target.c +++ b/drivers/md/dm-ploop-target.c @@ -255,7 +255,7 @@ static struct file *ploop_get_delta_file(struct ploop *ploop, int fd) return ERR_PTR(ret); } -ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO_NULL); +ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO); static int ploop_check_top_delta(struct ploop *ploop, struct file *file) { -- 2.43.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early 2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 1/2] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko @ 2026-08-19 16:56 ` Konstantin Khorenko 2026-08-19 16:57 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko 2026-08-19 16:57 ` [Devel] [PATCH RHEL10 COMMIT] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko 1 sibling, 1 reply; 4+ messages in thread From: Konstantin Khorenko @ 2026-08-19 16:56 UTC (permalink / raw) ploop_ctr() can fail early on setting up the ploop->kt_allocator, so ploop_destroy() must check it for NULL before dereferencing. Fixes: 9429d1119a69 ("dm-ploop: make filespace preallocations async") Feature: dm-ploop: ploop target driver https://virtuozzo.atlassian.net/browse/VSTOR-137234 Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com> Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> --- drivers/md/dm-ploop-target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c index 7dab95402def7..3b589579741c6 100644 --- a/drivers/md/dm-ploop-target.c +++ b/drivers/md/dm-ploop-target.c @@ -188,7 +188,9 @@ static void ploop_destroy(struct ploop *ploop) /* waits for the thread to stop */ kthread_stop(ploop->kt_worker->task); - kthread_stop(ploop->kt_allocator->task); + /* kt_allocator may be NULL if ploop_ctr() failed early */ + if (ploop->kt_allocator) + kthread_stop(ploop->kt_allocator->task); WARN_ON(!llist_empty(&ploop->pios[PLOOP_LIST_PREPARE])); WARN_ON(!llist_empty(&ploop->llresubmit_pios)); -- 2.43.0 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early 2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early Konstantin Khorenko @ 2026-08-19 16:57 ` Konstantin Khorenko 0 siblings, 0 replies; 4+ messages in thread From: Konstantin Khorenko @ 2026-08-19 16:57 UTC (permalink / raw) The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 34e8c5f7f782ec22e77bd1752695cafb0cb98282 Author: Konstantin Khorenko <khorenko@virtuozzo.com> Date: Wed Aug 19 18:33:20 2026 +0200 dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early ploop_ctr() can fail early on setting up the ploop->kt_allocator, so ploop_destroy() must check it for NULL before dereferencing. Fixes: 9429d1119a69 ("dm-ploop: make filespace preallocations async") Feature: dm-ploop: ploop target driver https://virtuozzo.atlassian.net/browse/VSTOR-137234 Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com> Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> --- drivers/md/dm-ploop-target.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c index 7dab95402def7..3b589579741c6 100644 --- a/drivers/md/dm-ploop-target.c +++ b/drivers/md/dm-ploop-target.c @@ -188,7 +188,9 @@ static void ploop_destroy(struct ploop *ploop) /* waits for the thread to stop */ kthread_stop(ploop->kt_worker->task); - kthread_stop(ploop->kt_allocator->task); + /* kt_allocator may be NULL if ploop_ctr() failed early */ + if (ploop->kt_allocator) + kthread_stop(ploop->kt_allocator->task); WARN_ON(!llist_empty(&ploop->pios[PLOOP_LIST_PREPARE])); WARN_ON(!llist_empty(&ploop->llresubmit_pios)); ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() 2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 1/2] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko 2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early Konstantin Khorenko @ 2026-08-19 16:57 ` Konstantin Khorenko 1 sibling, 0 replies; 4+ messages in thread From: Konstantin Khorenko @ 2026-08-19 16:57 UTC (permalink / raw) The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 1ab5dd2ffa73d34985c1e57dd4e3ab27c04fb4d4 Author: Konstantin Khorenko <khorenko@virtuozzo.com> Date: Wed Aug 19 18:33:35 2026 +0200 dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() ploop_get_delta_file() returns a valid struct file * or an ERR_PTR(), never NULL, and its only caller relies on exactly that. The function, however, is annotated as ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO_NULL); So injecting a failure the default way makes the function return NULL, the NULL sails past IS_ERR() and vfs_fsync() dereferences it. This is the annotation misdescribing the function rather than a missing check in the caller: NULL is not a value ploop_get_delta_file() can ever return. Use the ERRNO class, which injects error pointers only. Fixes: 4fc49f0700e2 ("dm-ploop: Allow fault injection for all ploop functions") Feature: dm-ploop: ploop target driver https://virtuozzo.atlassian.net/browse/VSTOR-137234 Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com> Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> --- drivers/md/dm-ploop-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c index 0de0e84d440d0..7dab95402def7 100644 --- a/drivers/md/dm-ploop-target.c +++ b/drivers/md/dm-ploop-target.c @@ -255,7 +255,7 @@ static struct file *ploop_get_delta_file(struct ploop *ploop, int fd) return ERR_PTR(ret); } -ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO_NULL); +ALLOW_ERROR_INJECTION(ploop_get_delta_file, ERRNO); static int ploop_check_top_delta(struct ploop *ploop, struct file *file) { ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-19 16:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20260706110002.1024515-21-khorenko@virtuozzo.com>
2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 1/2] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko
2026-08-19 16:56 ` [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early Konstantin Khorenko
2026-08-19 16:57 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-19 16:57 ` [Devel] [PATCH RHEL10 COMMIT] dm-ploop: use the ERRNO fault injection class for ploop_get_delta_file() Konstantin Khorenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox