From patchwork Fri Sep 21 23:05:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 10611197 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74C6D1709 for ; Fri, 21 Sep 2018 23:06:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6651A2D79D for ; Fri, 21 Sep 2018 23:06:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AB202E0C0; Fri, 21 Sep 2018 23:06:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 21C222D79D for ; Fri, 21 Sep 2018 23:06:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CE7B8046D; Fri, 21 Sep 2018 23:06:19 +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 21A33171CD; Fri, 21 Sep 2018 23:06:19 +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 E18DB4A469; Fri, 21 Sep 2018 23:06:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8LN6HEP027396 for ; Fri, 21 Sep 2018 19:06:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7828D825E3; Fri, 21 Sep 2018 23:06:17 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with SMTP id 394AD80A4C; Fri, 21 Sep 2018 23:06:13 +0000 (UTC) Received: by redhat.com (sSMTP sendmail emulation); Fri, 21 Sep 2018 18:06:12 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Fri, 21 Sep 2018 18:05:20 -0500 Message-Id: <1537571127-10143-13-git-send-email-bmarzins@redhat.com> In-Reply-To: <1537571127-10143-1-git-send-email-bmarzins@redhat.com> References: <1537571127-10143-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Martin Wilck Subject: [dm-devel] [PATCH v3 12/19] libmutipath: don't use malformed uevents X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 21 Sep 2018 23:06:19 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP A uevent that doesn't include the ACTION and DEVPATH fields is malformed. It should be ignored, instead of used with those fields being NULL. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/uevent.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c index fd8ca35..5f910e6 100644 --- a/libmultipath/uevent.c +++ b/libmultipath/uevent.c @@ -729,6 +729,12 @@ struct uevent *uevent_from_udev_device(struct udev_device *dev) if (i == HOTPLUG_NUM_ENVP - 1) break; } + if (!uev->devpath || ! uev->action) { + udev_device_unref(dev); + condlog(1, "uevent missing necessary fields"); + FREE(uev); + return NULL; + } uev->udev = dev; uev->envp[i] = NULL;