Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2375482rwl; Thu, 13 Apr 2023 05:48:57 -0700 (PDT) X-Google-Smtp-Source: AKy350aEuu0gfGEhMo69qDrIvw5TtEVkiqLezLR7iK3diXSUJWnVO65cWqDnQH9+S/29OEX94VRU X-Received: by 2002:a05:6a20:1e54:b0:d9:840f:79c2 with SMTP id cy20-20020a056a201e5400b000d9840f79c2mr2076148pzb.2.1681390137705; Thu, 13 Apr 2023 05:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681390137; cv=none; d=google.com; s=arc-20160816; b=bvt9zHUeFlWM1FLjdFsc9UD/xpSavZ/q/i+xjdSxcgC6PtlHr+qVZVuOfWVabdC94b d+VMX8SkyRVeZzBZ2b9nHXmdaDWpialPSweCtoHs2y0zU6qsB6zpij7DCcWc1lpAyusH w5V03YRBsneGG5Q75o5JUWeCpfqZzf8PUe6YfNkpBgp2L4zgryo5/Fy2Baeqklu+kL25 cgxtc4yY0KgyY4mzy42j8ANP8a0L2ps2wgX9UfaF6jvFVx6z0DsAeRhTGiCEW4tpWkk/ KF5qvW4T3TfIZ++yTSOPgt6q2ZKW9eMWK86ohafaQz1SHBBmaLdavzuRnQGtSqtjPpSg ioXA== 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=GFd/Wu8nPjXZZvRKtnwBDJ7dYD0QE+sDGyeznPDc7FQ=; b=1HCvX51FOlbb6zfFEbCTZRs3T21B9BaqeuCDCd0Xk1BquOOiRQ94PYa+90yNZGWn2q Qlnh3YA/DD/yBfuSz4hrF4jb0jtaTeBMA5t4qXww6qnnhNJXb+F+Hn/8dGJcPSzElpCF NmDsToNdW+E8zNJYcBZ1nczsGRle+7nSeBhDcFnSaWUCXEsae4RXONSJJotKqeb3zlln qMKxtV8VXQP0f2iZZhK09gO0Cmn1JtYvNCLgnWMEspukqtHLZWkGUcn9kKANduTI78nh Vhq6HUcU4IFPGhkmw0QgQI36+d/HlzeJFUC2KWqJvatrEWtRNBcQ0ppsf8LjjgVUaVAQ Ik9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BxU01KBW; 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 h70-20020a638349000000b0051b5e453299si447613pge.225.2023.04.13.05.48.46; Thu, 13 Apr 2023 05:48:57 -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=BxU01KBW; 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 S229818AbjDMMsE (ORCPT + 99 others); Thu, 13 Apr 2023 08:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229722AbjDMMsD (ORCPT ); Thu, 13 Apr 2023 08:48:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A0F88A74 for ; Thu, 13 Apr 2023 05:48:02 -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 2708D63906 for ; Thu, 13 Apr 2023 12:48:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EF60C433EF; Thu, 13 Apr 2023 12:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681390081; bh=Pe5uMNkQGXHvLTcEYPm3B5O3mU81jY6Z+wmWp5Fn52M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BxU01KBW2dz0eHNO8dz3BP30VjT2oL54cWZ24vnOeT2hJzl8ygGwq0qtW5S2SnGqv NK6l3GFl2JC5Ybb17x2FwqmOWhjZ7TJzS670pVYkDmRTuZqOHeDDmWuVil+uauN5Qv zFJnNH1pD/SWxzpm0IxGAVUzs0eZfL6VYApiKZJ0= Date: Thu, 13 Apr 2023 14:47:58 +0200 From: Greg KH To: Zheng Hacker Cc: Yongqin Liu , John Stultz , Zheng Wang , Sumit Semwal , arnd@arndb.de, linux-kernel@vger.kernel.org, 1395428693sheep@gmail.com, alex000young@gmail.com, Mauro Carvalho Chehab Subject: Re: [PATCH] misc: hisi_hikey_usb: Fix use after free bug in hisi_hikey_usb_remove due to race condition Message-ID: <2023041308-nerd-dry-98a6@gregkh> References: <20230312145305.1908607-1-zyytlz.wz@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 Thu, Apr 13, 2023 at 07:12:07PM +0800, Zheng Hacker wrote: > Yongqin Liu 于2023年4月13日周四 18:55写道: > > > > Hi, Zheng > > > > On Thu, 13 Apr 2023 at 16:08, Zheng Hacker wrote: > > > > > > Friendly ping about the bug. > > > > Sorry, wasn't aware of this message before, > > > > Could you please help share the instructions to reproduce the problem > > this change fixes? > > > > Hi Yongqin, > > Thanks for your reply. This bug is found by static analysis. There is no PoC. > > >From my personal experience, triggering race condition bugs stably in > the kernel needs some tricks. > For example, you can insert some sleep-time code to slow down the > thread until the related object is freed. > Besides, you can use gdb to control the time window. Also, there are > some other tricks as [1] said. > > As for the reproduction, this attack vector requires that the attacker > can physically access the device. > When he/she unplugs the usb, the remove function is triggered, and if > the set callback is invoked, there might be a race condition. How does the removal of the USB device trigger a platform device removal? Are you sure this can be triggered by some other way other than manually unloading the driver? thanks, greg k-h