]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dm-ioctl: report an error if a device has no table
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 11 May 2026 11:04:16 +0000 (13:04 +0200)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 18 May 2026 12:27:11 +0000 (14:27 +0200)
When we send a message to a device that has no table, the return code was
not set. The code would return "2", which is not considered a valid return value.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
drivers/md/dm-ioctl.c

index b92ec3efff01c47626a96357d339f3f5aa46b218..ac77dc0ca22553e272a12ea8af3033cf3e969ce7 100644 (file)
@@ -1938,8 +1938,11 @@ static int target_message(struct file *filp, struct dm_ioctl *param, size_t para
                goto out_argv;
 
        table = dm_get_live_table(md, &srcu_idx);
-       if (!table)
+       if (!table) {
+               DMERR("The device has no table.");
+               r = -EINVAL;
                goto out_table;
+       }
 
        if (dm_deleting_md(md)) {
                r = -ENXIO;