From nobody Fri May 3 18:51:11 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1600708062; cv=none; d=zohomail.com; s=zohoarc; b=a9aa7HPPAgjeLtuM8ORptTrgueuJyUCXahdmuabfctR/nkstitkvSwVJ4BrIhExy10AXN2IwEulGGrIZKRElRLcuGmGwQP4c1WEpHXMjcEQqcgfkqo7JAfynzprxIiM6Mkm0hSoopzleg9exU6pZzeHSH2p5oFaAkjF8DGNpk3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600708062; 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=AooWwwN5QRchKGqAV7yYUPSpbitBH33tVifCDRuQUUo=; b=NHH3DgJ91PYS9+7D3dd28v0ZNZxoB6bAGjR6OrcyVJ3fcg7Y6Z417i7DC8zXE7Pey/qGir0H7Z/c2TXksIYl6Onwr5Vu/s+Z435RnVJGQzIq9cR9D+PWpwNMUv8pF1LkW4sEm4z3rX9NOa7StTVzzdzFVuCt5lW9ag508/UHYs8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1600708062443799.1271584266365; Mon, 21 Sep 2020 10:07:42 -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-195-z-FzYDqhMuejq_0cCUU2cw-1; Mon, 21 Sep 2020 13:07:39 -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 BF69380EFBD; Mon, 21 Sep 2020 17:07:31 +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 B7FAD1002C06; Mon, 21 Sep 2020 17:07:30 +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 02CE08C7AC; Mon, 21 Sep 2020 17:07:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08LH6p9A016333 for ; Mon, 21 Sep 2020 13:06:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F0ED2018033; Mon, 21 Sep 2020 17:06:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 182F720110C8 for ; Mon, 21 Sep 2020 17:06:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 EF5D8185A78B for ; Mon, 21 Sep 2020 17:06:48 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-PE9Ch8h1NU2lDl2XmRsw_g-1; Mon, 21 Sep 2020 13:06:44 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08LH2qCp185860; Mon, 21 Sep 2020 13:06:43 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 33pyhqhckp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Sep 2020 13:06:43 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08LH2gVi029901; Mon, 21 Sep 2020 17:06:41 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 33n9m8a8w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 21 Sep 2020 17:06:41 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08LH6cC826935780 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 21 Sep 2020 17:06:38 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 532BFA405B; Mon, 21 Sep 2020 17:06:38 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D214A4054; Mon, 21 Sep 2020 17:06:38 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.20.91]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 21 Sep 2020 17:06:38 +0000 (GMT) X-MC-Unique: z-FzYDqhMuejq_0cCUU2cw-1 X-MC-Unique: PE9Ch8h1NU2lDl2XmRsw_g-1 From: Marc Hartmayer To: Subject: [PATCH] udevProcessCSS: fix segfault Date: Mon, 21 Sep 2020 19:06:32 +0200 Message-Id: <20200921170632.23850-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-21_05:2020-09-21, 2020-09-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 spamscore=0 clxscore=1011 impostorscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009210117 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false; X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Boris Fiuczynski , Erik Skultety 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't process subchannel devices where `def->driver` is not set. This fixes the following segfault: Thread 21 "nodedev-init" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x3ffb08fc910 (LWP 64303)] (gdb) bt #0 0x000003fffd1272b4 in __strcmp_vx () at /lib64/libc.so.6 #1 0x000003ffc260c3a8 in udevProcessCSS (device=3D0x3ff9018d130, def=3D0x= 3ff90194a90) #2 0x000003ffc260cb78 in udevGetDeviceDetails (device=3D0x3ff9018d130, de= f=3D0x3ff90194a90) #3 0x000003ffc260d126 in udevAddOneDevice (device=3D0x3ff9018d130) #4 0x000003ffc260d414 in udevProcessDeviceListEntry (udev=3D0x3ffa810d800= , list_entry=3D0x3ff90001990) #5 0x000003ffc260d638 in udevEnumerateDevices (udev=3D0x3ffa810d800) #6 0x000003ffc260e08e in nodeStateInitializeEnumerate (opaque=3D0x3ffa810= d800) #7 0x000003fffdaa14b6 in virThreadHelper (data=3D0x3ffa810df00) #8 0x000003fffc309ed6 in start_thread () #9 0x000003fffd185e66 in thread_start () (gdb) p *def $2 =3D { name =3D 0x0, sysfs_path =3D 0x3ff90198e80 "/sys/devices/css0/0.0.ff40", parent =3D 0x0, parent_sysfs_path =3D 0x0, parent_wwnn =3D 0x0, parent_wwpn =3D 0x0, parent_fabric_wwn =3D 0x0, driver =3D 0x0, devnode =3D 0x0, devlinks =3D 0x3ff90194670, caps =3D 0x3ff90194380 } Fixes: 05e6cdafa6e0 ("node_device: detect CSS devices") Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer Reviewed-by: Erik Skultety --- src/node_device/node_device_udev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 5f2841bb7d8e..12e3f30badd1 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1130,8 +1130,9 @@ udevProcessCSS(struct udev_device *device, virNodeDeviceDefPtr def) { /* only process IO subchannel and vfio-ccw devices to keep the list sa= ne */ - if (STRNEQ(def->driver, "io_subchannel") && - STRNEQ(def->driver, "vfio_ccw")) + if (!def->driver || + (STRNEQ(def->driver, "io_subchannel") && + STRNEQ(def->driver, "vfio_ccw"))) return -1; =20 if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0) --=20 2.25.4