Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3795108ybi; Mon, 29 Jul 2019 12:46:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBu2xtXvXUcTHfBhye7qtmzmxtVo/DPWaMCUSLtDKl9WN3BxE+CWzREqM4kxqaJSgtnW/I X-Received: by 2002:a17:90a:30cf:: with SMTP id h73mr115498650pjb.42.1564429591081; Mon, 29 Jul 2019 12:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564429591; cv=none; d=google.com; s=arc-20160816; b=WhnUBocIGT1p4MqqzhISlFaqkKN/04ITVjmCx+6lY6IVUVyfM5Mk6277orPnQSKl0s EfRY2fi6/GhvR1k7YxOBuXazPtljJ3PeVLhWQaSlKZEfR34+Kvr/Mz4JBukNrTp89qUe QM3/6HQr6YpezvAFPO530eikRwIiVU0CAM8QGcyA+xdlB+7Zc6uzJblCvTksLmqCW7l2 Q9snVZ4WEMeqwdw+y2D4K8gZQRCg0EUm5RG7vEUWr88my7w7bKRBbgW92cv4Xmu2UWvx BHyJrmrNLg6gKRyxRHY6SN37BkAXlgM+YBtZXObwYiSN5KrVgmuPHDQwFYRgSxyv9TBJ QHpA== 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=er9u0bmwwWofpOBYSvdwcBDmFDRk6EX5mXPQa1XQWhs=; b=anjeZvTv12Mf0Mf9i3SC7Qbjb5vb0+cO3G3eHWsqoj5qxgAgw4hQGbJ4BmXAHb17in DsPD7QFmu8VmuGgNKUmZa5OIAeorqCk+1arPDBGqha9ahg4LmoEVWUzCXF2BkP0Trv8c sJSsw93cp66zY44Nes4ghzcH1zAi4OGnEO3drplPf8GmxA+98920jtaNYud7lqyJRWOa TPg0cswicSt971/yrOXpULE6mQZ+Q13tw45LEPNoJeX5OzRNx51iPmX8DcXEc429hyO3 PtHdRAIJZCogqZlpF3f2S7cFiwRpXTp5COzaZB9R4gV35KmdVsqd4m71azowj2Gp7h+n F/6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xYoYaEXc; 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 w21si24069750plq.91.2019.07.29.12.46.16; Mon, 29 Jul 2019 12:46:31 -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=xYoYaEXc; 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 S2389902AbfG2TpH (ORCPT + 99 others); Mon, 29 Jul 2019 15:45:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:33730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389827AbfG2TpC (ORCPT ); Mon, 29 Jul 2019 15:45:02 -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 0890220C01; Mon, 29 Jul 2019 19:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429501; bh=pHc7wbZC2CQyPwbypAX1PB3PGUIUAQS/3zqsA9hgQkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYoYaEXc/ySqtsvWWTmJJ4sZ0zb2bdynSeIQQYNw+WzVfHJa2BNnbAMtKnrxJuBGd Q4rmIlEfS5BvQis6BjB4wwzQWIAK5iOMlTGHXwZibRemtnMqMvilTvJcd9/r1l0x93 8yIMb+WoE2To8kDJCBw0Q5e0r1RfJoWDpz5mt+Y4= 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 4.19 079/113] dlm: check if workqueues are NULL before flushing/destroying Date: Mon, 29 Jul 2019 21:22:46 +0200 Message-Id: <20190729190714.519242769@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 a5e4a221435c..a93ebffe84b3 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1630,8 +1630,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) @@ -1691,13 +1693,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