Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10996675pxu; Wed, 30 Dec 2020 19:02:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJz83GUfMbnUhBrq+jsv3HhwBZuPQLTHmfneYGaTiD4nVe3m8JN6AqZKgcQnj/YCM2YBHhip X-Received: by 2002:a05:6402:ca2:: with SMTP id cn2mr53084049edb.137.1609383727832; Wed, 30 Dec 2020 19:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609383727; cv=none; d=google.com; s=arc-20160816; b=bg45qnPIRsSEV4a3B/g/Rskf+KHHLmbKUEan0xpUjoygqIlMeNZVQ+eke2nq3UBr6Z 9usEhfEDsh0g5c9NrJoTrz9ujh27qmnIX/d7jUolKOcASbiBdzHEfX+2sOMc3DGOGRyE 0S8/fHE6MEr8fHcnFz2UU7f/46uJFgcpKB+c00BxvwpCxL5u6KTH0FeYh2q40684DBxY xjg4l394E3f6j1qdH6qemlUX+cdfmEzplJzCb5Gf6ol/NWgIjW+vBsZR1QbKvvDR2HYP TDE/+EmqDDzNXZHHahGV+aC/jQizYpYIv9sjLzvOW55ONRlCR8pYu+6UAPXaYO3J1oN3 M/vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=mIbBu5oerFY8oojdjY4H3fodNxd3UBrAe//XF172Q2U=; b=wHE01q3ijbB0aNqicNMnZQJ7goJvMzhkPzsyPyYZRscYuMgkc3AIfyciJ1abhz5X9X ebOK2voFHYyYla6CTi1BlbIYe2ifgxgyiLeSO1z9WrJ/z8gCzbk9+86lstd0L12rEM/j nEnnff+hmBWINpTyFXtGUdUn50CmxK9C2kGs2Fw6lr38El2mm5DLMSrdq8MEg14gFMzS quO4PZtVXyhXRRCdFVp+C25uIY6r/52+IyM8gGIyT7yzkOnjVQdxBUqhxguG3oBLYHeE rMmtx2gXP2qk7GlrBddjluLUtFs0UtvHY3cVXBKEQBA6J4Z8wxaQfUCmLniEckeArTQ5 V3+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PjJQpR/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id go32si21943718ejc.64.2020.12.30.19.01.34; Wed, 30 Dec 2020 19:02:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PjJQpR/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726469AbgLaDAH (ORCPT + 99 others); Wed, 30 Dec 2020 22:00:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726289AbgLaDAH (ORCPT ); Wed, 30 Dec 2020 22:00:07 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2003EC061575; Wed, 30 Dec 2020 18:59:42 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id z21so12382203pgj.4; Wed, 30 Dec 2020 18:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=mIbBu5oerFY8oojdjY4H3fodNxd3UBrAe//XF172Q2U=; b=PjJQpR/g7gNVNgz0zU42o4JzpwTUUVxuVc7Aa/jKd6/5Wb/Xt26UNZZw5Y46KO37er 4a7xdqTuQlChEf2WY0J94ZvkovV1AgHFdw7kXNhkGSVU7eyqyy2AWEqDLfhKUlSkcT9q 1kgaVkVRp9cukQToCQoO7ZoPNt6/looPtGs8LqBlMDfMahYVnWLTFqptEDVeFhQIO+Du 7hbCXzSBTMGk1K/clPEHsSG3ApyNTjutkm9BrmLUhMOKJQcKFfXu1+zxZ1fKF2/Hck7y 1no1ocw995UnWJXTGt1Py7ts/aYsw3McnWXRI8pPAWQ5oCuEAtgFTdanD7AxuitmGPQt BGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=mIbBu5oerFY8oojdjY4H3fodNxd3UBrAe//XF172Q2U=; b=qcKNWT/6BOgYz/E/fyEVFXzmudL1yW0jNjYEsB1tDxFN7fipNrL4wrKaNwKj1h+zJh gvrTCgOprrBtu/2DAyPOkiTkGQFsawRxYy9ubNmEHw5GcVZ8y+WUFIcJkK3tN3X/UTaT 0UWPy/NA0xWXIF4qPUCF5fN/JdDnOqL5okySIGK9Dz8kNX5p0jHmAnarrSaPHmVy0SES 6qZeKisGpvaUZmpZ1420ZcXlzm8x+lZy2tYXuXV4O3ELilE1Nofv5KLrUQxB5KGdY+0E ekHneylxzpyQw3uGQXXFuOvw+/lVmDQMO+sfMpYlMystROriNylz1U3pbD2z4t5G3cLH +obg== X-Gm-Message-State: AOAM533teVwkIqrIHYfjzf3Sq8TERPNMmAi6k9QPJt0QxwXQYM99Wuv6 IArQEO+XPXQguhDOGaNhjyM= X-Received: by 2002:a63:c009:: with SMTP id h9mr27776538pgg.119.1609383581687; Wed, 30 Dec 2020 18:59:41 -0800 (PST) Received: from localhost.localdomain ([182.226.226.37]) by smtp.googlemail.com with ESMTPSA id b72sm43524740pfb.129.2020.12.30.18.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Dec 2020 18:59:40 -0800 (PST) From: Bongsu Jeon X-Google-Original-From: Bongsu Jeon To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfc@lists.01.org, Bongsu Jeon Subject: [PATCH net-next v2] net: nfc: nci: Change the NCI close sequence Date: Thu, 31 Dec 2020 11:59:26 +0900 Message-Id: <20201231025926.2889-1-bongsu.jeon@samsung.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bongsu Jeon If there is a NCI command in work queue after closing the NCI device at nci_unregister_device, The NCI command timer starts at flush_workqueue function and then NCI command timeout handler would be called 5 second after flushing the NCI command work queue and destroying the queue. At that time, the timeout handler would try to use NCI command work queue that is destroyed already. it will causes the problem. To avoid this abnormal situation, change the sequence to prevent the NCI command timeout handler from being called after destroying the NCI command work queue. Signed-off-by: Bongsu Jeon --- Changes in v2: - Change the commit message. net/nfc/nci/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index e64727e1a72f..79bebf4b0796 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -579,11 +579,11 @@ static int nci_close_device(struct nci_dev *ndev) clear_bit(NCI_INIT, &ndev->flags); - del_timer_sync(&ndev->cmd_timer); - /* Flush cmd wq */ flush_workqueue(ndev->cmd_wq); + del_timer_sync(&ndev->cmd_timer); + /* Clear flags */ ndev->flags = 0; -- 2.17.1