X-Received: by 2002:a17:902:e54d:b0:14f:fb50:8ad5 with SMTP id n13-20020a170902e54d00b0014ffb508ad5mr163880plf.160.1645630770167; Wed, 23 Feb 2022 07:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645630770; cv=none; d=google.com; s=arc-20160816; b=lbcpe84qwyRNzfOEUu00vJxn4AZytEQCx6T6/e+dVxZ932TuzzLr7mhRhjS9oywxrV l8ivGUvIcYaLhJvCWffR1R7kMOReodD85lEAv0uuBiFKZP10f1PLniwh7IdxG3QM9A+0 u2BcaoozGGlkFVy5arDuTYhocIvNKlCYR4WcFQR0JnvDF+53p61uvq0rOXpwzuSmD1lr qtXievWcsK81IHT8jo/TfDOcfPgffYvAjy2SfNrskpxrso3dz3XbrGruPLPIiWwPGmcM +oDrecCRCW9WxsBF5HCE7E0Z5xDEliWYtuEiZ0ZxDWvsaz6BkBs5J6SoB1Vt4MiD6roR tviQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=Ksde3dsjmZ6z4W3gPyFM7vvXyQW8lLSnM2Jx+bGn6kA=; b=W0gtDrEC3En128/Z74UvrtGmAPv9ea1ei/SwTo6ZwkOwq5W8MDuqXy0/MzRwhHb8xl Rt/lekR8oNhgL5wz5WOdqaoRtEgWry9NNmYNOxC4cJjzfhCnfYt+Ypn5G8IT82gQ5/aW hES97mg5RPagln0cmhvhCM8hPjmDX0wsCwY5Koq/QjDAJxue2fCwSK5KnxOIR85ETCm0 nfmV14lNgdif6umGNOAu+ZW4b4/eOM6dU+4vpq54UBcXvA3SNWdOJ3NNZllihhJRZsWH xUenxoEbDcaCbRWA6Aarc+gwmA9BKSNQ5CKtJ2UrtnPHL3NRAlS47rV+ZtcobPyJy3EJ CfjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oqNk7Gve; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12si8910574pgt.312.2022.02.23.07.39.14; Wed, 23 Feb 2022 07:39:30 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=oqNk7Gve; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239833AbiBWLYW (ORCPT + 99 others); Wed, 23 Feb 2022 06:24:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239834AbiBWLYV (ORCPT ); Wed, 23 Feb 2022 06:24:21 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74FD490243 for ; Wed, 23 Feb 2022 03:23:54 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id w27so12698571lfa.5 for ; Wed, 23 Feb 2022 03:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=Ksde3dsjmZ6z4W3gPyFM7vvXyQW8lLSnM2Jx+bGn6kA=; b=oqNk7Gve/MBzDonLtAobtwDjoEKRBkZPObrM2miHQMA0eVwjUOtkpcqcY+KMAlYJb0 Q0f13poP5DocypMJrLMijaQrCbYln5K0k2ozEs3uAwnxF2cnn03NXg4HsdC2PqwpVDHK 7KFdX9aUzpr55224jFG5fbuE6ZpFGVMX4RUlp0Jvk5URntPid/KjV7WJ+1wQP153ZRAt Sab2YQcK/tXCe2PKbqgHk4rea9q/clZfcaw83zZfz6KYH8KaiRcACdn0wR4xdsmDR9Yp q3VNXa9kDi6KUgIiW3Lauw585xyrdoa4pmb5+ma/tBkjDLv6PO8auBiQcKKi3gn6cDWn A5Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=Ksde3dsjmZ6z4W3gPyFM7vvXyQW8lLSnM2Jx+bGn6kA=; b=HSxLTt6pcRVtRIrA8QN2zU+aGZPFinP1sWhdEEIyIFojnc4CQz7y28b5udJuLqq5sg H2CARH+vZnnjMzvq4W8lWlOrVRikmH5NClEQiTuWzHgdtTChoHFvThf0xU0oBarqsxob EAhCH6Ntbpm17mRRyavXyf4xMp7Xr2D6fTGHnyW/oectc16QyyIgbLlUmlHK9nPjIW+D kmdNdPt9E3vAjmfvbxhcmJPi1vncI9NZdkwzF87AJY8ZTgdc8ezCD2lMLNj70sQiwhT+ lHMECjf9epiN0Ywq4W/N0TyKTm/sfdr4SRn7yaxtlWT9xqvUacEGfLPXj7Nsm39VJEkQ Y7Ng== X-Gm-Message-State: AOAM532J0qoQ+VjdZt8EeLExbBRRiYojvBIoCnlSlHzA40VvF1iIk/Si K3D6S+IOrHTfP9/Y5601INU= X-Received: by 2002:ac2:554d:0:b0:443:6539:a299 with SMTP id l13-20020ac2554d000000b004436539a299mr20663855lfk.552.1645615432696; Wed, 23 Feb 2022 03:23:52 -0800 (PST) Received: from [192.168.1.11] ([94.103.229.64]) by smtp.gmail.com with ESMTPSA id b8sm1623929lfv.298.2022.02.23.03.23.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Feb 2022 03:23:52 -0800 (PST) Message-ID: <81102f38-3e1f-ec36-3119-a098bd5a85c4@gmail.com> Date: Wed, 23 Feb 2022 14:23:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [syzbot] KASAN: use-after-free Read in dev_uevent Content-Language: en-US To: "Zhang, Qiang1" , syzbot , "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "rafael@kernel.org" , "syzkaller-bugs@googlegroups.com" , "balbi@kernel.org" , "stern@rowland.harvard.edu" References: <0000000000005a991a05a86970bb@google.com> <00000000000033314805d8765175@google.com> From: Pavel Skripkin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 Hi Qiang1, On 2/23/22 14:17, Zhang, Qiang1 wrote: > > Cc: Alan Stern > Felipe Balbi > > Hello syzbot, Please try it: > > From 574d45ff924e2d2f9b9f5cc3e846f8004498a811 Mon Sep 17 00:00:00 2001 > From: Zqiang > Date: Wed, 23 Feb 2022 18:18:22 +0800 > Subject: [PATCH] driver core: Fix use-after-free in dev_uevent() > > In dev_uevent(), if the "dev->driver" is valid, the "dev->driver->name" > be accessed, there may be a window period between these two operations. > in this window period if the "dev->driver" is set to null > (in usb_gadget_unregister_driver function), when the "dev->driver->name" > is accessed again, invalid address will be accessed. fix it by checking > "dev->driver" again. > > Signed-off-by: Zqiang > --- > drivers/base/core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 3d6430eb0c6a..a45b927ee76e 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -2317,7 +2317,7 @@ static int dev_uevent(struct kobject *kobj, struct kobj_uevent_env *env) > add_uevent_var(env, "DEVTYPE=%s", dev->type->name); > > if (dev->driver) > - add_uevent_var(env, "DRIVER=%s", dev->driver->name); > + add_uevent_var(env, "DRIVER=%s", dev_driver_string(dev)); > > /* Add common DT information about the device */ > of_device_uevent(dev, env); > -- > 2.25.1 > you should use '#syz test' command to ask syzbot to test the patch. Basic syntax is '#syz test: ' and syzbot will apply attached patch (if you have attached it) More about syzbot interactions here [1]. [1] https://github.com/google/syzkaller/blob/15439f1624735bde5ae3f3b66c1b964a98 With regards, Pavel Skripkin