Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp707588imm; Thu, 4 Oct 2018 01:53:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV62E64A5cwniL4zvl12ng65v779yDo1pZuTuUnGjFPKREXZeADC1mAZed3mBy5XVWAFLcGmU X-Received: by 2002:a63:c508:: with SMTP id f8-v6mr4887277pgd.412.1538643190975; Thu, 04 Oct 2018 01:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538643190; cv=none; d=google.com; s=arc-20160816; b=v25DEfCzcHzOihmvtrNT5EDZ1ByQ8/iLadZyPzxDZ9hhTq7XL3R4fO84+b+EXvgihz rndwJcytOJOzAvN8SmDZ2rpDcjdQmwLUQLVIPEUXAkaIEfei5lmEKzLS7Mt9Ui1Ml/YO 8jWotfhdy9jORI5457vJWI4efzQFjI3KRoCKMHLZNbrEFXlzBSnkyNz7AEK7xGFRkMLg lRFVc2LdOdws7Xq25w/TJqAc0RwQ8h3jfZGiNQkJUtiev5Dzq25/r6GxhedvONkBRVfq kFD2rNxCpcor3ngCfyAcIlzI+XjgxBwLCyzknar0zBicN3YNEMWzBHkyn2wWRUnxDWE7 B0rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zTXLXK8P+FBlVdxIdbSO7KNUqx7jveW1kZHc8/lXAIA=; b=tNJQbqCFxg248Aio7nvprdEg4AeLAbsTquAAA9bEIsOENGkOJfMTRTA37V2wqV2ke4 jLqW9a5ZOnVKUSBJOg17+IMSF8LNt/cYZC47ekSfWJOid+uEnpGU9VeK+1x7PC0iaA+o LSI/ekAN4XGFwWu1lVIN9+Fg3HI4yabmdBkW1q/NmV1UjXaeZ/mlZhXVYpLTMZMbkKQ2 OUSoilxKpNYAq4bjyJyL88FIiJpkXYbwNZveGqdmLbhnldnQpWQctgTzL/+ky2FhX3vZ lOiNcRhoTKEPHcxk1WGi5aJ3sa5ffTJp2RlAqIELUTIHU+XuSNBAr97UyOcKJRm+S4G6 dlLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=awVWBm0e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si3544301pgv.445.2018.10.04.01.52.55; Thu, 04 Oct 2018 01:53:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=awVWBm0e; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727655AbeJDPoj (ORCPT + 99 others); Thu, 4 Oct 2018 11:44:39 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42500 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727144AbeJDPoj (ORCPT ); Thu, 4 Oct 2018 11:44:39 -0400 Received: by mail-pg1-f193.google.com with SMTP id i4-v6so2832133pgq.9; Thu, 04 Oct 2018 01:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=zTXLXK8P+FBlVdxIdbSO7KNUqx7jveW1kZHc8/lXAIA=; b=awVWBm0e9iOKQvI2J2Iry0B+pme1R+lur6gbFMjxqqTW59ipWxmzHmlLefcyVulGRc 3GyUy0O4TLLzh5ONs+LvqSUTX34FphLNLYrYUoSEeY8HKw9jDcKB2ril2jdQRa6/jieo MA6uNlhRar3SWfQQb6FEZBMNbxBZQ0bXNTWcFHdvghk3Yub2ZDzJilCwyUQo15KpesJB QxAWcZwdWnmRlqU/a1sPsS3FrdVS5JzOiHqg0pSWvgIi7jaG8XrLu87eL435N7lOCbHb lmbpum7D/JOhEvNecemGs9OOVSBdDJ6lxcsAIKhQlGgXb92rAMf8CUScUskLcPgpA4NL 5KDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=zTXLXK8P+FBlVdxIdbSO7KNUqx7jveW1kZHc8/lXAIA=; b=VU0+Kq/n80CVpunu1X7XKjcEDcKw1/ZQ6IYzwyZ7utgb6U60XozCDCQGB3arAOWvAD WdBHE4OgZ8DGgARz+Am0dFD7titv+ouzO2rg6EJyBrOHUvo1pmKedshfaWDpvenCKiw5 N81u1xbU/8qOg2XYePBqqQOKSkBRihncaaRXdvLOt2Be7DM+5zmwNClK48enAy9A/iGU Yp5c+GvjovFLwcVIwH2gbgDCAqE4jVJvNmtgaOKVhFh1ZTb2BId1XztUyGf+d2L+4WW7 qf2c0jJoCGWXOV6QjIPkJ7viGZNWwjhPjlXZumles8lpkcPXcOsrwZbWIK9gIugie10l azJw== X-Gm-Message-State: ABuFfoglLHA32dZXCazYmk3zArNO+lN6HLfAuFspmsgEGuG+6gtZMdD+ 8UHO83X6qxTv02DVWy1o4o3iqAm4 X-Received: by 2002:a62:f20f:: with SMTP id m15-v6mr5625959pfh.244.1538643145145; Thu, 04 Oct 2018 01:52:25 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.3? ([2402:f000:1:1501:200:5efe:a66f:4703]) by smtp.gmail.com with ESMTPSA id g88-v6sm7875036pfd.181.2018.10.04.01.52.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Oct 2018 01:52:24 -0700 (PDT) Subject: Re: [PATCH] net: wireless: iwlegacy: Fix possible data races in il4965_send_rxon_assoc() To: Stanislaw Gruszka Cc: kvalo@codeaurora.org, davem@davemloft.net, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20181003140745.7650-1-baijiaju1990@gmail.com> <20181004075914.GB20523@redhat.com> From: Jia-Ju Bai Message-ID: <988494cb-c121-697e-b502-ea4e7c601f47@gmail.com> Date: Thu, 4 Oct 2018 16:52:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20181004075914.GB20523@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for your reply :) On 2018/10/4 15:59, Stanislaw Gruszka wrote: > On Wed, Oct 03, 2018 at 10:07:45PM +0800, Jia-Ju Bai wrote: >> These possible races are detected by a runtime testing. >> To fix these races, the mutex lock is used in il4965_send_rxon_assoc() >> to protect the data. > Really ? I'm surprised by that, see below. My runtime testing shows that il4965_send_rxon_assoc() and il4965_configure_filter() are concurrently executed. But after seeing your reply, I need to carefully check whether my runtime testing is right, because I think you are right. In fact, I only monitored the iwl4965 driver, but did not monitor the iwlegacy driver, so I will do the testing again with monitoring the lwlegacy driver. > >> @@ -1297,6 +1297,7 @@ il4965_send_rxon_assoc(struct il_priv *il) >> const struct il_rxon_cmd *rxon1 = &il->staging; >> const struct il_rxon_cmd *rxon2 = &il->active; >> >> + mutex_lock(&il->mutex); >> if (rxon1->flags == rxon2->flags && > For 4965 driver il4965_send_rxon_assoc() is only called by > il_mac_bss_info_changed() and il4965_commit_rxon(). > > il_mac_bss_info_changed() acquire il->mutex and > callers of il4965_commit_rxon() acquire il->mutex > (but I did not check all of them). > > So I wonder how this patch did not cause the deadlock ? Oh, sorry, anyway, my patch will cause double locks... > > Anyway what can be done is adding: > > lockdep_assert_held(&il->mutex); > > il4965_commit_rxon() to check if we hold the mutex. I agree. Best wishes, Jia-Ju Bai