Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbbG0GGl (ORCPT ); Mon, 27 Jul 2015 02:06:41 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:47737 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbbG0GGj (ORCPT ); Mon, 27 Jul 2015 02:06:39 -0400 X-AuditID: 85900ec0-9afc5b9000001a57-5f-55b5ca364713 X-Mailbox-Line: From nobody Mon Jul 27 14:55:16 2015 Subject: [PATCH 5/7] ipmi: Don't call receive handler in the panic context To: Corey Minyard From: Hidehiro Kawai Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Date: Mon, 27 Jul 2015 14:55:16 +0900 Message-ID: <20150727055516.4759.56342.stgit@softrs> In-Reply-To: <20150727055516.4759.34462.stgit@softrs> References: <20150727055516.4759.34462.stgit@softrs> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1482 Lines: 39 Received handlers defined as ipmi_recv_hndl member of struct ipmi_user_hndl can take a spinlock. This means that if the kernel panics while holding the lock, a deadlock may happen on the lock while flushing queued messages in the panic context. Calling the receive handler doesn't make much meanings in the panic context, simply skip it to avoid possible deadlocks. Signed-off-by: Hidehiro Kawai --- drivers/char/ipmi/ipmi_msghandler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index e7d84482..5a2d9fe 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -744,7 +744,13 @@ static void deliver_response(struct ipmi_recv_msg *msg) ipmi_inc_stat(intf, unhandled_local_responses); } ipmi_free_recv_msg(msg); - } else { + } else if (!oops_in_progress) { + /* + * If we are running in the panic context, calling the + * receive handler doesn't much meaning and has a deadlock + * risk. At this moment, simply skip it in that case. + */ + ipmi_user_t user = msg->user; user->handler->ipmi_recv_hndl(msg, user->handler_data); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/