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 BDD67C4CEC4 for ; Thu, 19 Sep 2019 22:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84C7E21907 for ; Thu, 19 Sep 2019 22:34:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568932468; bh=RBiB+nszUOZlllJwJQPDLHwFxoOujyJoImu0eDIhmHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rA+tdkQLurF5VQBij9PxL7M13m0HQLndRww6S43ez9aQ75+i/aqJIAn1SCBC5e5E8 Mr/g8mqDz8r0OfDNli3w4YPmGItjii9pLmxd7H0vq9jx+Kxt2duNcmIaUAzz9Lli7r kHYX+Pr5EVoGNH/I6bl2LSkR1KXhk8uzGXexG61E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405520AbfISWJw (ORCPT ); Thu, 19 Sep 2019 18:09:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:48064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405508AbfISWJq (ORCPT ); Thu, 19 Sep 2019 18:09:46 -0400 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 5585921927; Thu, 19 Sep 2019 22:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568930985; bh=RBiB+nszUOZlllJwJQPDLHwFxoOujyJoImu0eDIhmHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icXvJMP733MT1BHVIOzx87TzHvT6p8gwMJ6cC2R2ds/gwFk37jSlZWj322We6n1r7 ZonUEsAb0alT5/+F0pT+agv9+2aBEHRTqlC+ch3E//2J558KWuE/Upxp53l8E3PD5K W3xDE14ERk5qb7zHmcA5lPzwOgdPHXZQMpe4Lh/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Adamski , Wolfram Sang , Jarkko Nikula , Sasha Levin Subject: [PATCH 5.2 087/124] i2c: designware: Synchronize IRQs when unregistering slave client Date: Fri, 20 Sep 2019 00:02:55 +0200 Message-Id: <20190919214822.197921026@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@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: Jarkko Nikula [ Upstream commit c486dcd2f1bbdd524a1e0149734b79e4ae329650 ] Make sure interrupt handler i2c_dw_irq_handler_slave() has finished before clearing the the dev->slave pointer in i2c_dw_unreg_slave(). There is possibility for a race if i2c_dw_irq_handler_slave() is running on another CPU while clearing the dev->slave pointer. Reported-by: Krzysztof Adamski Reported-by: Wolfram Sang Signed-off-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-designware-slave.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c index e7f9305b2dd9f..f5f001738df5e 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave) dev->disable_int(dev); dev->disable(dev); + synchronize_irq(dev->irq); dev->slave = NULL; pm_runtime_put(dev->dev); -- 2.20.1