Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3193667pxb; Mon, 9 Nov 2020 05:17:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTysYk1B+U542BNrfgzRaJ2liVlhgMXTC3HddtfnYmNho3bJwR9u8w+m8Io8Kt/hauWG+l X-Received: by 2002:a17:906:c7cf:: with SMTP id dc15mr14213327ejb.396.1604927862834; Mon, 09 Nov 2020 05:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604927862; cv=none; d=google.com; s=arc-20160816; b=xOaUo4rvxamKt+ZiuqUnK/e4RinYtobJK1z8f3pmS1O9FSuP5hYgGKoAk4ITlhEOxl YcLYQEfaqMclondxBxdjM95bfm8D6/AHqHvfxP6m0Xe6tul9iUHMxqu5+mwtJmq20V4v Xv66HgL8CsSA8VvKfkV6mCCiEjLgUWFPxUhGQkWhzPXKUXjJjGR09ndiKDmHwIu+Erqq QDgzBb1tTLHYHLBqUcuGdYNSU2EUrN5VT5Lj9AQdEMjhx6C54OziR39Z9OlBMtLHlRjd ooQDjKiLx5YZaggyTlwpaQVpMvu8R+W6qftinO3KHeoQ1EoYYGHv8Md1J0cA4fNiPpgf dJpw== 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=88Xo94lT89FcuXkZ0OsobAd4ELZnnUfVi9APHhBlnDU=; b=BW8fa1CLYSHkC906Q7SABZI0Ezxhfk5Px3/LK6PxXY/4R+XJ4PzvX67APz5RHNMyUW +6MaT/vwEu3brjfC6bG+FlN+jLuGmL9fcMluP/hRZEvdJCnDyRgSzCU8XOr9f9KAbO8b lIA1t3ehNtyCeB/Ky+TsSQXXvgKeBhr0Bif72uUN0GH7NhZPJrEtbdYflFUa9MvSEptO ON6EAMKzoHgzypixco5OKoQ2x8eIzqXb59L/exXAq49RlKY3DMEN8NysuBZupA/dXMk9 Xh4msYFhaUsnz3Qce4/+14ZPQL8BChVGxTrPnbD6gZl8m487TBC+cBjzUEKf9YncFJea b1/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JGZ5Fzc5; 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 g9si6952145edp.146.2020.11.09.05.17.19; Mon, 09 Nov 2020 05:17:42 -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=JGZ5Fzc5; 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 S1733258AbgKINPA (ORCPT + 99 others); Mon, 9 Nov 2020 08:15:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:41486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733252AbgKINO5 (ORCPT ); Mon, 9 Nov 2020 08:14:57 -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 84C8E2083B; Mon, 9 Nov 2020 13:14:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927697; bh=bHhpIsY5R0vJ0eRStiwtUPnFTby8qItJTs3AG5YjeUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGZ5Fzc5R8EtpHaiuBQHg0yxZqUnQhZGgww8lr8aRk36e7S1tUpdymAw4YJPCAxqc m44Bgx5jXVLsOpIIchCNWJztNN/KQ4sEy7yzh7VxGhJmf91UvSdFfHxf/6spkUX70s w+bdieu+r1XkAb0oqD7M+RFwi5l8vip7i3NusxfA= 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.4 77/85] usb: mtu3: fix panic in mtu3_gadget_stop() Date: Mon, 9 Nov 2020 13:56:14 +0100 Message-Id: <20201109125026.277312774@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125022.614792961@linuxfoundation.org> References: <20201109125022.614792961@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 @@ -587,6 +587,7 @@ static int mtu3_gadget_stop(struct usb_g spin_unlock_irqrestore(&mtu->lock, flags); + synchronize_irq(mtu->irq); return 0; }