Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3205401pxb; Mon, 9 Nov 2020 05:34:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJyA8npXPC0c/M22qhxa3e46B76Z1UIO+riORDjEzP6Z9hnf7E5LCtq6+yslhnmX0MgDWXT+ X-Received: by 2002:a17:906:8812:: with SMTP id zh18mr14204740ejb.361.1604928840902; Mon, 09 Nov 2020 05:34:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928840; cv=none; d=google.com; s=arc-20160816; b=Yl67Ranlyg3KQjSm2weJP6pCPzKMWEIvUXkwHM70QwhPT/nHLfBloOoN4fT90F/qrb cW6dR+WMfI8Ed99dD8xZOx4CKK+t7DtcHThH+vnlECQBsUkpdHeWUvVAHsazLoUHiQl+ AO1kNZT4jjHU/XrkiAL313O3rhKDm9+Q4WJj0e6hFaK9TZrkrVhpQBZRVQ3xZ1v4OB7p oqCIwV6s73hSs1VKfOBOQt8bcwi2Blp3t2Qljv6mzkzkgq2HCCapZ5G1miS8CN7ImI/3 57QQ+uIIxyuNJhhqyEqYHrqTpbRxpM0NgYZZXbEuNidiiGyPFhLi/fM1PLRR/qVZtrEr AGVg== 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=o4FI+rR2Y0Be3/25RJ9nXY8s+5iUixsZaPqbbVKRtAI=; b=K30NmSjAaasF28w/5rCFwn9oC0J9lf98jxJaNXu41WQjBpKX+dvm9DGbd5RwyMLBwJ D+mLmf1Ne/4FRk1lecBwad9TkCoyY4oHvJ8dKIhO5E3Ujxxi0BOotoaPoLJ304KMuR11 G8mfrv/i+ObKWdjx33clvvLqrpXYoFVI6ahhPmq303XQvRnXjQv1pS1Y+GQ8WZX5/sE8 v1WvcPUhcKvrBon5SFe6yLtaHfwx+btvKa7V0cjtSjt8Iw4wfvv8D3z5G4NN+5mtmwTy pWyfNnDDgZhRthh7uyvBY0xjjVj8bTcdyJo/7fAVIwV8irmlkUeRvmQ7vcheMbFUrtXs DP0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oNoTJvo0; 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 r21si7011064edt.339.2020.11.09.05.33.37; Mon, 09 Nov 2020 05:34:00 -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=oNoTJvo0; 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 S1732285AbgKINLR (ORCPT + 99 others); Mon, 9 Nov 2020 08:11:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:36706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbgKINLO (ORCPT ); Mon, 9 Nov 2020 08:11:14 -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 6E0DE2076E; Mon, 9 Nov 2020 13:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927473; bh=DfwJB6vHi5IOF15RyDX3uocMPvL/58uZVzZcVmIOV7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oNoTJvo07MuwvHX4S/vobL6HBSD7GoASaghmW6GHna0D6ckxGMGGJ8gtWfgkMtEHb bxWCgO8IUuM4wQFty1NAagCrTWksf79HOcOQzt9ax0qxtPvuGH/jjNDPAcX91Ufo56 A1x3CaENWV2tXgBtAPavLs8o1IIR449oeFlix+o4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Macpaul Lin , Chunfeng Yun Subject: [PATCH 4.19 64/71] usb: mtu3: fix panic in mtu3_gadget_stop() Date: Mon, 9 Nov 2020 13:55:58 +0100 Message-Id: <20201109125022.921496196@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125019.906191744@linuxfoundation.org> References: <20201109125019.906191744@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 @@ -573,6 +573,7 @@ static int mtu3_gadget_stop(struct usb_g spin_unlock_irqrestore(&mtu->lock, flags); + synchronize_irq(mtu->irq); return 0; }