Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp491936ybl; Tue, 28 Jan 2020 06:48:15 -0800 (PST) X-Google-Smtp-Source: APXvYqz2yofOTa6UC7VdDvjMfH8J79E7BgfvrxcPtDnCx1/t/8uj8gfT7whoN/aiJqdD2pzfowbD X-Received: by 2002:aca:c509:: with SMTP id v9mr2911172oif.151.1580222895193; Tue, 28 Jan 2020 06:48:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580222895; cv=none; d=google.com; s=arc-20160816; b=cs0PEUBbBgJx+lrF6hKAMDREIQYI/g+SLDDcMPYMI6XLYJkgVCTLe2EWLe/0lNqVzl Rd/GPwVRCcmOzN8QxtAhONm++b2nEhwSzzkkr6KwuVsYU4fIABK/KqgvI8jppLP4P8el 4u+zNxcwKRK5pJsNx/y+phCd4hDL5hHbeonAY3sphZOL6MkwSZ9dLs2WGUGSw8Dl9ehb RILlelDbC2K+/hx4zwpF/UPCQwpZx/jd7YHtGhYPoUEQMetE4JP+j1iOsD3j0f7tobAA tWoa+xb7vjPOFD+AhsP1W/vIE74KVQ6uAhf/Tt+b8qiODVCveW808fn3w/2x4JPGVv3s 9UPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=InFK27vUKW7UkzGTmJh+Xys9jJ+0p40txbEqvH8kJXE=; b=wpltNC3dPVKiAZi8UOYQdde/oOKY7KlKbxTaHoZoXfikn234XXLE2a8tn1Sl6ijoNS noxyI6Op/517Y2UmtcKBZR0qw3y655jy7uGiEprmCWEHY2/Xb5JGXEOrOaCTGfXHTUdA nI3y7O0ra6XBCyM1+VyIoHCPKh6qeFPZ+NAEmAL8HQ9UE+Eb2UMVwwkNSmGXlSyoHbm5 ERZDFDQC+ZEzaoPcnXMeNA+54D/OY+xOE2NY6l8BtU5gFayz9V1Bu7HFGNgols5OQtRz g369ntzP2ff6Kvg6q2FFG7q2opPC99dZX0rLCmbRsMgfUb8ys7h0ys6Ss2BeODqOzFMq /Wog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nbMQbVuf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d197si4560899oig.115.2020.01.28.06.48.03; Tue, 28 Jan 2020 06:48:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nbMQbVuf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727399AbgA1OTQ (ORCPT + 99 others); Tue, 28 Jan 2020 09:19:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:43476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbgA1OTM (ORCPT ); Tue, 28 Jan 2020 09:19:12 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 77FA521739; Tue, 28 Jan 2020 14:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221152; bh=Aby7x+mCBw7j5lzoe2MiqhlI2mkx6GH5atF2p99QOHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbMQbVufyiLImGEn+jk5JGYGKzqUwVtRHxt3hYq703vcvX0DJKNR+pbjKs9A7lZ3l Djkp/ZwxvjKy6RSoaCncpCWb7yPkQsET/pqujPnYI7HcAEdZA8fd9chnaMozwrYbcy cUiOJ1DXZoaqztKs8oBMBCC0jnPMoLFCj/j4ccnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Lindgren , Bin Liu , Sven Van Asbroeck , Felipe Balbi , Sasha Levin Subject: [PATCH 4.9 072/271] usb: phy: twl6030-usb: fix possible use-after-free on remove Date: Tue, 28 Jan 2020 15:03:41 +0100 Message-Id: <20200128135857.942817171@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Van Asbroeck [ Upstream commit 5895d311d28f2605e2f71c1a3e043ed38f3ac9d2 ] In remove(), use cancel_delayed_work_sync() to cancel the delayed work. Otherwise there's a chance that this work will continue to run until after the device has been removed. This issue was detected with the help of Coccinelle. Cc: Tony Lindgren Cc: Bin Liu Fixes: b6a619a883c3 ("usb: phy: Check initial state for twl6030") Signed-off-by: Sven Van Asbroeck Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/phy/phy-twl6030-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c index a72e8d670adc8..cf0b67433ac95 100644 --- a/drivers/usb/phy/phy-twl6030-usb.c +++ b/drivers/usb/phy/phy-twl6030-usb.c @@ -422,7 +422,7 @@ static int twl6030_usb_remove(struct platform_device *pdev) { struct twl6030_usb *twl = platform_get_drvdata(pdev); - cancel_delayed_work(&twl->get_status_work); + cancel_delayed_work_sync(&twl->get_status_work); twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, REG_INT_MSK_LINE_C); twl6030_interrupt_mask(TWL6030_USBOTG_INT_MASK, -- 2.20.1