From nobody Tue Apr 30 07:47:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576849108; cv=none; d=zohomail.com; s=zohoarc; b=bIyUKsd1WKnGVG7h9MLUjhpm/Kd7DTFWLmafh6I8qNiejYYx9tpnbPUx3TW385V6QVH5A9Mml0p8XDtFGV7EJMY6SiQPfezstRrs4Jb8Leavz7Wy4KucsJQbu+ipL+50IZgkL4G0gtlXDSDQLmPct1KHTa/P55AeaaglLdznMks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576849108; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=B8jeZ9o3zrD5GgGtIMh3lNT5HtwlK6pI1EwWH1nhUE8=; b=CZZjdOz1M26AOb3bPfP1iTteZXLPSVssO4nSJRKhvTq4pn+cXAdx6ZeM+kfyI+a+XpatYtFtnrAdUrqJPfpHiPA9W+vnae0cUhTJQa5M1RdFn+U3/QTVxONmJVUmzVb1LwQwdW7kWae7O9SH9sUGWUwSmLdSGevtJoXTCroaCDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576849108243705.1010650053119; Fri, 20 Dec 2019 05:38:28 -0800 (PST) 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-139-2NEZAPDjNuaA_gR_MaD1Wg-1; Fri, 20 Dec 2019 08:38:25 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7892A800053; Fri, 20 Dec 2019 13:38:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E201C5DA75; Fri, 20 Dec 2019 13:38:18 +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 435441809567; Fri, 20 Dec 2019 13:38:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBKDcF4W029592 for ; Fri, 20 Dec 2019 08:38:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D65716C2E8; Fri, 20 Dec 2019 13:38:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16ED916C2F1 for ; Fri, 20 Dec 2019 13:38:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 070738032A6 for ; Fri, 20 Dec 2019 13:38:12 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.201]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-358-NhVkTk_TMDyreA8fyW-_bw-1; Fri, 20 Dec 2019 08:38:09 -0500 Received: from localhost (unknown [192.168.167.69]) by regular1.263xmail.com (Postfix) with ESMTP id 0F74133E for ; Fri, 20 Dec 2019 21:38:06 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.69]) by smtp.263.net (postfix) whith ESMTP id P26865T140479415953152S1576849072830154_; Fri, 20 Dec 2019 21:38:05 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576849106; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=B8jeZ9o3zrD5GgGtIMh3lNT5HtwlK6pI1EwWH1nhUE8=; b=GJi0zxUi5JMQkyzVhP4bdO0o76mlO0S2PiesA9EVq2hIPKNAhe1mWqc83GWY47M3z3jT6C ot06TILLfAPedcRaptWN3b1Otxgj4J5bFtRC780vPE9uz+LBL0ROkAUPRa/3pvhCVKRaVk ITIR/Gfddrtm9I3FNDppbCdnBE4NKy4= X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.69 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Yi Li To: libvir-list@redhat.com Date: Fri, 20 Dec 2019 21:37:34 +0800 Message-Id: <1576849054-17764-1-git-send-email-yili@winhong.com> MIME-Version: 1.0 X-MC-Unique: NhVkTk_TMDyreA8fyW-_bw-1 X-MC-Unique: 2NEZAPDjNuaA_gR_MaD1Wg-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBKDcF4W029592 X-loop: libvir-list@redhat.com Cc: yilikernel@gmail.com, yili@winhong.com Subject: [libvirt] [PATCH] storage: Fix daemon crash on lookup storagepool by targetpath 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.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Causing a crash when storagePoolLookupByTargetPath because of Some types of storage pool have no target elements. Core was generated by `/usr/sbin/libvirtd'. Program terminated with signal 11, Segmentation fault. (gdb) bt 0 0x0000ffff9e951388 in strcmp () from /lib64/libc.so.6 1 0x0000ffff92103e9c in storagePoolLookupByTargetPathCallback ( obj=3D0xffff7009aab0, opaque=3D0xffff801058b0) at storage/storage_drive= r.c:1649 2 0x0000ffff9f2c52a4 in virStoragePoolObjListSearchCb ( payload=3D0xffff801058b0, name=3D, opaque=3D) at conf/virstorageobj.c:476 3 0x0000ffff9f1f2f7c in virHashSearch (ctable=3D0xffff800f4f60, iter=3Diter@entry=3D0xffff9f2c5278 , data=3Ddata@entry=3D0xffff95af7488, name=3Dname@entry=3D0x0) at util/vi= rhash.c:696 4 0x0000ffff9f2c64f0 in virStoragePoolObjListSearch (pools=3D0xffff800f2ce= 0, searcher=3Dsearcher@entry=3D0xffff92103e68 , opaque=3D) at conf/virstorageobj.c:505 5 0x0000ffff92101f54 in storagePoolLookupByTargetPath (conn=3D0xffff5c0009= f0, path=3D0xffff7009a850 "/vms/images") at storage/storage_driver.c:1672 Signed-off-by: Yi Li --- src/storage/storage_driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index a33328d..5863e1f 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1713,6 +1713,12 @@ storagePoolLookupByTargetPathCallback(virStoragePool= ObjPtr obj, return false; =20 def =3D virStoragePoolObjGetDef(obj); + + /* Some Storage pool types have no Target elements, + * so we should check it. */ + if (def->target.path =3D=3D NULL) + return false; + return STREQ(path, def->target.path); } =20 --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list