From nobody Fri May 3 14:45:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; 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 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576888449; cv=none; d=zohomail.com; s=zohoarc; b=Ek08RtibO9Xgbut5CBpVmPxQ4Pnuv6jaxuU0o9wEM6wSxBR1gtB/Q7YdU8fhsSaBjtZWvVZAO/Nb/zJ9EOec5NFWa6qQVF9zN4y5UKkjxw0RWx7KSdXunWpfQnv7hTb0uHsuFu+VZWXWbkATiFjKZkqjhA0cYX20kswvkL8uLdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576888449; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=J/wThKy1dBOOu5HN1DQVlHFLTu8AIpH6hSMwYeybWlA=; b=TK/madZvBxE55roXIGnRGfmdG/LHjFrHWvnHuW4h0XPCLvrg/67BAUWkyBDTU5+Lu1pcQLdk+wmBC4dejZCUs8pmjb75fTT03DRQp2zvBxvqQwDUCQI61FkhtBVSxhvIo+/tewuWcrmwvm5p6cKI6Vy5/jZIZPA4M+RcXfyJuAc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 [205.139.110.61]) by mx.zohomail.com with SMTPS id 1576888449586312.7812238548256; Fri, 20 Dec 2019 16:34:09 -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-236-HdHaJ_DfNW2e8lplhMLIxA-1; Fri, 20 Dec 2019 19:34:05 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98A0610054E3; Sat, 21 Dec 2019 00:34:00 +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 B26E85EE0F; Sat, 21 Dec 2019 00:33:59 +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 1BCA9252EC; Sat, 21 Dec 2019 00:33:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBL0XsDg018600 for ; Fri, 20 Dec 2019 19:33:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id E53B32166B2A; Sat, 21 Dec 2019 00:33:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E03BB2166B29 for ; Sat, 21 Dec 2019 00:33:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 7C6F9803B5C for ; Sat, 21 Dec 2019 00:33:51 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.203]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-FUZ1Z9h7PzaIuvXkU6uy1g-1; Fri, 20 Dec 2019 19:33:48 -0500 Received: from localhost (unknown [192.168.167.32]) by regular1.263xmail.com (Postfix) with ESMTP id 19E4C368 for ; Sat, 21 Dec 2019 08:33:44 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.69]) by smtp.263.net (postfix) whith ESMTP id P31329T140474824259328S1576888419256145_; Sat, 21 Dec 2019 08:33:43 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576888447; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=J/wThKy1dBOOu5HN1DQVlHFLTu8AIpH6hSMwYeybWlA=; b=a3ShPe0dF+aTpE5L1JfCwYv8DABobTrMGA/MiKpPXv1a4GjDnDY9ChfprWckh6y50QPFpG cXuwL37xV3s58unlqz2A2o/K3eN5n0vNakHDIJDWF+ed8LU2nEO9oP9PiTeU+hIVeiLhyA kgG7et6PiY3iEMCwWk+oT5hhKTvMmrM= 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: Sat, 21 Dec 2019 08:33:33 +0800 Message-Id: <1576888413-20866-1-git-send-email-yili@winhong.com> In-Reply-To: <22aaf149-0f31-c378-1069-0662fd915cc5@redhat.com> References: <22aaf149-0f31-c378-1069-0662fd915cc5@redhat.com> MIME-Version: 1.0 X-MC-Unique: FUZ1Z9h7PzaIuvXkU6uy1g-1 X-MC-Unique: HdHaJ_DfNW2e8lplhMLIxA-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBL0XsDg018600 X-loop: libvir-list@redhat.com Cc: yilikernel@gmail.com, yili@winhong.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2] 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.15 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 beacuse of Some types of storage pool have no target elements. Use STREQ_NULLABLE instead of STREQ Avoids segfaults when using NULL arguments. 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 Reviewed-by: Cole Robinson --- src/storage/storage_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index a33328d..72ba252 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -1713,7 +1713,7 @@ storagePoolLookupByTargetPathCallback(virStoragePoolO= bjPtr obj, return false; =20 def =3D virStoragePoolObjGetDef(obj); - return STREQ(path, def->target.path); + return STREQ_NULLABLE(path, def->target.path); } =20 =20 --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list