From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Wed, 5 Aug 2026 22:39:07 +0200 Subject: [Devel] [PATCH RHEL10 COMMIT] dm-qcow2: fix ALLOW_ERROR_INJECTION class on qcow2_alloc_delta (ERRNO not NULL) In-Reply-To: <20260706110002.1024515-23-khorenko@virtuozzo.com> Message-ID: <202608052039.675Kd7Xv549698@f0.sw.ru> List-Id: 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 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 Reviewed-by: Pavel Tikhomirov --- 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)