Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3801007ybi; Mon, 29 Jul 2019 12:54:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb2Rp/limmcBfbrbVpxznRlMq0pHwTljN7jitBoPgREx6yRa9KXuwnmXjPE8EB13X/eGC0 X-Received: by 2002:a17:902:5998:: with SMTP id p24mr36708415pli.110.1564430047429; Mon, 29 Jul 2019 12:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430047; cv=none; d=google.com; s=arc-20160816; b=UFPYYT36q/cPjSQMy0jSj945dFcFbTrX9nfYvtd+09hoOZ/sZQ5jAcDoOjSGMNuVv2 86R7ka3CGNr7LWayJ0CVGUICh756n5w8Ag5op7lgaxWCCmshEdySNdfSIOvZ8KPlvaMm XhNGlM8Y7tuPu1ySkioEdGQtbX5/aPCVVA8JgBms2567l0vbqy+jzyBJhy/mzUyLldYG NvN+U6qDXdDfHNIYkxU0yan0+7C+trwS159rA3VV69pbYhk+BVf+NGs+9xYLs7NNPCgG UdtEJ4h8IHdJznd0b/FL8UvBviGQuHeI9v8Kv6bBclDsDw/smv0NqxSEvzs7OCK966OA Nr7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tF6QjaWhm60jiQjCH+PUQwMW+miYqSNqOv3z7YYs0ng=; b=BfeWrBx3QnJ5F6bCzjIQ6Tw1l1uEOGHoX7gWPkNTZ7qWQMoPlgEfltBqOTW8uFq9Zr L2sZ9PkkTIDlO9rgCtodoHdQb6juOiifGvtMPX7IbIh4DG06Z4weA3zXeX4KeUSUuaKI ihI7bGd2Yt9miqXFoE6JgzGFpdXDjMo2uvwMQ31g/W+Qy4wiN6n8/lZ4aww7LmqMkiyB Sj2y57O8HG4AaJIQY/PtWBEATmLoo0MsayE8RNX55OieHeWy+SJsDPPIVtf1orvpbKhV imUMhd7L25rwljxtU7ih6VWQKbMru1DcORatLPrWcb2EVkvP+iYujq9erJ2SoMp4yx6Q g9kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="nFWXi4/4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si28674221pgd.247.2019.07.29.12.53.52; Mon, 29 Jul 2019 12:54:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="nFWXi4/4"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403915AbfG2Twe (ORCPT + 99 others); Mon, 29 Jul 2019 15:52:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:44196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403886AbfG2TwW (ORCPT ); Mon, 29 Jul 2019 15:52:22 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8BE9B2171F; Mon, 29 Jul 2019 19:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429942; bh=dzvGZR5DDmGEX6Cf6j5ZTi37Rt4Wn/mZhjl8aYJylCA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFWXi4/4kvE3O4Cp7DRSy5b/8vlO8dmLAm7hf0v9ExsF2q6wb/CfWrTVkp9mbkq80 lX8LeWmBMXoRecQG0h+sInif/ltXVRLHKCQuYBBz66rZFsM/YYNZHcwNWWMwqKkBRy OOSh2al47UkGJTz4TpvA0QKXplDC6Vml7wreiFwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Windsor , David Teigland , Sasha Levin Subject: [PATCH 5.2 144/215] dlm: check if workqueues are NULL before flushing/destroying Date: Mon, 29 Jul 2019 21:22:20 +0200 Message-Id: <20190729190804.634942706@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit b355516f450703c9015316e429b66a93dfff0e6f ] If the DLM lowcomms stack is shut down before any DLM traffic can be generated, flush_workqueue() and destroy_workqueue() can be called on empty send and/or recv workqueues. Insert guard conditionals to only call flush_workqueue() and destroy_workqueue() on workqueues that are not NULL. Signed-off-by: David Windsor Signed-off-by: David Teigland Signed-off-by: Sasha Levin --- fs/dlm/lowcomms.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 114ebfe30929..3951d39b9b75 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1628,8 +1628,10 @@ static void clean_writequeues(void) static void work_stop(void) { - destroy_workqueue(recv_workqueue); - destroy_workqueue(send_workqueue); + if (recv_workqueue) + destroy_workqueue(recv_workqueue); + if (send_workqueue) + destroy_workqueue(send_workqueue); } static int work_start(void) @@ -1689,13 +1691,17 @@ static void work_flush(void) struct hlist_node *n; struct connection *con; - flush_workqueue(recv_workqueue); - flush_workqueue(send_workqueue); + if (recv_workqueue) + flush_workqueue(recv_workqueue); + if (send_workqueue) + flush_workqueue(send_workqueue); do { ok = 1; foreach_conn(stop_conn); - flush_workqueue(recv_workqueue); - flush_workqueue(send_workqueue); + if (recv_workqueue) + flush_workqueue(recv_workqueue); + if (send_workqueue) + flush_workqueue(send_workqueue); for (i = 0; i < CONN_HASH_SIZE && ok; i++) { hlist_for_each_entry_safe(con, n, &connection_hash[i], list) { -- 2.20.1