Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3547834pxb; Mon, 24 Jan 2022 11:57:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYIYqidX6PplFbNwWJ/upslLZsuAnGV3rPCMHopco17F+5p6B4n5IA8sZjKiGdRDiXthU+ X-Received: by 2002:a17:90a:ba06:: with SMTP id s6mr3503391pjr.22.1643054269733; Mon, 24 Jan 2022 11:57:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054269; cv=none; d=google.com; s=arc-20160816; b=eMVDBgvYlHSLnye+Jo3OpmIs4nnxyWPb3dD0B9vPSSHttKRd2DzXIIo+LkL3sfRIwA 76x0LUtC9V3xMovBmoE4UCyJttB2sM2HvAEHP7pHbF8bHZjt4f32G9sJE1NSzDKZYpeZ rlrrxR8TdAejBCHiYOY8heihf50RG5uJVFObFx/2++/OVaxMYBgeo+pO6RMss6i5vzXY jcG2GOWIrU8r15HtYLxDWjpOhgAVPhwDFezp/Wm+uMqUM/szgaht7jf0OvX5+MNm2Vau MumdbCDNtZA1LbSLt4olakjJNHlufwlwX85bDuyGE//XWIi1f5P7FivJSPmBU83R7CQM Gciw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lrRI38HfWEU7oK/t3GVaSQdNzZcFWsfvMCa/TvNstVU=; b=axgigVDqQ776MzBwbriP130J5o47uIdJ8WX6m1HWVB2FlBS33z9Nbb03GxvRHe9Xem SGcqDnOdXduYJ/y7zFx8nmq2b/9NUwZ44QndE+K5sYHgJjY+kOUdFTbx030Ah78Fl+OS Cdd/3ZvBApnYctjnane0QEkdeQdE4oq/Yzm8ptT50jPWWc/ySahsjvjc6YMwCpe9UBCS vfTidb04+HAJS4KK/3VYQRji148Hn1pyRJsitaTG35ZbQ7uN8y5jFBoV9553/F+Ql9BF quYebzTHOWxwd/lneH9F4vVaCUC+Uzu5rRGxWOZfvmU0NWbvolDxIU/Azdd3YafV9Jb7 RQTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZGBSCntf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si14783177pfj.221.2022.01.24.11.57.37; Mon, 24 Jan 2022 11:57:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZGBSCntf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245729AbiAXSyS (ORCPT + 99 others); Mon, 24 Jan 2022 13:54:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343626AbiAXSw3 (ORCPT ); Mon, 24 Jan 2022 13:52:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF95EC0617AF; Mon, 24 Jan 2022 10:52:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F746614BE; Mon, 24 Jan 2022 18:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 517B0C340E5; Mon, 24 Jan 2022 18:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050338; bh=2C18HuDLscgc4+tKatxU9QstG6/auVKahETKdInN1gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGBSCntfqqIT/ZvapoUW/PEumvSrBNBjTGZh7nfKMBYwlFx4fFo2yGSYDtmLLhNZO zhDbvyyC9qsnAnneoaci3rGlIjcwmf7v/ROdlbuR0nZu++kOXkqrL8e/GQ0Jki4Wvl w7sOJyDbxhPomT++AC7BBHNj0Lrnp9toy+7yuZOE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wei Yongjun , Sasha Levin Subject: [PATCH 4.4 053/114] misc: lattice-ecp3-config: Fix task hung when firmware load failed Date: Mon, 24 Jan 2022 19:42:28 +0100 Message-Id: <20220124183928.743604648@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183927.095545464@linuxfoundation.org> References: <20220124183927.095545464@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wei Yongjun [ Upstream commit fcee5ce50bdb21116711e38635e3865594af907e ] When firmware load failed, kernel report task hung as follows: INFO: task xrun:5191 blocked for more than 147 seconds. Tainted: G W 5.16.0-rc5-next-20211220+ #11 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:xrun state:D stack: 0 pid: 5191 ppid: 270 flags:0x00000004 Call Trace: __schedule+0xc12/0x4b50 kernel/sched/core.c:4986 schedule+0xd7/0x260 kernel/sched/core.c:6369 (discriminator 1) schedule_timeout+0x7aa/0xa80 kernel/time/timer.c:1857 wait_for_completion+0x181/0x290 kernel/sched/completion.c:85 lattice_ecp3_remove+0x32/0x40 drivers/misc/lattice-ecp3-config.c:221 spi_remove+0x72/0xb0 drivers/spi/spi.c:409 lattice_ecp3_remove() wait for signals from firmware loading, but when load failed, firmware_load() does not send this signal. This cause device remove hung. Fix it by sending signal even if load failed. Fixes: 781551df57c7 ("misc: Add Lattice ECP3 FPGA configuration via SPI") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Link: https://lore.kernel.org/r/20211228125522.3122284-1-weiyongjun1@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/misc/lattice-ecp3-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 626fdcaf25101..645d26536114f 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c @@ -81,12 +81,12 @@ static void firmware_load(const struct firmware *fw, void *context) if (fw == NULL) { dev_err(&spi->dev, "Cannot load firmware, aborting\n"); - return; + goto out; } if (fw->size == 0) { dev_err(&spi->dev, "Error: Firmware size is 0!\n"); - return; + goto out; } /* Fill dummy data (24 stuffing bits for commands) */ @@ -108,7 +108,7 @@ static void firmware_load(const struct firmware *fw, void *context) dev_err(&spi->dev, "Error: No supported FPGA detected (JEDEC_ID=%08x)!\n", jedec_id); - return; + goto out; } dev_info(&spi->dev, "FPGA %s detected\n", ecp3_dev[i].name); @@ -121,7 +121,7 @@ static void firmware_load(const struct firmware *fw, void *context) buffer = kzalloc(fw->size + 8, GFP_KERNEL); if (!buffer) { dev_err(&spi->dev, "Error: Can't allocate memory!\n"); - return; + goto out; } /* @@ -160,7 +160,7 @@ static void firmware_load(const struct firmware *fw, void *context) "Error: Timeout waiting for FPGA to clear (status=%08x)!\n", status); kfree(buffer); - return; + goto out; } dev_info(&spi->dev, "Configuring the FPGA...\n"); @@ -186,7 +186,7 @@ static void firmware_load(const struct firmware *fw, void *context) release_firmware(fw); kfree(buffer); - +out: complete(&data->fw_loaded); } -- 2.34.1