Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp463650imm; Fri, 5 Oct 2018 06:43:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV63kQCzipDW8D8eUHeCXQZX+pDOc5kdY+WiK55YTd23pojD4T2wknRwyrO6926l46uVrrJ72 X-Received: by 2002:a17:902:6a8b:: with SMTP id n11-v6mr11510511plk.16.1538747009590; Fri, 05 Oct 2018 06:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538747009; cv=none; d=google.com; s=arc-20160816; b=gtsJRCPGQeKXkd9YdbqYCRAnQbLmQI8x7o8n1D8AfqGEWg6dU8P2v33AXLz3VZQtpV Fzqsvx0YZxlfOCsMoeXR4L3vt9WK4JycgZx3VsZ4OqldY4+e9o9BTQELhDXrnsg20+Gr dWfDWxoMbfGlhsFUV3/3vHN3R4BoOZBuIH0xbkdyYgou5RAjZQYbKkhdACDt7vS5/H9U pjX+B4oOfW2h2WicRfqy3nkHvPWm+S6ApWkuNpF0ahywGfE/9InWUqJoEr2YRS06kRoM iK80QaSpwCuuAz7Gmiz15mbjlni2RcbgVCF5GUnWIn9b84sJMMAHb4WTztxr2IwPdMnu TktA== 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=SYku1qYFAEJav22Y8Tj5nBN2krftALYGPwKWKdtPLt0=; b=MgsTmosHOk5DCEZSaCfqjrmD5tI0CsIQd0QA1nSFtQykUqmtalSsPiIhoFuGDtNS5S PhVq0GitMW177tD0oVfAry/S8MN7ucaO/T16KJEB9eNdLEPPg4YwrZ1PV9YX6Co9LV0Z +rvpryShSlcjF4ENlZlALrEsOz6OZ3En9N9zOTfEkwBpGOSYRvKPtXA4uH+HRoOsq2Pt izXMyQ/zLBAgZvnAVVH9yhOGMovCKxJGbFHKjRdV2CmbqJUiRO0SolCuxNPMmZw6j8ba dIGrtnkkTWiaBXcSxMF+M8DMU1RGvoM/RGuDuF7UZSP9yy3sfzj9IXY9SfKdFYjWAUVf wGhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UFOyi8SE; 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 u1-v6si7940988pgj.430.2018.10.05.06.43.14; Fri, 05 Oct 2018 06:43:29 -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=UFOyi8SE; 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 S1728770AbeJEUlt (ORCPT + 99 others); Fri, 5 Oct 2018 16:41:49 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37865 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727701AbeJEUls (ORCPT ); Fri, 5 Oct 2018 16:41:48 -0400 Received: by mail-pf1-f195.google.com with SMTP id j23-v6so5116600pfi.4; Fri, 05 Oct 2018 06:43:01 -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=SYku1qYFAEJav22Y8Tj5nBN2krftALYGPwKWKdtPLt0=; b=UFOyi8SEBbG5cmn5b3ksNNF49qgX84G1IHC3CofReKq2h61IOji5e2lWVHX6gymZKD 4RteRrjtYs0kMWaS0HrUx6omItvonPvw9+jSPiRCPB3wXHgEfZI/i7qxnpHeU7rz0fa+ yfeBBMKZAzTvnhFtPwI7RpbDrsXXkeAH8jOoAGGKfQljmAeG5YXMChU82bPJGmuiZdZi cYFc+WQRr45JjqePQeXSTzWuQN3/0Ed7kgZ/uf7n4vAY10HL0NUpOozP1BiRBLvPtd0N CeHNs8D4kcYSqx7YJORTRuLWxDgY0D4zSlr3eG1YJgQQmVhSs4QyrgbbLpGsiXH93vDO d0Jg== 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=SYku1qYFAEJav22Y8Tj5nBN2krftALYGPwKWKdtPLt0=; b=dU/s4dCYzOWghVunFRuynBQkvBPoyNqJgGsxlYnI3OxLs7MxIVm3tiOkwRTTNS7eFz IJwPZM7BMg10pMad+r1pIOOvxaWNw+QQpTqeKoUDnz40roRfA1fozrOFZaYGswFaeniz Cb7RwoUBOMksVXGnqujuVZOcCFcZzmDibz/qPZC7/1h4GBsBSvds11QRqfNYEKcWu+aQ hz6Uzn3mb5djj65o9aNyAgGQzscE7yst43sOWKdTjWkvEdu79a/75Y2h1gzagAGX+2rT eppX1eJ5/R2A02+7B4ECKnVXLYAveRqIrN/Ae02wnJXHEqIGQqgm5VZuC22eWvl8Rzue 7s5Q== X-Gm-Message-State: ABuFfojPSsUyqKJnOsMQEh2rPiz/QBNLCIBr3zfIFRDDcPDrDu0qcC1r U9eTrykPZjzJG8gW2Szj/Xa5VrHx X-Received: by 2002:a63:982:: with SMTP id 124-v6mr10365569pgj.80.1538746980543; Fri, 05 Oct 2018 06:43:00 -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 189-v6sm13801546pfe.121.2018.10.05.06.42.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 06:42:59 -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> <988494cb-c121-697e-b502-ea4e7c601f47@gmail.com> <20181005075403.GC1931@redhat.com> From: Jia-Ju Bai Message-ID: <60d6ad7c-3aaa-73e1-451c-c6fc7cb66e99@gmail.com> Date: Fri, 5 Oct 2018 21:42:55 +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: <20181005075403.GC1931@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 On 2018/10/5 15:54, Stanislaw Gruszka wrote: > On Thu, Oct 04, 2018 at 04:52:19PM +0800, Jia-Ju Bai wrote: >> 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. > >>> So I wonder how this patch did not cause the deadlock ? >> Oh, sorry, anyway, my patch will cause double locks... > So how those runtime test were performend such you didn't > notice this ? I write a tool to perform runtime testing. This tool records the lock status during driver execution. Some calls to mutex_lock() are in common.c that I did not handle, so the corresponding lock status was not recorded by my tool, causing this false positive. Now I have handled common.c, and this false positive is not reported any more. Actually, I get several new reports. I will send you these reports to you later, and hope you can have a look, thanks in advance :) > >>> Anyway what can be done is adding: >>> >>> lockdep_assert_held(&il->mutex); >>> >>> il4965_commit_rxon() to check if we hold the mutex. >> I agree. > Care to post a patch ? Sure :) Best wishes, Jia-Ju Bai