Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp366217imn; Thu, 4 Aug 2022 08:59:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NzZRe4VrkHgDvScMoHZpkRuhbZBsSgdsHS7hncU1+js46l/ZL1AZmoLK0xTepKhkPiNUg X-Received: by 2002:a17:902:8bc5:b0:16c:f48b:d5b5 with SMTP id r5-20020a1709028bc500b0016cf48bd5b5mr2615646plo.128.1659628769035; Thu, 04 Aug 2022 08:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659628769; cv=none; d=google.com; s=arc-20160816; b=Tqq2w356Q/GQ5VlyYTQ44Moe29eQMRXiarNAupZcFD1sbG/cwUdqgfIEDdK6Hq7s+I uGwTdaOTEFlsBMO/Xyv2mWkCdkggfU8j8q+gYW3IXBSVmJtTxrWig+ziZG/oxN2NNQnq 1Go0iXgJvQub8V8g1vlANubBfRJTW/DIBdglJbdrOYwq9e33bMeGmdNJWsn6co9h4Bge aAZ98LnAk2NDu6xNfV+1mnIsiUgXZtRQYKFABSnK3nJDgBeKKixH3+bLyG/o6+FOOhBn GJ8jecys2Lu0UVQdDLZZeDvHbMp4ujfQGCJuR7KBB7di6mGhYkRHvlunqZdwjG7CumuH 1oVQ== 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:dkim-signature; bh=/lWKffvqFTZzWNvWNNSDXm/V8mIImGxuIj1VjPME2ZY=; b=yIxK6PK8EqFDD1h51tdwck+TAaRj0EMuQhxKAsehnbJbj/LGuUdWphXnkNx0MLeQDl 5cvL19frewZ/ZRkv5+f5XAbhSDXmoC5OrKflL87nTECzJu/qClDvpG4egkyBP0uoZ16S UHP6Ww3XThglm1VonpxucQihDpmac2+uWXfL//MUmlhg5wFEjg490BiN5yzNYxkjjjRJ 6K/xK+bttf4ki+giym6nEA90nhlJghci6phS1gPzzkpLENDGSj0H3MbDKMN+pOgByUdO 2Xaj9HCJ10te3AJoQ75yVOXlFE/v3nDK7x0my/bp2up++ynfnem4zJPAvn/BojYTm6Ec rVRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NfOvEKCU; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c70-20020a624e49000000b0052534e6f7a8si1228505pfb.34.2022.08.04.08.59.14; Thu, 04 Aug 2022 08:59:29 -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=@chromium.org header.s=google header.b=NfOvEKCU; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235042AbiHDPx5 (ORCPT + 99 others); Thu, 4 Aug 2022 11:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233149AbiHDPxz (ORCPT ); Thu, 4 Aug 2022 11:53:55 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48F25A89B for ; Thu, 4 Aug 2022 08:53:53 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id f11so242434pgj.7 for ; Thu, 04 Aug 2022 08:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=/lWKffvqFTZzWNvWNNSDXm/V8mIImGxuIj1VjPME2ZY=; b=NfOvEKCUxs6P9aNhsj9GYYrhce29fZRIbZ+dmaJyONYfurBJVch0FTP3Sg6hlViV3H 97Q8fSj6HcYhOxx82VSlSrhfWHFsJ3xI1T07JRID3TFjaj4V5HCaCRs8SpYqHx65oBSB aqLNJNB6yxUbp0TO06McTKk92+sgvkz6guu3o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/lWKffvqFTZzWNvWNNSDXm/V8mIImGxuIj1VjPME2ZY=; b=YT5/YDk26X6y3RnOmmacWs/+phgqQ/CQ8tifwTHTlCXozou4LNyRIVdKhkROUF4cUQ Fw3RAE1jBlej8KwG1hA8RWJamNGk+EswTVnYesfzQozpe2IBj8ZaLtWlou2FnEa+3DZB q8whFOoHIWPHH63KXMI6UoWOezRxret8U4L0f93nxlS/LDrdZIHmHjsvzgPTiaZdnWeM Kf/Tg9LrtJfR3vrHjuZE90YK0pl+NCAB2PglpgNw2hu07AbWdq2D3Zcd4PUvU6inO1pR jUFlsIexlArqmBvs5JKLX6qXd9fbE3dT8j+ZUltMsuuEHahFiOA827H6o2SM99RKQdTi DlWQ== X-Gm-Message-State: ACgBeo2nQ+LoiH4FKpitiLTCGdpk4xkUkQaruCxLhPQLd9iDe2wAVeh9 KevhcandoztE2TcnTYCahu5y4w== X-Received: by 2002:a62:7bd6:0:b0:52d:4773:a3de with SMTP id w205-20020a627bd6000000b0052d4773a3demr2297138pfc.70.1659628433198; Thu, 04 Aug 2022 08:53:53 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:87c4:32ca:84b6:e942]) by smtp.gmail.com with UTF8SMTPSA id x14-20020aa7956e000000b0052ad49292f0sm1154698pfq.48.2022.08.04.08.53.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Aug 2022 08:53:52 -0700 (PDT) Date: Thu, 4 Aug 2022 08:53:50 -0700 From: Matthias Kaehlcke To: Johan Hovold Cc: Greg Kroah-Hartman , Felipe Balbi , Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Manivannan Sadhasivam , Konrad Dybcio , Krishna Kurapati , Stephen Boyd , Doug Anderson , Pavankumar Kondeti , quic_ppratap@quicinc.com, quic_vpulyala@quicinc.com, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 4/9] usb: dwc3: qcom: fix use-after-free on runtime-PM wakeup Message-ID: References: <20220804151001.23612-1-johan+linaro@kernel.org> <20220804151001.23612-5-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220804151001.23612-5-johan+linaro@kernel.org> X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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, Aug 04, 2022 at 05:09:56PM +0200, Johan Hovold wrote: > 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 > Signed-off-by: Johan Hovold Reviewed-by: Matthias Kaehlcke