Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3200025pxb; Mon, 9 Nov 2020 05:26:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG99TvKd5fIyzkSFnzyD4xa08nzpao86+4OkPzi5znIPP0blgb6GxvTTC8A9EO1gOrcPn9 X-Received: by 2002:a17:906:d1c7:: with SMTP id bs7mr5516460ejb.434.1604928394279; Mon, 09 Nov 2020 05:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928394; cv=none; d=google.com; s=arc-20160816; b=JkxboAnpUrCezhYCdD0NBJi0gg9e74PPrpwU5NdoCjQHRcHO9TsnaNjXPUjjQ9WfjR lwR421J/mtG/CQVfGGH/p4sodsk0nMDz/YAe8rmHwshhj1326qrjTUyX7ZRWIc99rRyC W620W5RAwnG/FlNLh/6LxcrBOfLxoW5Fbo8dvdlMMAoZNatHm2vWonowY2CKX3EMA/Bp 8kJlcIXehPqDIBZEXlVXTAWeoIaZw+7OeywHlewAUFOu78yjgahx4nFi8VOUXiGuihWk F6YnzO+WETVrWtlYJ2x1w2WfUj7RCtaNoQUgDrLpxjLZzJzIF0O77POGDMDC4v7VXUlk QO/A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=l0dOSvorBAn53YkySKv6Fek6uwB1p+Ui5jvPESam3m0=; b=E8bS1P8CI2aSlqOkO+am0tsbMYLB4TSQkOhYI6OH21kk3qg8XDIx+WTpYjxUxrHtda j9Me1c/IHG43OlJdCCjjihztWk+f9viUxK9r4Inqkjp9UFwvOLrem7UHjGRv8nEdX93d rDBMVmg0Q8KAQm0p1ZU6GwAt2W2XIyRdQMD8fLfJXBwub3aej15b09miXOT8CaeE9Mwn Ewc1kZ6mDlVP54G+OUztze0YtTDJNt/RNItt+EcP+A9tyNeAK5UBSPY00Uzs4TB+KbO+ LTyEXmkypbqhNie4n8ural1u+SxaGwXGJ1ir5KuSE8d+AIIhYBcvAOTDLqmD2r/Y565p d41A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="noQoZX/6"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb4si7065453ejc.216.2020.11.09.05.26.11; Mon, 09 Nov 2020 05:26:34 -0800 (PST) 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=default header.b="noQoZX/6"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388046AbgKINVc (ORCPT + 99 others); Mon, 9 Nov 2020 08:21:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:49352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387674AbgKINV3 (ORCPT ); Mon, 9 Nov 2020 08:21:29 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C942A20897; Mon, 9 Nov 2020 13:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928088; bh=fC/JYmbH4oM/EsD7rGtTjO14BaL5Az1WFDW3CSh2ceQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noQoZX/6++Cm05LD7UgMyH+M0Lpd5W4qG++yc2JsRRbIb4PVJu89Kf2Fp6ptVUKM5 OpMIqcIZ3KOpxkRbdSAPvIuIUDuXiEr3lQSivj5GH1MjsgcJ7n5JnW3V5FmAnEEStu EqkIHkhRyhaXB4q0m7dTn4e5819W3Ur6slTfJImg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Macpaul Lin , Chunfeng Yun Subject: [PATCH 5.9 123/133] usb: mtu3: fix panic in mtu3_gadget_stop() Date: Mon, 9 Nov 2020 13:56:25 +0100 Message-Id: <20201109125036.604426515@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Macpaul Lin commit 20914919ad31849ee2b9cfe0428f4a20335c9e2a upstream. This patch fixes a possible issue when mtu3_gadget_stop() already assigned NULL to mtu->gadget_driver during mtu_gadget_disconnect(). [] notifier_call_chain+0xa4/0x128 [] __atomic_notifier_call_chain+0x84/0x138 [] notify_die+0xb0/0x120 [] die+0x1f8/0x5d0 [] __do_kernel_fault+0x19c/0x280 [] do_bad_area+0x44/0x140 [] do_translation_fault+0x4c/0x90 [] do_mem_abort+0xb8/0x258 [] el1_da+0x24/0x3c [] mtu3_gadget_disconnect+0xac/0x128 [] mtu3_irq+0x34c/0xc18 [] __handle_irq_event_percpu+0x2ac/0xcd0 [] handle_irq_event_percpu+0x80/0x138 [] handle_irq_event+0xac/0x148 [] handle_fasteoi_irq+0x234/0x568 [] generic_handle_irq+0x48/0x68 [] __handle_domain_irq+0x264/0x1740 [] gic_handle_irq+0x14c/0x250 [] el1_irq+0xec/0x194 [] dma_pool_alloc+0x6e4/0xae0 [] cmdq_mbox_pool_alloc_impl+0xb0/0x238 [] cmdq_pkt_alloc_buf+0x2dc/0x7c0 [] cmdq_pkt_add_cmd_buffer+0x178/0x270 [] cmdq_pkt_perf_begin+0x108/0x148 [] cmdq_pkt_create+0x178/0x1f0 [] mtk_crtc_config_default_path+0x328/0x7a0 [] mtk_drm_idlemgr_kick+0xa6c/0x1460 [] mtk_drm_crtc_atomic_begin+0x1a4/0x1a68 [] drm_atomic_helper_commit_planes+0x154/0x878 [] mtk_atomic_complete.isra.16+0xe80/0x19c8 [] mtk_atomic_commit+0x258/0x898 [] drm_atomic_commit+0xcc/0x108 [] drm_mode_atomic_ioctl+0x1c20/0x2580 [] drm_ioctl_kernel+0x118/0x1b0 [] drm_ioctl+0x5c0/0x920 [] do_vfs_ioctl+0x188/0x1820 [] SyS_ioctl+0x8c/0xa0 Fixes: df2069acb005 ("usb: Add MediaTek USB3 DRD driver") Signed-off-by: Macpaul Lin Acked-by: Chunfeng Yun Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/1604642069-20961-1-git-send-email-macpaul.lin@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/mtu3/mtu3_gadget.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -564,6 +564,7 @@ static int mtu3_gadget_stop(struct usb_g spin_unlock_irqrestore(&mtu->lock, flags); + synchronize_irq(mtu->irq); return 0; }