From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20B60C6FA86 for ; Tue, 6 Sep 2022 12:19:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbiIFMTs (ORCPT ); Tue, 6 Sep 2022 08:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240004AbiIFMSr (ORCPT ); Tue, 6 Sep 2022 08:18:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F7487D78B; Tue, 6 Sep 2022 05:16:37 -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 CCA76614F7; Tue, 6 Sep 2022 12:15:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4934C433D6; Tue, 6 Sep 2022 12:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662466540; bh=t3ivAoYIWzwSxnOMkaBn6EDK8j50NkdJ/txRgfpguHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nFb+aEN0Gu+7/9//bc5DFbS1uBNf0pakTg1Uk5CWcmh/ZgJEQ/4zVVWeMtKBf8qck ivDKlSJeuIedpqKfJlET9iCtN0zUouv4tw4dyXVZqxLfrEr3D93odz7+E9iesc0pK5 YPcTqb0dxJ7gf6pr0Bis82tX5oZGjsvUSDznWVqI= Date: Tue, 6 Sep 2022 14:15:37 +0200 From: Greg Kroah-Hartman To: Johan Hovold Cc: stable@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Matthias Kaehlcke , Manivannan Sadhasivam Subject: Re: [PATCH stable-5.15 2/3] usb: dwc3: qcom: fix use-after-free on runtime-PM wakeup Message-ID: References: <20220906120702.19219-1-johan@kernel.org> <20220906120702.19219-3-johan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220906120702.19219-3-johan@kernel.org> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Tue, Sep 06, 2022 at 02:07:01PM +0200, Johan Hovold wrote: > From: Johan Hovold > > commit a872ab303d5ddd4c965f9cd868677781a33ce35a upstream. > > The Qualcomm dwc3 runtime-PM implementation checks the xhci > platform-device pointer in the wakeup-interrupt handler to determine > whether the controller is in host mode and if so triggers a resume. > > After a role switch in OTG mode the xhci platform-device would have been > freed and the next wakeup from runtime suspend would access the freed > memory. > > Note that role switching is executed from a freezable workqueue, which > guarantees that the pointer is stable during suspend. > > Also note that runtime PM has been broken since commit 2664deb09306 > ("usb: dwc3: qcom: Honor wakeup enabled/disabled state"), which > incidentally also prevents this issue from being triggered. > > Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") > Cc: stable@vger.kernel.org # 4.18 > Reviewed-by: Matthias Kaehlcke > Reviewed-by: Manivannan Sadhasivam > Signed-off-by: Johan Hovold > Link: https://lore.kernel.org/r/20220804151001.23612-5-johan+linaro@kernel.org > Signed-off-by: Greg Kroah-Hartman > [ johan: adjust context for 5.15 ] > Signed-off-by: Johan Hovold > --- > drivers/usb/dwc3/dwc3-qcom.c | 14 +++++++++++++- > drivers/usb/dwc3/host.c | 1 + > 2 files changed, 14 insertions(+), 1 deletion(-) This one did not apply to 5.4.y or 4.19.y :(