Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2136607iof; Tue, 7 Jun 2022 20:59:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTJVXt7wI2ux1Nu4FKqyndTBKGYMVan7W+H69zxCmANKE3Yni+NMGc+mv/8Kgq+3aSUSEp X-Received: by 2002:a17:902:a9c6:b0:15e:fe5d:cf67 with SMTP id b6-20020a170902a9c600b0015efe5dcf67mr32113784plr.74.1654660748393; Tue, 07 Jun 2022 20:59:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654660748; cv=none; d=google.com; s=arc-20160816; b=Rta8UAmzQibUeHm2Wt+n/xRt5LNIJEw31RMygCLgpwWxXQwbFcvM/rdUdQCfCHcRcF Z4miliVn6rVfL4iGRmWJqsKYvxElCi801AyPIENo3O2NzMmoLkJQDSTQb25EM22ubyCl JmNBYwc/E59D/1Lp7oTAf3IA0i4halIOPJ8SsTZo/MOUYZEoTBOEsbuHgkgRDCKbsZK0 x4kPrH3Pld96UiDzIfU8D/W0WShOu6U+Xg7W8ZPV932keVjF35jWFOmuJNEYqJUuSgq9 oF4cyyiwE1zUkjWJxWBI/DlWfV/bWeS3YldEiL24hd6Dzywsslm/sAWjSmJ2tM6bZfBv tSJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rMh8OzNh36j7XbxQqObgjKZm4WU881a0abQ2akb5Be8=; b=BJMLMDOSNUiEO8IU9vUWBvZq2ymw2FlqjCbI/O5Z8ELeb5OMfn0WMc19zNSVEE79CT 8TpSBxNpJYpRV//4zYzNWHo6ZrUezKLwBJUyEK2ObbL4LnMp7iPoQ57XQb3edZap0oX6 bxdXfizZvlgYQSY8pBANjV1eL2I+/6ATRCmfLgPeQIrUFrhHRQsiGLYEQfOdEDxVGvi1 iPlOaG14YeL3Rd+xt5owWOhyJymrE1POIRPvMo44aHC63l8qjBw5ggoBFHlOFe1ygxkt 2y6Z2fXPEXhdK76n1YX6bGj4TCMZc1JprOJ10Tpo1/6nEVY7Yt7piXrjg92DgqiESgnn 64+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yu2gyUxF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 93-20020a17090a0fe600b001c7511dc330si30087079pjz.167.2022.06.07.20.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:59:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yu2gyUxF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3597F1E3B1C; Tue, 7 Jun 2022 20:22:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242410AbiFGLFL (ORCPT + 99 others); Tue, 7 Jun 2022 07:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242235AbiFGLBh (ORCPT ); Tue, 7 Jun 2022 07:01:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECCB4B482 for ; Tue, 7 Jun 2022 04:01:34 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 18CAE6156A for ; Tue, 7 Jun 2022 11:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED93C34115; Tue, 7 Jun 2022 11:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654599693; bh=D+6gnkjQuTp/gT1kk2TY3BFGoRR4S4mcAsiWxpLdG2g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=yu2gyUxFwJrx6gWlqtUlxYiXkJg+NrVJ5zSq4Xm5uTof1R1kd2bPRaVoCJa0iS95B i1ef7reb9rxUO/WVQV+9LfSU9SosySoVqH6YtD+sWJo8nTq0DpdglQtRPGFrsZUIOZ zSFUFjASwBNzTBV+Mm4lc6Qy2xgYx++l+AckcEJ4= Date: Tue, 7 Jun 2022 13:01:26 +0200 From: Greg KH To: duoming@zju.edu.cn Cc: linux-staging@lists.linux.dev, davem@davemloft.net, kuba@kernel.org, alexander.deucher@amd.com, broonie@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback Message-ID: References: <20220520061541.14785-1-duoming@zju.edu.cn> <6c014f68.52c9b.18137daddd9.Coremail.duoming@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c014f68.52c9b.18137daddd9.Coremail.duoming@zju.edu.cn> X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Mon, Jun 06, 2022 at 03:11:39PM +0800, duoming@zju.edu.cn wrote: > Hello, > > On Mon, 6 Jun 2022 07:43:11 +0200 greg k-h wrote: > > > On Fri, May 20, 2022 at 02:15:41PM +0800, Duoming Zhou wrote: > > > There are sleep in atomic context bugs when dm_fsync_timer_callback is > > > executing. The root cause is that the memory allocation functions with > > > GFP_KERNEL parameter are called in dm_fsync_timer_callback which is a > > > timer handler. The call paths that could trigger bugs are shown below: > > > > > > (interrupt context) > > > dm_fsync_timer_callback > > > write_nic_byte > > > kzalloc(sizeof(data), GFP_KERNEL); //may sleep > > > write_nic_dword > > > kzalloc(sizeof(data), GFP_KERNEL); //may sleep > > > > > > This patch changes allocation mode from GFP_KERNEL to GFP_ATOMIC > > > in order to prevent atomic context sleeping. The GFP_ATOMIC flag > > > makes memory allocation operation could be used in atomic context. > > > > > > Signed-off-by: Duoming Zhou > > > > What commit id does this fix? > > Thanks for your time and reply! > The commit id this patch fix is 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging"). > > > And how did you find this issue? Did you run the code to verify it > > still works properly? > > I find this issue by writing codeql query. I am trying to use usb raw-gadget to simulate > rtl8192u card in order to test this code. > > What`s more, I found the usb_control_msg() with GFP_NOIO parameter in write_nic_byte() > and write_nic_dword() may also sleep. So I think use the delayed queue to replace timer > is better. Please explain all of this in the changelog text when you resend this. thanks, greg k-h