All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH vz10 v2 2/2] dm-ploop: fix NULL deref in ploop_destroy() when ploop_ctr() failed early
Date: Wed, 19 Aug 2026 18:56:29 +0200	[thread overview]
Message-ID: <20260819165629.497296-2-khorenko@virtuozzo.com> (raw)
In-Reply-To: <20260819165629.497296-1-khorenko@virtuozzo.com>

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


  reply	other threads:[~2026-08-19 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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   ` Konstantin Khorenko [this message]
2026-08-19 16:57     ` [Devel] [PATCH RHEL10 COMMIT] 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

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=20260819165629.497296-2-khorenko@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.