Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp463661pxb; Thu, 9 Sep 2021 05:10:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSesLc5gnC22oSbaasNg0cDn+GnhLFHBkEkqicecGA5CQbZC1X8UeSoZxVPcikScHhWKHK X-Received: by 2002:a05:6638:1491:: with SMTP id j17mr2471925jak.75.1631189424695; Thu, 09 Sep 2021 05:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189424; cv=none; d=google.com; s=arc-20160816; b=uMxMJ0yOY+izQC54dG6pcO0dm7VOqByBPTUmihhD0Riv157g9ntKxvn/r4gytbqAbR JVqc0g8eKvsmzvi3xem96iEF6g9MLh5ydJnX8908YfvvYQECyB1bo/zEaCsQtl7U4Wa/ soJB929DR6grFt3+KuAgirpJhnJ6oZYxJCPAgI9DcXp4QwsWuzU799qRuJoLq7kCShMB EariJezGjVthxn7+TYu4OgZzzR7aM4/e+NG7vBh4zR5I9LkdwvfdPdlKaFdb+4BXxwJR 7sOhFkdMv1R9JOQC6HplkYFDguBiuYdpVRfNZcQ0WSOLldihkUNy8+H7E4FocrXy64gb 9+Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7+MPXv4Hs+PDMq+Vn/jJUWQi4D/p7NlvLWsDu6owdxU=; b=JLvfoxsoXAn/G4kwZYEMAkosXZcl/vtcbovlhxW88iZqYTztSDY3MWRL+/xWaclVHg oaxV/7AjHx3wMeMx5fSaBQDAY9Vh6oUMFRNjfw/jwohE8Hfe7LrH5DrINi6qSkPI28BF lI/vdDeWTLCkKBaV7u6ejwiyONdyiKlwLHPIVeJ+Lyix/qHztqzSrSGvJt3VtBwyoEjD I4UKAV6q6TTIcXN1NjC98YJUaHmFghtogq60uVup18SIVeYQ1ROho6665VpwKx99qKAK 0aVWNNARNf47NOLglAfa9g+2vYjiSAeeUQUzzbZwNYOipho4fDOoKxzf03cn08EOQorC 3YyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i5BPmJTL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si1768109jap.59.2021.09.09.05.10.10; Thu, 09 Sep 2021 05:10:24 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i5BPmJTL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344761AbhIIMKd (ORCPT + 99 others); Thu, 9 Sep 2021 08:10:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:40846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344324AbhIIL7D (ORCPT ); Thu, 9 Sep 2021 07:59:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B770D6140B; Thu, 9 Sep 2021 11:45:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187952; bh=6WZrpTMDNvbUVof9OeKTjctXW5wSRixLJU4HNjVieB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5BPmJTLXXzsEx8vZY0lCr3ZS/Jy/i3FUz30zr0w8d+WwN7LYER87O4hIJEYew3o3 Hgtc5mrxD/mBZ1zzuLm4koOqRo0fF0UCfUKDbr0aWU/gv5dTNdExoNL56tkU7G2KRa 7cqmjUZ9oH5KDayQwZqTQ3L/kxUmeA3WAsA5AC73Yba/iSJAdKZ/+Fqb00putqFT41 jVRGc1pYibGNkj+9va9RPO4IFPV674wYe687xocqQXkpQTUv0cF8tKGG/BlVgoWkGO W0Q0fVK3lsVQh9ezP6vPjS2O9NNjug5YMwHqaotLuaKUGIQnnKuoV2GQHvzq9c2xnu buL1J67jKR6+w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chunfeng Yun , Pi Hsun , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 5.14 220/252] usb: xhci-mtk: fix use-after-free of mtk->hcd Date: Thu, 9 Sep 2021 07:40:34 -0400 Message-Id: <20210909114106.141462-220-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chunfeng Yun [ Upstream commit 7f85c16f40d8be5656fb3476909db5c3a5a9c6ea ] BUG: KASAN: use-after-free in usb_hcd_is_primary_hcd+0x38/0x60 Call trace: dump_backtrace+0x0/0x3dc show_stack+0x20/0x2c dump_stack+0x15c/0x1d4 print_address_description+0x7c/0x510 kasan_report+0x164/0x1ac __asan_report_load8_noabort+0x44/0x50 usb_hcd_is_primary_hcd+0x38/0x60 xhci_mtk_runtime_suspend+0x68/0x148 pm_generic_runtime_suspend+0x90/0xac __rpm_callback+0xb8/0x1f4 rpm_callback+0x54/0x1d0 rpm_suspend+0x4e0/0xc84 __pm_runtime_suspend+0xc4/0x114 xhci_mtk_probe+0xa58/0xd00 This may happen when probe fails, needn't suspend it synchronously, fix it by using pm_runtime_put_noidle(). Reported-by: Pi Hsun Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/1629189389-18779-3-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mtk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index 2548976bcf05..cb27569186a0 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -569,7 +569,7 @@ static int xhci_mtk_probe(struct platform_device *pdev) xhci_mtk_ldos_disable(mtk); disable_pm: - pm_runtime_put_sync_autosuspend(dev); + pm_runtime_put_noidle(dev); pm_runtime_disable(dev); return ret; } -- 2.30.2