Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1544113iob; Thu, 19 May 2022 08:45:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuednAMdscwvKXcjoHok4dOsdW7tSwEe0FNK3SyTxEdWlJLgt7K90ZbjwTeMFZIoOFCsXh X-Received: by 2002:a17:906:7309:b0:6f5:ea1:afa with SMTP id di9-20020a170906730900b006f50ea10afamr4920857ejc.170.1652975120830; Thu, 19 May 2022 08:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652975120; cv=none; d=google.com; s=arc-20160816; b=l1jzvKb5FRDh5KZkEhYgE09wdQXfhYmODntb6CWl6wtc1CyIsEw2mr2nXm9b0vt2zG Ir91NZQJXRDHn0JkzVW4bNuIhLPKMUOQXyJg5QfLDoQ+oLwP0H+yMqX8gDvw77PD38sq gDNXjE9uAoMRYpDXt75VFKj40JIaK07Vx/ScH+HYV48TzFQMyBMpJ08/mti3NnbJz83a IniIort7aydYhaOwZGLylbyK9PeuYf9p9pH/VGq7pL90yKugfJAt488JrPRZi5h5i7Vv Li/2MyXAlGHk4IEox1Enjyh2KW5KTQVsJXXE+EcfwWh3FN2x1OPMryC4en6UJjdUPpFg kH8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=92ZZWy3p7NSyWXfLYlJ4ezoaS6yZOwh6GiYp4APH5UU=; b=rYnqmAvDphkez/OnR01VtV43SRCZmn0H7p8PTiw6LmXxTh6kQHAUSJC6iRFvisvQ+V YpiezosYOp2Axzr8xNIJoF1peKW/NwkyFXuR4QmZknb/ojrF0Urqw1OHgp5IX7rCn38W PJD56XzWx81wQe/kfEhEIbs/j/xAiXJFKHzWdkIq7dPcgqqziXxgo6Yr0gbcRfmto1Tj BD+prLTyxvOxY451AVU+Xz2+l/pEcFCWrz7AGYHaCRWe5KsAwodMbicHmpCfBzHeqhR7 e0oEnNCs9c3GkPTm8AqdAsIyAwbwgKiKlwUf5dmGnKLCl5ex/yHd7JzgYvxzyOGUbbrq 5S6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="jor/8LF2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a056402090c00b0042b0b3ac225si994224edz.439.2022.05.19.08.44.53; Thu, 19 May 2022 08:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="jor/8LF2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239982AbiESOuK (ORCPT + 99 others); Thu, 19 May 2022 10:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239965AbiESOuI (ORCPT ); Thu, 19 May 2022 10:50:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B798E27A3; Thu, 19 May 2022 07:50:07 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 28A8EB82332; Thu, 19 May 2022 14:50:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BAD1C385AA; Thu, 19 May 2022 14:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652971804; bh=co3fUDj78RM5wW0Lh+KE75FvB8/+RLtvVClhMBRExrI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=jor/8LF2QYz1lNosyOhrcyDZMBWYL6OfzWpgq49cXjr2b+IuabhWfp/BQZDB+Y+CW a00LmmAHVaS1DXgsku78Dim9JODaC/+gqMQWg3ReHeykwYcYpSmfx3yfB5Q8GlHDxi RqP15TS91rKCKB3bRjsSmnmvMV6UKnTwSj2hCsaQ1hWfUUt6Z3L2rF3SbavmcpgVzZ 9szNaSt9ZdD3s6RXM9qnRPxI+QQaJe249KauuijsgENEU9KaqjhUeorBzURdCVVyO5 QOVuA0G6pjX2ZEq+aCsOoj4PVfaJkwCmJTExyzYYxvQpQPnf4kTHje8SEXWUHzACta hCu5kQGRUELew== From: Kalle Valo To: duoming@zju.edu.cn Cc: linux-kernel@vger.kernel.org, amitkarwar@gmail.com, ganapathi017@gmail.com, sharvari.harisangam@nxp.com, huxinming820@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net] net: wireless: marvell: mwifiex: fix sleep in atomic context bugs References: <20220519101656.44513-1-duoming@zju.edu.cn> <87fsl53jic.fsf@kernel.org> <257f8e7.216cd.180dc1af4d3.Coremail.duoming@zju.edu.cn> Date: Thu, 19 May 2022 17:49:58 +0300 In-Reply-To: <257f8e7.216cd.180dc1af4d3.Coremail.duoming@zju.edu.cn> (duoming's message of "Thu, 19 May 2022 19:36:35 +0800 (GMT+08:00)") Message-ID: <877d6h37c9.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org duoming@zju.edu.cn writes: > Hello, > > On Thu, 19 May 2022 13:27:07 +0300 Kalle Valo wrote: > >> > There are sleep in atomic context bugs when uploading device dump >> > data on usb interface. The root cause is that the operations that >> > may sleep are called in fw_dump_timer_fn which is a timer handler. >> > The call tree shows the execution paths that could lead to bugs: >> > >> > (Interrupt context) >> > fw_dump_timer_fn >> > mwifiex_upload_device_dump >> > dev_coredumpv(..., GFP_KERNEL) >> > dev_coredumpm() >> > kzalloc(sizeof(*devcd), gfp); //may sleep >> > dev_set_name >> > kobject_set_name_vargs >> > kvasprintf_const(GFP_KERNEL, ...); //may sleep >> > kstrdup(s, GFP_KERNEL); //may sleep >> > >> > This patch moves the operations that may sleep into a work item. >> > The work item will run in another kernel thread which is in >> > process context to execute the bottom half of the interrupt. >> > So it could prevent atomic context from sleeping. >> > >> > Fixes: f5ecd02a8b20 ("mwifiex: device dump support for usb interface") >> > Signed-off-by: Duoming Zhou >> >> Have you tested this on real hardware? Or is this just a theoretical >> fix? > > This is a theoretical fix. I don't have the real hardware. For such patches clearly document that in the commit log, for example something like "Compile tested only." or similar. But do take into account that I'm wary about non-trivial fixes which have not been tested on a real device, it's easy to do more harm than good. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches