Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1168597iog; Sat, 25 Jun 2022 02:44:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5xOq9rTBBPt6rFUUj6NqxcfgVCFYvtigODlpeM5iA5ZCERxnFIwuqsAKPVp8p3NKlb8JF X-Received: by 2002:a17:902:ec85:b0:16a:1d00:4ef6 with SMTP id x5-20020a170902ec8500b0016a1d004ef6mr3684409plg.62.1656150273530; Sat, 25 Jun 2022 02:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656150273; cv=none; d=google.com; s=arc-20160816; b=H/+szuew9MEeyrTaURb2GkK1fmDN0Z5DYaRp2J4jfaZUJC6RXdW29ZWLdhuXG7NXeO gZbAKxjxhksD1BqF5xYpiSiDK5r1aGOvZIHezyhOD5ZLeCanaNBCAWjdYIJsL719875V nALd6oOKt3PKgdl60MvercuhVHqhLwSI8/zp937MKIDydFlsfTxWHvaelyBC/eOmT8Tz 3VjOtDg/Kl+GWQY+RnOHpewxTkrm68VWLAi0Fq5eQ1VUru+tT3Qoko8KIhfBwqqmW9Q2 MhKHRDpZiLnIG8Chr31J1J3+mqW/hhDIE6w833QJyZX2Ywcn1pKfXhsUlM3lE2IvJ+M5 XWMw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ePS3eKvOOJzACj8CqagGJWl1s5MuC4BFigwNEK8NiQY=; b=WIUefhw6vX8SP14GnpuI6Evbmmcglgzj6LJGXMJqczPkvTwpWElV3rVSzo6GyCo/3U eDCp2GiiWOwkOPDzryWV/hERoALQFVXLuOllMl6jednxy8jY8cFhKBGE7mYMYxBmQguz Z41RmU6fn7chYhX7A+IcRDaE7DzDUWwsostujrXPdBS/2xlozm6Lb6FTQFPx0f04muG6 iEVqQCPIaB14ii6kkIfKdA9ahhfqmbMU+oXOl4At4C5Nzcbma0z4BmhgMVqJ+7PwJRDF qt/4sfYlRA9bZkk2juNFUPiMDk/RHCOGpj3r6dcJtVai6+kwD9i0hqu2DzFcz/ENtAUu nbaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pOmHi7oQ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 77-20020a630050000000b003fc51453576si6048803pga.545.2022.06.25.02.44.21; Sat, 25 Jun 2022 02:44:33 -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=@linuxfoundation.org header.s=korg header.b=pOmHi7oQ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbiFYJaV (ORCPT + 99 others); Sat, 25 Jun 2022 05:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232140AbiFYJaU (ORCPT ); Sat, 25 Jun 2022 05:30:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D92D2C132 for ; Sat, 25 Jun 2022 02:30:19 -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 2F6CCB818FE for ; Sat, 25 Jun 2022 09:30:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ACFFC3411C; Sat, 25 Jun 2022 09:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656149417; bh=tcU5XmpCJeuUxNJXmTWn3A1u75vW01b3kSYZ+naAcsE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pOmHi7oQJ6OFaFx7aKCd8NgDtKCV6VLOAIL9AWuEu/u7hYKvPYWjQmFj3WqjV5FWq A49KIWkAbfaPKwK2XUu5b753elpYaaeCgaN5cyY4JWaIBE0XXwo7qBVFIC/NuzkJlP X8ROhvLSCNaQFKXFNig7yjQrs+byKda8pUet+79A= Date: Sat, 25 Jun 2022 11:30:13 +0200 From: Greg KH To: duoming@zju.edu.cn Cc: linux-staging@lists.linux.dev, davem@davemloft.net, alexander.deucher@amd.com, kuba@kernel.org, broonie@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback Message-ID: References: <20220623055912.84138-1-duoming@zju.edu.cn> <1ddff589.e0f1.181944e6c1a.Coremail.duoming@zju.edu.cn> <482a0dc6.10f76.1819a2a3546.Coremail.duoming@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <482a0dc6.10f76.1819a2a3546.Coremail.duoming@zju.edu.cn> X-Spam-Status: No, score=-7.7 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 On Sat, Jun 25, 2022 at 05:21:06PM +0800, duoming@zju.edu.cn wrote: > Hello, > > > > On Thu, Jun 23, 2022 at 01:59:12PM +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 or GFP_NOIO parameters 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 > > > > usb_control_msg > > > > kmalloc(.., GFP_NOIO); //may sleep > > > > write_nic_dword > > > > kzalloc(sizeof(data), GFP_KERNEL); //may sleep > > > > usb_control_msg > > > > kmalloc(.., GFP_NOIO); //may sleep > > > > > > > > This patch uses delayed work to replace timer and moves the operations > > > > that may sleep into the delayed work in order to mitigate bugs. > > > > > > > > Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") > > > > Signed-off-by: Duoming Zhou > > > > --- > > > > Changes in v2: > > > > - Use delayed work to replace timer. > > > > > > Did you test this with real hardware to verify it still works? > > > > I am testing this and I will give you feedback within one or two days. > > Do you know what vendor id and device id use the r8192u_usb driver? The vendor/device ids are in the driver itself. Also in the output of modinfo: ❯ modinfo drivers/staging/rtl8192u/r8192u_usb.ko | grep alias alias: usb:v043Ep7A01d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v5A57p0290d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v2001p3301d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v1740p9201d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v0DF6p0031d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v050Dp805Ed*dc*dsc*dp*ic*isc*ip*in* alias: usb:v07AAp0043d*dc*dsc*dp*ic*isc*ip*in* alias: usb:v0BDAp8709d*dc*dsc*dp*ic*isc*ip*in* see the "v" and "p" portions of the alias string. thanks, greg k-h