Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp665037imm; Thu, 4 Oct 2018 01:00:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV606L7nedpggRhlflpT6KxQBV9T7aMxsoUX2jPXcnA1cICYuH85m0qrkW8ccHMoCPLZQhl6g X-Received: by 2002:a17:902:a58a:: with SMTP id az10-v6mr5373199plb.204.1538640056155; Thu, 04 Oct 2018 01:00:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538640056; cv=none; d=google.com; s=arc-20160816; b=Zr+rJJ462/7Rm9axbcyZd13pzAO2N9u4shy4pH6n8lnpLVhgMcYiFerLRgPzps+MCO WDEyI66pIAFKLbit0Ful+9EnTChqz8LYNVE7JMitFmwvrigozfa77evt/uFa+VduLEnb AVyrnpTWAbHq3ZdfHcmF68DhPNkhCtPC+RDFYTxZsghlZSOshBsUOFz5lfm+SVPXvSuH fOo2yr1JAZYsHn+XY1i+bdXcw1nzqh+K45ZR+RIO+Ophk5oBrMZYAck14T5IZnH31UF1 7juQIywk9HfuPG8admBfCxU5PEKE94N/sMGNad6LB3JfH35C3MJXABdM7oZ8kWiwT+/x nhaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7pspYZYm/eKJGTO9G5uqRIqjaExoOi26ZDp0Gi6dtv0=; b=QmRE378X5XgVgVzFLw6uBDg/gKILecovVTOak3AtpSlVpZir2/SVjGE9YV4gOJ3NSl DfULHhg+VPEHin5GKQVQ9pJtqMY25zafPwglEcTTBEd07Slq8BfKxsGNYe/0UGsFAH0m pKv56Tkzws/9S60CsSP7azrT55RxJk7v+YnV943IU1yMahNf6xNmN1iha5J/cT8CXGr2 H4vpOja2ojc63aSb5jyldTMXjaUY11ZBG8tQQ9p5uZCi002izOfcssRKs0QaWUgD10Z4 0c+GYCbhRrQBacXV+9R5bk+/E6N4+/nooGBI6gekKwi4wDzhQTRNo6iortrYdvyK2nQx RpCw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si4097606pfm.141.2018.10.04.01.00.40; Thu, 04 Oct 2018 01:00:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727693AbeJDOvQ (ORCPT + 99 others); Thu, 4 Oct 2018 10:51:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34732 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727369AbeJDOvP (ORCPT ); Thu, 4 Oct 2018 10:51:15 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C60627F6B0; Thu, 4 Oct 2018 07:59:16 +0000 (UTC) Received: from localhost (unknown [10.40.205.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CAE52010D64; Thu, 4 Oct 2018 07:59:16 +0000 (UTC) Date: Thu, 4 Oct 2018 09:59:15 +0200 From: Stanislaw Gruszka To: Jia-Ju Bai Cc: kvalo@codeaurora.org, davem@davemloft.net, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: wireless: iwlegacy: Fix possible data races in il4965_send_rxon_assoc() Message-ID: <20181004075914.GB20523@redhat.com> References: <20181003140745.7650-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181003140745.7650-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 Oct 2018 07:59:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > @@ -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 ? Anyway what can be done is adding: lockdep_assert_held(&il->mutex); il4965_commit_rxon() to check if we hold the mutex. Thanks Stanislaw