Received: by 10.213.65.68 with SMTP id h4csp224405imn; Fri, 23 Mar 2018 03:17:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBpwc8QRKHUWuc1ap6qwYQkhehbRhxwQ4uvzf+VgPP1ZWDRnCgzPgaf/aRixIlRFviYqcG X-Received: by 2002:a17:902:5204:: with SMTP id z4-v6mr28866596plh.385.1521800252032; Fri, 23 Mar 2018 03:17:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800252; cv=none; d=google.com; s=arc-20160816; b=AiRIcZykkUAqiNsd5bZBYzqVWRKnccLD25Ap8rhp32zZ+pbFcWVO/AEUDII4j87Cjh u0dGZXR0ySoMYmES6N8/r7KZMwM28S4oDCAMf1uJ8hQHAGx/7kcAgYHumbXfn76jIesR BlgVZxoF9tdb/2iH3BnrMrMGpPohY1kojHwR0Tl4+wIOx/wi/K19kbTACII6vRryfJcp 71clSENNkQ45fV7Hlk7fP6UaLfzLXOzphraWLNLXQuU4Gs1E3ip3HZyXWpopNysrL/3K zigHZ/5++QlnqMjAC+nZ2RB/RvMeL3SF8dxXi1dBgjhDQ5bFty8j+K6FRE6qFQsib+uy U73Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=KZ7Yds+f6DDMGiAF8X+lPwMuEkbIgoJsOM4p/uJLXIQ=; b=crreOlWSj+9TrPmIwEKo0sPELh+RMAvSUPCJwlvpZTOmBB4vCjrW6aPZaDQAoRWJcM DYa1ET0+dirUfdTM8kv539Hx31TizW52J2EC4qiXOoug3amyRVZsAIh7FSG2/+u78iQp xR4+k/WFPws6OodSx0ugdHHcOfBPSwTFNGNTbBkXL7EnpNIG54YWFzbQM42JnMCR1Pbv CNHwa+/V3VuUc6oRLAJ9AeAItkwK34Vme/xAtu71BDui2P3RuLeMXm4VIfdI2swGBJSv 9WcP52as8fCzR75RJJnErwmvAK4nK43ZUENKOWHle0J9kFtFIhftUJnBrFYqeT9LgCYF RbGg== ARC-Authentication-Results: i=1; mx.google.com; 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 1-v6si8674257plo.228.2018.03.23.03.17.17; Fri, 23 Mar 2018 03:17:32 -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; 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 S933584AbeCWKQF (ORCPT + 99 others); Fri, 23 Mar 2018 06:16:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46556 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933234AbeCWKQB (ORCPT ); Fri, 23 Mar 2018 06:16:01 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 525EF37; Fri, 23 Mar 2018 10:16:00 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Lippert , Corey Minyard , Sasha Levin Subject: [PATCH 4.4 57/97] ipmi/watchdog: fix wdog hang on panic waiting for ipmi response Date: Fri, 23 Mar 2018 10:54:44 +0100 Message-Id: <20180323094200.838250542@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Robert Lippert [ Upstream commit 2c1175c2e8e5487233cabde358a19577562ac83e ] Commit c49c097610fe ("ipmi: Don't call receive handler in the panic context") means that the panic_recv_free is not called during a panic and the atomic count does not drop to 0. Fix this by only expecting one decrement of the atomic variable which comes from panic_smi_free. Signed-off-by: Robert Lippert Signed-off-by: Corey Minyard Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/char/ipmi/ipmi_watchdog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -515,7 +515,7 @@ static void panic_halt_ipmi_heartbeat(vo msg.cmd = IPMI_WDOG_RESET_TIMER; msg.data = NULL; msg.data_len = 0; - atomic_add(2, &panic_done_count); + atomic_add(1, &panic_done_count); rv = ipmi_request_supply_msgs(watchdog_user, (struct ipmi_addr *) &addr, 0, @@ -525,7 +525,7 @@ static void panic_halt_ipmi_heartbeat(vo &panic_halt_heartbeat_recv_msg, 1); if (rv) - atomic_sub(2, &panic_done_count); + atomic_sub(1, &panic_done_count); } static struct ipmi_smi_msg panic_halt_smi_msg = { @@ -549,12 +549,12 @@ static void panic_halt_ipmi_set_timeout( /* Wait for the messages to be free. */ while (atomic_read(&panic_done_count) != 0) ipmi_poll_interface(watchdog_user); - atomic_add(2, &panic_done_count); + atomic_add(1, &panic_done_count); rv = i_ipmi_set_timeout(&panic_halt_smi_msg, &panic_halt_recv_msg, &send_heartbeat_now); if (rv) { - atomic_sub(2, &panic_done_count); + atomic_sub(1, &panic_done_count); printk(KERN_WARNING PFX "Unable to extend the watchdog timeout."); } else {