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 121B0C4CECE for ; Thu, 19 Sep 2019 22:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB92420678 for ; Thu, 19 Sep 2019 22:29:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568932150; bh=WoyyH/WhkP+nV+Xgh7izRnrD3GtpnV452JYFcLCroqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nvsfXd2e5UQR8LGhnIWJHFzjUWMC60sJ5S3luxFEYlp8Zdt+D42Vkx1aJ8HbenKrN aOhlAgivng2Msv9eHbO5Xh94FaOySSVFSu4ep8SYJygLAqRCyAFJQ80t4RsiMSK0Gz HV0ookl1VT+V0PcCKrbnOTLr7O9WRq8hbNnH576g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393858AbfISWSK (ORCPT ); Thu, 19 Sep 2019 18:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:59570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389941AbfISWSI (ORCPT ); Thu, 19 Sep 2019 18:18:08 -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 AE04D20678; Thu, 19 Sep 2019 22:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931488; bh=WoyyH/WhkP+nV+Xgh7izRnrD3GtpnV452JYFcLCroqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/Is3bBe/wCXfwN+QIPQPyyWZ2xHxZiC1RLOfpA2v8XBAIGGLCEUUyT2avZg7WKFw tueguEZsFmiuJ4R1bkFkbUkTrjcyJ4uMD8aBDBG/Xmn0icZGzCZi0s5WSesH4f1q4N 56bbTwoU9BLN12CQZnoLvLI0b1fh1RtDqInu8/tM= 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 4.14 39/59] i2c: designware: Synchronize IRQs when unregistering slave client Date: Fri, 20 Sep 2019 00:03:54 +0200 Message-Id: <20190919214806.776792993@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214755.852282682@linuxfoundation.org> References: <20190919214755.852282682@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 ea9578ab19a15..fccf936f4b9b5 100644 --- a/drivers/i2c/busses/i2c-designware-slave.c +++ b/drivers/i2c/busses/i2c-designware-slave.c @@ -206,6 +206,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