Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1127630imm; Fri, 5 Oct 2018 19:28:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV60MsIZbh9L+DWDxSmlX8+pt+les0ObtjAh+KkkD04x06U6Pm+eXOvR/AgYUXa4SWr+jJEw6 X-Received: by 2002:a63:f252:: with SMTP id d18-v6mr12543266pgk.2.1538792921982; Fri, 05 Oct 2018 19:28:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538792921; cv=none; d=google.com; s=arc-20160816; b=RFlIQeD3fHvq0UcYuLYYv1trBmfxPIhRy7GKU7veHSoy3JCejzZm/Uf1RKbw6+1Aqf IyF5vRRj9ct+6dVgWMn4lRxvBJmiCK01rZUKa9W3STzqvBsMr7KSnGisNdye5a067PoH RBp/HktlWNX3vCXNLc1EPTnrgEoTtUX2yApFPQvV7a9EsXQd09884oytIHw7mlHShZef Dd4b2nHDWqIBMAvxmuZXKVGkIWxTXqQWQRIPqJb6kIMZFfQbRzNS+16Xmcn6pkq+K0PG EECvLOjQtA9TmF9jkFCTxqBo5LuhnzTKP52Le9p0f1+kf18y4H7f0vEHNxZ+If6Wi82U FwMg== 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:mime-version:user-agent:date:message-id :cc:to:subject:from:dkim-signature; bh=HJN9qMF3a6jMmQc7BguOTW85vNjCcjakU1s57xEU9CI=; b=PsRcdHf5uJfaywtgOkDzjgeu2XioBov81ITXeGu7phXZ0jMyJ6RLuN9svLkyCSU/QW oGjOz8ntH63HGqqw0dGkWAwR0OBhh6NHdeyvo3Rtu1EHSveD3OAxECA6oKzqUa1p3oWq CFGVsdvgsGngm53ni/lWAwIXismvwRnGNVc1yvNsP8uCokbUE3gREzDV5Xg3eRZWiSwo V6Rza+EuXru9xDkG9doTqID2M1LPhJrCTVW4qQzJh9mDx7EZMD9Ta5++ssa32nIEBu/E j1GhZJX+lE3xJ+7kJgT2KEbh7BC9gJYQOPhYc8xfZnUucD6WA9If1BweBuyED32dCiNx Vnzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gGfrBXft; 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 y73-v6si11068015pfi.61.2018.10.05.19.28.09; Fri, 05 Oct 2018 19:28:41 -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=gGfrBXft; 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 S1729228AbeJFJ0r (ORCPT + 99 others); Sat, 6 Oct 2018 05:26:47 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:39341 "EHLO mail-pg1-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbeJFJ0r (ORCPT ); Sat, 6 Oct 2018 05:26:47 -0400 Received: by mail-pg1-f179.google.com with SMTP id r9-v6so5466105pgv.6; Fri, 05 Oct 2018 19:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=HJN9qMF3a6jMmQc7BguOTW85vNjCcjakU1s57xEU9CI=; b=gGfrBXftcP6BSCs3aPPqdWl1qC+EyWB64k4BHzGt2DDEI9dUtI2NmfP59ZYx3XpO9n e7mBPYCCW6bQBsEm+kWxDrdb5YNw+6ADZpPKL+T9gcEUO1dXAJHZbjvJUuuWg6nCzm58 mBQR09Cea3D9BVH7aoZTFOhMi9e0oP2UAnZcZGSJ/I6BnZTdeJtlmcZEbCZB1zLoE+5P /Ys5CeQ6wiLAWHhME7hC+LEBKf50XtSbXGZRgUdbCT2QYtefojN9xwEcmYQLGwzAj8yT ifiIyPlxKWd64Kq63aOBCxT6C6LgsRvEs7u6iDtzDyFCj08+Sso9SnVv4V6un2rDZnZf lsug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=HJN9qMF3a6jMmQc7BguOTW85vNjCcjakU1s57xEU9CI=; b=TP81vjVkfyWYTAs7MsV9K4e0I0McGwICaFzaAyeSz8Kv2qV8GZDsKCYnrwXl4wk27U ZgBrn719h20eqjFxDfdP6J0iRPfS/9LYbKeqdX/zrm8x3n9Rrj6MvNWZD5vh2+B4JNSC 4fYdhX/SPivimiSrdIiXCXfWuhDNyh+dRl+GGqHk5rtHzzMyhMmVa57YyIDOolzokRX3 2sTyiipmn9IkOH1lsvXRyWwovotb3atqI6LkM0AVxZwzZnjgx5oAkm/kdbNZmV0djbIy zbO0gN/UGFBakMm7jL+8RTx6NGZWMdrCAKxHUX3Bq4Scu9muD2SBE4tafDQgb07Z1ucr eCWw== X-Gm-Message-State: ABuFfojz7NInbimKHVl36sn0KvxR0SMxEVt1FpHe7UKOM36M1eWZXlx0 wu94SL7vVfmiywFUta5101L9g/j/ X-Received: by 2002:a63:da17:: with SMTP id c23-v6mr12785113pgh.23.1538792718457; Fri, 05 Oct 2018 19:25:18 -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 p13-v6sm20601403pfd.65.2018.10.05.19.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Oct 2018 19:25:17 -0700 (PDT) From: Jia-Ju Bai Subject: [Report] net: wireless: iwlegacy: Several possible data races To: sgruszka@redhat.com, kvalo@codeaurora.org, davem@davemloft.net Cc: linux-wireless@vger.kernel.org, netdev , Linux Kernel Mailing List Message-ID: Date: Sat, 6 Oct 2018 10:25:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 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 ****** Possible race 0 ****** CPU0: il4965_mac_tx il4965_tx_skb line 1687: spin_lock_irqsave(&il->lock, flags) line 1894: q->write_ptr = il_queue_inc_wrap(...) [WRITE] CPU1: il4965_irq_tasklet il_txq_update_write_ptr line 2749: il_wr(..., txq->q.write_ptr); [READ] line 2757: _il_wr(..., txq->q.write_ptr); [READ] CPU2: il_bg_watchdog il_check_stuck_queue line 4817: if (q->read_ptr == q->write_ptr) [READ] CPU3: il4965_irq_tasklet il4965_rx_handle line 4827, function pointer: il->handlers[pkt->hdr.cmd] (il, rxb); il4965_hdl_tx il_queue_used line 868: return q->write_ptr >= ... q->write_ptr ... [READ] As for q->write_ptr, the WRITE operation in CPU0 is performed with holding a spinlock il->lock, but the READ operations in CPU1, CPU2 and CPU3 are performed without holding this spinlock, so there may exist data races. ****** Possible race 1 ****** CPU0: il4965_irq_tasklet il4965_rx_handle line 4827, function pointer: il->handlers[pkt->hdr.cmd] (il, rxb); il4965_hdl_tx line 2834: spin_lock_irqsave(&il->sta_lock, flags) il4965_tx_queue_reclaim line 2490: q->read_ptr = ... [WRITE] CPU1: il_bg_watchdog il_check_stuck_queue line 4817: q->read_ptr == q->write_ptr [READ] As for q->read_ptr, the WRITE operation in CPU0 is performed with holding a spinlock il->sta_lock, but the READ operation in CPU1 is performed without holding this spinlock, so there may exist a data race. ****** Possible race 2 ****** CPU0: il4965_mac_tx il4965_tx_skb line 1687: spin_lock_irqsave(&il->lock, flags) line 1863: txq->need_update = 1 [WRITE] CPU1: il4965_irq_tasklet il_txq_update_write_ptr line 2731: if (txq->need_update == 0) [READ] As for txq->need_update, the WRITE operation in CPU0 is performed with holding a spinlock il->lock, but the READ operation in CPU1 is performed without holding this spinlock, so there may exist a data race. I do not find good ways to fix these possible data races, so I only report them. Best wishes, Jia-Ju Bai