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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 10F85C3A5A8 for ; Wed, 4 Sep 2019 16:09:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0E7F2053B for ; Wed, 4 Sep 2019 16:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567613393; bh=RBiB+nszUOZlllJwJQPDLHwFxoOujyJoImu0eDIhmHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Yk3JDRYFaHBrybkKys8FLOJEROCRCnCDFqHSioZSyTvBLJknMQZoI2SJchy/mNGuQ D6wAqeaa4uFdJP7YrV20QZ/2NrCg6PZ1uoeQDDGZ9+qKSWzhOZzbDLgxVCRcOTRZmb 0qVcY4Veoxo68ucrsSKrb7CXwoiyzfpma8XMFGFw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733189AbfIDQJx (ORCPT ); Wed, 4 Sep 2019 12:09:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732898AbfIDQBG (ORCPT ); Wed, 4 Sep 2019 12:01:06 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8CE132339E; Wed, 4 Sep 2019 16:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612866; bh=RBiB+nszUOZlllJwJQPDLHwFxoOujyJoImu0eDIhmHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gzN9QtxwuyaZULp8+e6BM08h+Zx+LPrgvni6VYC9fLHKBK6ZUTpFRly98OBePYk16 ZJiOu1lFlbmRSc4tghDxDl/op1dDfObI8+I2jGt8uNJ+BpKBf1hf5Amauezk9X2Uih 75v6tnR0+wzrHcd2xFPx+ZDk+Qh4Ajx86ofJiKqY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jarkko Nikula , Krzysztof Adamski , Wolfram Sang , Sasha Levin , linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 43/52] i2c: designware: Synchronize IRQs when unregistering slave client Date: Wed, 4 Sep 2019 11:59:55 -0400 Message-Id: <20190904160004.3671-43-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904160004.3671-1-sashal@kernel.org> References: <20190904160004.3671-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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