From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2280DC2D0DB for ; Tue, 28 Jan 2020 14:19:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EC4022468F for ; Tue, 28 Jan 2020 14:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221159; bh=Aby7x+mCBw7j5lzoe2MiqhlI2mkx6GH5atF2p99QOHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xSxDb450GuP8jhMCiWZVwhmUP1keL64QkcP/PSr0EAyNL6PNB/RmJlgyyIA7vuYU9 aHQYpHRbcX40iJbxH+YigxtKLsq2qulRRuwtais5Gjr3Tir98a0Bd6dyvBcSmePoi8 STRLygOcRogY1F+/nSdL1qruTw+aC9hUkUuM8JhA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730856AbgA1OTR (ORCPT ); Tue, 28 Jan 2020 09:19:17 -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