From nobody Fri May 17 06:07:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) client-ip=216.205.24.74; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-74.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584634976; cv=none; d=zohomail.com; s=zohoarc; b=gYL9RUQ6CYwMrkspPQtnF9ZMHqnU8IdCpLZL8Vv5BT2SWw5n7BsxWwPxGdd9Eyb4oXl5a40Bvi9ZVZ7aKp01BPjYK1gKpSXh1SRHhtH4mCqmlzpE133O59724cqf/ioJuqj9QiReb4xXySlYYxzDs3npIk1wPWQJoYrTDLaM3vc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584634976; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=zt/+QSaU+bzk23eHxT4B8RG/3/3lgyuZmSWXuAEvIis=; b=MMqUb80tq+k1n7M/OZ24qqR1lLVyTw5XU8dp+VBrLQxqG5RplOTmhyqyQgSk1wilmxJEJTq/oBQEPL5kdc4I8a8d0yp+gsKKMX8nKzD/OP2tzWFOCh31UgcYwf9rGPY2Dy/+KsJwzasrP8ui36Z6iBuh284rJWPIgX9W1Gc8f0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.74 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) by mx.zohomail.com with SMTPS id 1584634976173884.8917851748475; Thu, 19 Mar 2020 09:22:56 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-w0e-xeVvNBWql8tGsKOE9A-1; Thu, 19 Mar 2020 12:22:52 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15F3D107ACC4; Thu, 19 Mar 2020 16:22:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7E1D1059101; Thu, 19 Mar 2020 16:22:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7981C9428B; Thu, 19 Mar 2020 16:22:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02JGMiUD015022 for ; Thu, 19 Mar 2020 12:22:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2230F5D9E2; Thu, 19 Mar 2020 16:22:44 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9566A5D9CD for ; Thu, 19 Mar 2020 16:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584634975; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zt/+QSaU+bzk23eHxT4B8RG/3/3lgyuZmSWXuAEvIis=; b=GuasBMQPhapq1q38UPv+i+Yvi3vpm3fYCc1zBjt0kU4uxF9AEoHedfrkfVaJQlveIoRtwg CzQL1sgcjH1pUZc9XE0jK4g/uVVmV+V4yvmbOxFA1AG2FzgE42zX7OsTv0XYi7E8QWAZy/ ZZAbIMRI2EkVq4EW/GeCymCP5OWedNY= X-MC-Unique: w0e-xeVvNBWql8tGsKOE9A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu: Don't crash when getting targets for a multipath Date: Thu, 19 Mar 2020 17:22:37 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In one of my previous commits I've introduced code that creates all devices for given (possible) multipath target. But I've made a mistake there - the code accesses src->path without checking if the disk source is local. Note that the path is NULL if the source is not local. Fixes: a30078cb832646177defd256e77c632905f1e6d0 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1814947 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_domain.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0e2252f6cf..ef17829235 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -15862,19 +15862,19 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm, } =20 tmpPath =3D g_strdup(next->path); + + if (virDevMapperGetTargets(next->path, &targetPaths) < 0 && + errno !=3D ENOSYS && errno !=3D EBADF) { + virReportSystemError(errno, + _("Unable to get devmapper targets fo= r %s"), + next->path); + return -1; + } } =20 if (virStringListAdd(&paths, tmpPath) < 0) return -1; =20 - if (virDevMapperGetTargets(next->path, &targetPaths) < 0 && - errno !=3D ENOSYS && errno !=3D EBADF) { - virReportSystemError(errno, - _("Unable to get devmapper targets for %s= "), - next->path); - return -1; - } - if (virStringListMerge(&paths, &targetPaths) < 0) return -1; } --=20 2.24.1