Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp262629ybb; Fri, 3 Apr 2020 02:12:06 -0700 (PDT) X-Google-Smtp-Source: APiQypKwcKmQ7TPZxyzGyOoGHfB2zmTj7QOl8bPn4oViueJIaE98pUGF8CTyUKiq+8WN+4PgW9GM X-Received: by 2002:aca:4046:: with SMTP id n67mr2313053oia.156.1585905126345; Fri, 03 Apr 2020 02:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585905126; cv=none; d=google.com; s=arc-20160816; b=vzK7GTXuvtTbqopOULsF3hmNHaDr6LmHQXFWCiyPH6sMwPz5O1O/6wX3jTq0qLeID/ iP/YJkuER0YJdRaY4LFZf3XaHjbIeiMov3fVocoqgtHfwUknM29FPHsXch5X1pyYICag wp4xpzxbruKTO+R3dpSBlxTbVgRTDXJsIWAe6xt7pWRbQ46kzVwsCDy9X93+p917/KqD vOby/fqPPz0Db2hr9BxHH3Y6W0+WoBA1/SnOXWQ6AwJxYPtzY7zhPIXmGhYSwTkqk1rT uxS1KYE8WiBPeOd4UUCUV662eM4wcl8aoj5xbK5BQiRF6n+zj2LU/8y4ypukrms7l2li DV7g== 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 :message-id:date:subject:cc:to:from; bh=CKoRvaXwJAQuMWuNyIHnRdlbCb3zW0zCr8p19cdCCZQ=; b=lM/kZqoeMquKwBWHJlY0Z4fy/SMBSVeKnArg7mdMuJBQ99mmsybRSxqlFNoUDa8FKr w7we9OV0WqpkqRjK55mbV+/QgOWW/Nq/TujC578i2Jalrkzn2ndoyv4/1j9nrrD8tt0d 0C9//xXkHqIYPIFiHVOz0vnl7STpVTUp1ehnhrcgAbgPk2ndoyThmFSMK4aBsGMr4bz4 YxFh12TLBPzO004aNEtzUZ6S9JdSvvlmOtNC4VbIIK4c6eaeVH/Tmc2mhCQNuC/KG3Oq oCt7r8zIoKRvE0PM+tb8/7ttqiZNKtCyjJxWQy42PgEutAbsQPv+jFZChHmEDtUjX48R uEZg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si3508568oib.255.2020.04.03.02.11.52; Fri, 03 Apr 2020 02:12:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390572AbgDCJFk (ORCPT + 99 others); Fri, 3 Apr 2020 05:05:40 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:48056 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727774AbgDCJFk (ORCPT ); Fri, 3 Apr 2020 05:05:40 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07484;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0TuV87rs_1585904649; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TuV87rs_1585904649) by smtp.aliyun-inc.com(127.0.0.1); Fri, 03 Apr 2020 17:04:15 +0800 From: Wen Yang To: Corey Minyard , Arnd Bergmann , Greg Kroah-Hartman Cc: Wen Yang , openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] ipmi: fix hung processes in __get_guid() Date: Fri, 3 Apr 2020 17:04:08 +0800 Message-Id: <20200403090408.58745-1-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The wait_event() function is used to detect command completion. When send_guid_cmd() returns an error, smi_send() has not been called to send data. Therefore, wait_event() should not be used on the error path, otherwise it will cause the following warning: [ 1361.588808] systemd-udevd D 0 1501 1436 0x00000004 [ 1361.588813] ffff883f4b1298c0 0000000000000000 ffff883f4b188000 ffff887f7e3d9f40 [ 1361.677952] ffff887f64bd4280 ffffc90037297a68 ffffffff8173ca3b ffffc90000000010 [ 1361.767077] 00ffc90037297ad0 ffff887f7e3d9f40 0000000000000286 ffff883f4b188000 [ 1361.856199] Call Trace: [ 1361.885578] [] ? __schedule+0x23b/0x780 [ 1361.951406] [] schedule+0x36/0x80 [ 1362.010979] [] get_guid+0x118/0x150 [ipmi_msghandler] [ 1362.091281] [] ? prepare_to_wait_event+0x100/0x100 [ 1362.168533] [] ipmi_register_smi+0x405/0x940 [ipmi_msghandler] [ 1362.258337] [] try_smi_init+0x529/0x950 [ipmi_si] [ 1362.334521] [] ? std_irq_setup+0xd0/0xd0 [ipmi_si] [ 1362.411701] [] init_ipmi_si+0x492/0x9e0 [ipmi_si] [ 1362.487917] [] ? ipmi_pci_probe+0x280/0x280 [ipmi_si] [ 1362.568219] [] do_one_initcall+0x50/0x180 [ 1362.636109] [] ? kmem_cache_alloc_trace+0x142/0x190 [ 1362.714330] [] do_init_module+0x5f/0x200 [ 1362.781208] [] load_module+0x1898/0x1de0 [ 1362.848069] [] ? __symbol_put+0x60/0x60 [ 1362.913886] [] ? security_kernel_post_read_file+0x6b/0x80 [ 1362.998514] [] SYSC_finit_module+0xe5/0x120 [ 1363.068463] [] ? SYSC_finit_module+0xe5/0x120 [ 1363.140513] [] SyS_finit_module+0xe/0x10 [ 1363.207364] [] do_syscall_64+0x74/0x180 Fixes: 50c812b2b951 ("[PATCH] ipmi: add full sysfs support") Signed-off-by: Wen Yang Cc: Corey Minyard Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: openipmi-developer@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org --- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 64ba16dcb681..c48d8f086382 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -3193,8 +3193,8 @@ static void __get_guid(struct ipmi_smi *intf) if (rv) /* Send failed, no GUID available. */ bmc->dyn_guid_set = 0; - - wait_event(intf->waitq, bmc->dyn_guid_set != 2); + else + wait_event(intf->waitq, bmc->dyn_guid_set != 2); /* dyn_guid_set makes the guid data available. */ smp_rmb(); -- 2.23.0