Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2653417pxj; Sat, 19 Jun 2021 19:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9QjMc/P2G+Yjxt5OjwGuQF++jh7ZcscURe2W/Qjt2Iy9eXH7eGdy2cHGOf6PzswQgf704 X-Received: by 2002:a05:6638:13c3:: with SMTP id i3mr10768650jaj.140.1624157189550; Sat, 19 Jun 2021 19:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624157189; cv=none; d=google.com; s=arc-20160816; b=QPKoF2i11KxSaq8VpyiSc/C1XPKGYaHb9o1klo/k8V37H32A3mM5v3sYP/z55VsuCS oObl24tUkWLeb14VQXRfq3l6pV5ICJSoxaT5GwhPmPIEiZmUOIuYcmOlMyepiPhp6FAt bPPTaIzgP+iWSRMLET6byN4l32cCN81SA5PbWlu7rhoqmOu1jnL3Ff++wu8ry/rrAfoB BNv7v0PFZWAH8TZGdR0zCsLwpRwzp6rkDO1pbh5q11ulllOeYbWqP1bsinIAuz1QrwSm uVeBs5a2f5W8EZIPlZutiHjWo33ltgexf1vXCidfzgEds1hzIKw62z/NyUuSzhx/wN4G GE/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Yr+c7FSuyeQySpHPMOsET6FzIVUHbQS8GVUI0KsuCPk=; b=vHUxV6vm2gOvilMEuqWkCGtn8wRuaPosFY5JQZezltmXVY4xyy/mQKLvK6TjMrMVse j+xn+nZ8g/JyhlGLOuyC29RqxPBeIbEfagCiT3ABQzLSvmQZHIbWEceczryJRj9HetwE NWiIVID9MOvS+b7Tb0UNssfhhCK3dFN8gJcQZ5PeNYhYw75DFX69buBAA2FQ/1dH69UT fg4GZMXDrADTtqbFlPqSKhH7VjPb/PVt0HBKTUBjugGbcPytm9VkxEI823xou6/ZHmXB +pJKISja9yuDgz1OgvmlHnMqHkvmI77Gd9L5mkzRIwojABzccvF9BLsHQ+2n25c6Mhnt Llqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si13875352jao.58.2021.06.19.19.46.14; Sat, 19 Jun 2021 19:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbhFTCPv (ORCPT + 99 others); Sat, 19 Jun 2021 22:15:51 -0400 Received: from netrider.rowland.org ([192.131.102.5]:44239 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S230043AbhFTCPu (ORCPT ); Sat, 19 Jun 2021 22:15:50 -0400 Received: (qmail 362265 invoked by uid 1000); 19 Jun 2021 22:13:37 -0400 Date: Sat, 19 Jun 2021 22:13:37 -0400 From: Alan Stern To: Linyu Yuan Cc: Felipe Balbi , Thinh Nguyen , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jack Pham Subject: Re: [PATCH v3 1/2] usb: udc: core: hide struct usb_gadget_driver to gadget driver Message-ID: <20210620021337.GA361976@rowland.harvard.edu> References: <20210619154309.52127-1-linyyuan@codeaurora.org> <20210619154309.52127-2-linyyuan@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210619154309.52127-2-linyyuan@codeaurora.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 19, 2021 at 11:43:08PM +0800, Linyu Yuan wrote: > currently most gadget driver have a pointer to save > struct usb_gadget_driver from upper layer, > it allow upper layer set and unset of the pointer. > > there is race that upper layer unset the pointer first, > but gadget driver use the pointer later, > and it cause system crash due to NULL pointer access. This race has already been fixed in Greg's usb-next branch. See commit 7dc0c55e9f30 ("USB: UDC core: Add udc_async_callbacks gadget op") and following commits 04145a03db9d ("USB: UDC: Implement udc_async_callbacks in dummy-hcd") and b42e8090ba93 ("USB: UDC: Implement udc_async_callbacks in net2280"). You just need to write a corresponding patch implementing the async_callbacks op for dwc3. Alan Stern