From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v4 1/6] drivers/md/push_backup: correct initialization
Date: Tue, 03 Nov 2026 11:11:03 +0100 [thread overview]
Message-ID: <179370066311.2382033.12736627067376135427.b4-review@b4> (raw)
In-Reply-To: <20261103080358.723186-2-andrey.zhadchenko@virtuozzo.com>
On 11/3/26 11:03, Andrey Zhadchenko wrote:
> Allocate pool and htable after lock, waitqueue and deadline
> timer init so we are sure that pb_destroy() can be called
> from anywhere. Otherwise we risk timer_delete_sync_try on
> zeroed timer struct (currently luckily fine).
Hi Andrey,
The code change is fine. On the message:
- "from anywhere" is broader than the patch: it makes pb_destroy() safe
on every error path of pb_ctr().
- "luckily fine" holds for release kernels only. Our debug config has
CONFIG_DEBUG_OBJECTS_TIMERS=y, and there debug_assert_init() reports
the zeroed timer with an ODEBUG warning.
> + pb->pbio_pool = mempool_create_slab_pool(PUSH_BACKUP_POOL_SIZE,
> + pbio_cache);
> + pb->pending_htable = kcalloc(PB_HASH_TABLE_SIZE,
> + sizeof(struct hlist_head),
> + GFP_KERNEL);
> + if (!pb->pbio_pool || !pb->pending_htable)
> + goto err;
Not introduced here, but one more error path of the same function is
broken. Further down:
ret = dm_get_device(ti, argv[1], dm_table_get_mode(ti->table),
&pb->origin_dev);
...
pb->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM);
if (!pb->wq) {
ti->error = "could not create workqueue for metadata object";
goto err;
}
ret is still 0 from dm_get_device(), so a failed
alloc_ordered_workqueue() frees pb and pb_ctr() returns success. The
table keeps ti->private pointing to freed memory, and pb_dtr() destroys
it a second time. It dates back to 62e07487348e ("dm: Add push backup
driver"). Could you set ret = -ENOMEM there, in this patch or a
separate one?
With the message adjusted:
Reviewed-by: Konstantin Khorenko <khorenko@virtuozzo.com>
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-03 10:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 8:03 [Devel] [PATCH hci-8.1 v4 0/6] dm/push_backup: event fd interface and fixes Andrey Zhadchenko
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 1/6] drivers/md/push_backup: correct initialization Andrey Zhadchenko
2026-11-03 8:11 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko [this message]
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 2/6] drivers/md/push_backup: clear pb->alive under pb->lock Andrey Zhadchenko
2026-11-03 8:11 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 3/6] drivers/md/push_backup: do not re-arm deadline timer in push_backup_write() Andrey Zhadchenko
2026-11-03 8:13 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 4/6] drivers/md/push_backup: fix mod_timer() usage Andrey Zhadchenko
2026-11-03 8:12 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 5/6] drivers/md/push_backup: arm deadline timer under pb->lock Andrey Zhadchenko
2026-11-03 8:14 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko
2026-11-03 8:03 ` [Devel] [PATCH hci-8.1 v4 6/6] drivers/md/push_backup: add event file descriptor interface Andrey Zhadchenko
2026-11-03 8:17 ` no-reply
2026-11-03 10:11 ` Konstantin Khorenko
2026-11-03 12:38 ` Andrey Zhadchenko
2026-11-03 10:11 ` [Devel] [PATCH hci-8.1 v4 0/6] dm/push_backup: event fd interface and fixes 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=179370066311.2382033.12736627067376135427.b4-review@b4 \
--to=khorenko@virtuozzo.com \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=devel@openvz.org \
/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