From patchwork Wed Nov 28 06:13:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 10702005 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 E7FB614E2 for ; Wed, 28 Nov 2018 06:13:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6AF328FDF for ; Wed, 28 Nov 2018 06:13:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C867E2A41E; Wed, 28 Nov 2018 06:13:38 +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,SUBJ_OBFU_PUNCT_FEW 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 6F17628FDF for ; Wed, 28 Nov 2018 06:13:38 +0000 (UTC) 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 mx1.redhat.com (Postfix) with ESMTPS id 5C79D3082126; Wed, 28 Nov 2018 06:13:36 +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 BFCAA5D6AA; Wed, 28 Nov 2018 06:13:34 +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 8DDC03F7D0; Wed, 28 Nov 2018 06:13:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wAS6DTHn014647 for ; Wed, 28 Nov 2018 01:13:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 332FA1019628; Wed, 28 Nov 2018 06:13:29 +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 B70921001F50; Wed, 28 Nov 2018 06:13:25 +0000 (UTC) Received: by redhat.com (sSMTP sendmail emulation); Wed, 28 Nov 2018 00:13:24 -0600 From: "Benjamin Marzinski" To: device-mapper development Date: Wed, 28 Nov 2018 00:13:23 -0600 Message-Id: <1543385604-25453-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com Cc: Martin Wilck Subject: [dm-devel] [PATCH 1/2] libmultipath: cleanup pthread_cleanup_pop call 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 28 Nov 2018 06:13:37 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP pthread_cleanup_push() and pthread_cleanup_pop() must be called in the same lexical scope. In uevent_listen(), the pthread_cleanup_pop() call to cleanup the udev monitor is called in a nested 'if' block, within the block where pthread_cleanup_push() is called. Since this is a single-statement if block, it doesn't actually cause any problems, but it should be fixed anyways. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/uevent.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c index 5f910e6..f73de8c 100644 --- a/libmultipath/uevent.c +++ b/libmultipath/uevent.c @@ -806,7 +806,7 @@ int uevent_listen(struct udev *udev) monitor = udev_monitor_new_from_netlink(udev, "udev"); if (!monitor) { condlog(2, "failed to create udev monitor"); - goto out; + goto failback; } pthread_cleanup_push(monitor_cleanup, monitor); #ifdef LIBUDEV_API_RECVBUF @@ -893,8 +893,8 @@ int uevent_listen(struct udev *udev) } need_failback = 0; out: - if (monitor) - pthread_cleanup_pop(1); + pthread_cleanup_pop(1); +failback: if (need_failback) err = failback_listen(); pthread_cleanup_pop(1);