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,URIBL_BLOCKED,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 1771AC35640 for ; Fri, 21 Feb 2020 08:13:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D436320722 for ; Fri, 21 Feb 2020 08:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272799; bh=ubBnZkwgknDaBQg2aA6dtbyYoa4IJ4vUfw1ndbHY2s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vX0rBN4ZvIeNuuZKTkzz7hUr38U8+W1sqm32RQA3XzXzu9YDEt5pXotF1JveU+e8D FePwbwhfts9f4WTUUAIaAVYT2uuAyOkfdm/t06is1Q0t69ms8yLEiob5/3KSUjTO73 WRDq1RKVzS726/l4Uk0BbQ7bVQYsg7ETQ/JGeQ/w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732980AbgBUINS (ORCPT ); Fri, 21 Feb 2020 03:13:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:49278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732545AbgBUINP (ORCPT ); Fri, 21 Feb 2020 03:13:15 -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 3144620722; Fri, 21 Feb 2020 08:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272794; bh=ubBnZkwgknDaBQg2aA6dtbyYoa4IJ4vUfw1ndbHY2s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W7tsgp0ZYEETr17kp24cOmm+s8KF8i+zY4tOQC2OZKDvlAtq7L4qCtb/U2r3nPM4v P1w1EhZAtz9HXzWbjVJkH2lrXHaU7OafKvTBSQdYV8FuDsdIVmA6xX1NhP7PCbX2lr sRCDw6B8mO867r/MMAT4BIOLpytJF5Lu1Mny2288= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.4 260/344] pwm: omap-dmtimer: Remove PWM chip in .remove before making it unfunctional Date: Fri, 21 Feb 2020 08:40:59 +0100 Message-Id: <20200221072413.213712562@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072349.335551332@linuxfoundation.org> References: <20200221072349.335551332@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: Uwe Kleine-König [ Upstream commit 43efdc8f0e6d7088ec61bd55a73bf853f002d043 ] In the old code (e.g.) mutex_destroy() was called before pwmchip_remove(). Between these two calls it is possible that a PWM callback is used which tries to grab the mutex. Fixes: 6604c6556db9 ("pwm: Add PWM driver for OMAP using dual-mode timers") Signed-off-by: Uwe Kleine-König Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/pwm/pwm-omap-dmtimer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c index 6cfeb0e1cc679..e36fcad668a68 100644 --- a/drivers/pwm/pwm-omap-dmtimer.c +++ b/drivers/pwm/pwm-omap-dmtimer.c @@ -361,6 +361,11 @@ put: static int pwm_omap_dmtimer_remove(struct platform_device *pdev) { struct pwm_omap_dmtimer_chip *omap = platform_get_drvdata(pdev); + int ret; + + ret = pwmchip_remove(&omap->chip); + if (ret) + return ret; if (pm_runtime_active(&omap->dm_timer_pdev->dev)) omap->pdata->stop(omap->dm_timer); @@ -369,7 +374,7 @@ static int pwm_omap_dmtimer_remove(struct platform_device *pdev) mutex_destroy(&omap->mutex); - return pwmchip_remove(&omap->chip); + return 0; } static const struct of_device_id pwm_omap_dmtimer_of_match[] = { -- 2.20.1