@samitouri / QOSamiQemu / commits / 346c151da3

vfio-user: reject malformed migration capabilities

check_migr() sets an error when the migration capability is not an object, but still returns true. This lets version negotiation continue with an Error set and reports the wrong capability name in the diagnostic. Return false for the malformed capability, and report the migration capability name. Fixes: 36227628d824 ("vfio-user: implement message send infrastructure") Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn> Reviewed-by: John Levon <john.levon@nutanix.com> Link: https://lore.kernel.org/qemu-devel/20260424031259.289211-1-zhaoguohan@kylinos.cn Signed-off-by: Cédric Le Goater <clg@redhat.com>

GuoHan Zhao committed Apr 24, 2026 at 11:12 UTC 346c151da330c42a643a160797167356357cc24e
1 file changed +2 -2
hw/vfio-user/proxy.c
+2 -2
@@ -1190,8 +1190,8 @@ static bool check_migr(VFIOUserProxy *proxy, QObject *qobj, Error **errp)
1190 QDict *qdict = qobject_to(QDict, qobj);
1191
1192 if (qdict == NULL) {
1193 - error_setg(errp, "malformed %s", VFIO_USER_CAP_MAX_FDS);
1194 - return true;
1193 + error_setg(errp, "malformed %s", VFIO_USER_CAP_MIGR);
1194 + return false;
1195 }
1196 return caps_parse(proxy, qdict, caps_migr, errp);
1197 }