Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2041811rwb; Sun, 4 Sep 2022 07:12:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR6vOxi1gYZuxJ4Eec5ueOBOHqdG2o8vsoo4AnOPYwRS5YKFVWjJa6/lJYuxkDnJJmimPynx X-Received: by 2002:a17:906:e9b:b0:730:a6a1:9fc9 with SMTP id p27-20020a1709060e9b00b00730a6a19fc9mr32959566ejf.601.1662300731515; Sun, 04 Sep 2022 07:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662300731; cv=none; d=google.com; s=arc-20160816; b=XgiLOr/B8/Ug0Sm3zF8jVi5zpRCSCRUXC608GRXzuA/nqlV6DYrKpUJynGD/RAaGEY rJn29LpePq8HDYdYhxUtC4uAzhYwFmjcTjqWX1HXJg9k0227WatPbhklMiIhRa0+E87k qJfLibOrOIjvXQGDA8I3dufa1puFr6efZNT1ew3P97sk0wqpAwaKlr4YyoDwuxzuMJUV OosAZO0ZDupZfmNF6EKffn0AFkuBzJvRYpd6If9GIJnQSKuTSKE3rJ6fd7oXJdlavW/2 SJRKqQecAlTE+kCB2Tmnht9GNnw7L2qdveUjaXtxA8k9tCsGcueYwyVPTfV76pFzAkRd nGjg== 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; bh=igUco99q0l18TPa+QnI+HkgwEMVwsutGQMAZYatTTHE=; b=0+iqfN1wHEGZD/KP6EAjAaAjamkRPhKfDnmbE7stCQ6wq1jJpvWKaqEjEBgZ5UX/Ck +WNZAbQTztD3qKtdiU/iJcqty56HpMwEcGz5XnBo6A2awGeDQnANv6xWEMacG3pAHYXP ZKbo8ukP4ccOhQry9NXi/tdg96tqVMwSI1RrVbXxiY15foGXWp4padkK+x4qydfNuzCA r8OoJI8JwOjrEeXeqSZVZtm+H/A02izfrjTIgWQGXXIkgxZJnMbse4AOnlOSzjTYNMVI lD5S28e4RWTo3nXEwymcNW7h9Uf+QCuhEiOXOZPZdT9BrtYyfNCI/6UKm9bEsMvdXLWa ivnw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iy8-20020a170907818800b00741827c60c4si4732263ejc.900.2022.09.04.07.11.46; Sun, 04 Sep 2022 07:12:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiIDNyK (ORCPT + 99 others); Sun, 4 Sep 2022 09:54:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiIDNyI (ORCPT ); Sun, 4 Sep 2022 09:54:08 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 37D683AE74 for ; Sun, 4 Sep 2022 06:54:05 -0700 (PDT) Received: (qmail 328391 invoked by uid 1000); 4 Sep 2022 09:54:04 -0400 Date: Sun, 4 Sep 2022 09:54:04 -0400 From: Alan Stern To: Rondreis Cc: Greg KH , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: KASAN: use-after-free Read in configfs_composite_bind Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Sun, Sep 04, 2022 at 09:21:07PM +0800, Rondreis wrote: > Thanks for your reply! I ran the reproducer again on the master > branch(commit id: 7726d4c3e60bfe206738894267414a5f10510f1a) and it > didn't crash. > > The reason for not using the latest version is I can't attach more > than one gadget at a time using `configfs` and `dummy_hcd`. When I > attach the second gadget with a different `udc` it always fails and > the kernel message says: > > ``` > [ 1625.254858] Error: Driver 'configfs-gadget' is already registered, > aborting... > [ 1625.271018] UDC core: g1: driver registration failed: -16 > ``` > > I'm not sure if this is a new feature from version v5.19(v5.18, commit > id: 4b0986a3613c92f4ec1bdc7f60ec66fea135991f works very well) or a > potential bug, or my mistake... It probably was introduced by a change I made. One consequence of that change is that gadget drivers now must all have different names (as must drivers on any bus) -- but configfs uses the same name for all the drivers it registers: "configfs-gadget". I had to adjust a couple of drivers to avoid this problem. See for example commit f2d8c2606825 ("usb: gadget: Fix non-unique driver names in raw-gadget driver"). You could use that as a model for changing configfs.c. Alan Stern