]> git.ipfire.org Git - thirdparty/systemd.git/commit
vmspawn: reject --bind-volume= duplicates at parse time 41961/head
authorChristian Brauner <brauner@kernel.org>
Wed, 6 May 2026 10:40:26 +0000 (12:40 +0200)
committerChristian Brauner <brauner@kernel.org>
Wed, 6 May 2026 12:30:37 +0000 (14:30 +0200)
commitcbadda5e60bae8858f38379aae3556ed3b03721f
treeee67c748cef34c3cb350ec270ff63bed07976461
parent4ddfd04a482a84dd86f8c9fe9b321f2404349589
vmspawn: reject --bind-volume= duplicates at parse time

bind_volume_parse() does not look at peers, so passing the same
PROVIDER:VOLUME twice on the command line silently produces two parsed
entries in arg_bind_volumes. vmspawn_bind_volume_acquire() then builds
two DriveInfo with identical d->id ("<provider>:<volume>"). At boot,
bridge_register_drive() puts d->id into the b->block_devices hashmap;
the second insert returns -EEXIST and the user sees a bare "File
exists" with no context for which volume is responsible.

Reject the collision at the parse site with a linear scan over the
existing array — n_items is small (one entry per --bind-volume on the
command line), and a clear error message naming the offending volume
is much more useful than the late EEXIST from the QMP setup loop.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
src/vmspawn/vmspawn.c