OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
Subject: [Devel] [PATCH RHEL10 COMMIT] dm-qcow2: fix ALLOW_ERROR_INJECTION class on qcow2_alloc_delta (ERRNO not NULL)
Date: Wed, 5 Aug 2026 22:39:07 +0200	[thread overview]
Message-ID: <202608052039.675Kd7Xv549698@f0.sw.ru> (raw)
In-Reply-To: <20260706110002.1024515-23-khorenko@virtuozzo.com>

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.2.vz10
------>
commit 54ac024fe0a363532284b47134aabf00a55a9cee
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Mon Jul 6 13:00:00 2026 +0200

    dm-qcow2: fix ALLOW_ERROR_INJECTION class on qcow2_alloc_delta (ERRNO not NULL)
    
    qcow2_alloc_delta() returns a valid pointer or ERR_PTR(-ENOMEM); it
    never returns NULL, and its only caller qcow2_ctr() checks IS_ERR()
    only, then dereferences the result (qcow2->img_id = i).
    
    It was annotated ALLOW_ERROR_INJECTION(..., NULL), whose default
    injected return value is 0 (NULL), which slips past the IS_ERR() check
    and NULL-derefs.
    
    Use ERRNO (error pointers only), matching the function's contract and
    the caller's handling.
    
    Fixes: b800ab29c49d1 ("dm-qcow2: Enable injection fault")
    Feature: dm-qcow2: block device over QCOW2 files 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-qcow2-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
index 3f65897ce9da2..de1fb628735b7 100644
--- a/drivers/md/dm-qcow2-target.c
+++ b/drivers/md/dm-qcow2-target.c
@@ -678,7 +678,7 @@ static struct qcow2 *qcow2_alloc_delta(struct qcow2_target *tgt, struct qcow2 *u
 
 	return qcow2;
 }
-ALLOW_ERROR_INJECTION(qcow2_alloc_delta, NULL);
+ALLOW_ERROR_INJECTION(qcow2_alloc_delta, ERRNO);
 
 static int qcow2_attach_file(struct dm_target *ti, struct qcow2_target *tgt,
 			     struct qcow2 *qcow2, int fd)

           reply	other threads:[~2026-08-05 20:39 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260706110002.1024515-23-khorenko@virtuozzo.com>]

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=202608052039.675Kd7Xv549698@f0.sw.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox