Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1410306ybl; Wed, 8 Jan 2020 17:02:02 -0800 (PST) X-Google-Smtp-Source: APXvYqwMLPKeQ6CTbkJ1aJwFd6rFeT9kGF568J2TAIdOYwJrwx0jUpvNoAh2+YJGFhlBaAXYnasq X-Received: by 2002:a9d:5784:: with SMTP id q4mr6664398oth.278.1578531721831; Wed, 08 Jan 2020 17:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578531721; cv=none; d=google.com; s=arc-20160816; b=Yr8Ng9lTudveQUM0KvfEkcnQOTYKiBev+vH0KpuNxjV1LQhbO+3hqWetpbkleOiSSR 7hVGHLUhHsmE2mk3E9Jsdt6iH0len81OqSjJ8RkHzT+Nk4neMysQwDPp6HReTYJnSzmS m6jGph6eL8O0corS7nCHUe+5UcM5OXgpInh3Nyf8oBPcAKD9IspSpf5/EZobTEx4hEFl 5T7TYbSgP0FYMSFKCtg0K39fJ6KgyHd58qVnNywuyoPz8B787d6S6ksCvUn/Y1aVwmPu 2+jUAnJZHzlnw8OtYjdKBVKNhhHJBF0ltOQ6/3QYxE21JPADoQ0QQf5eRscAsZ1YcDLi im/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=nOiRwIfyxAsZb4vTAdv7X9xhBVXwixTbCxBaDChxyjA=; b=jn6vtdxD90tNnYNCTPC8xmIDAf7eQZvNUrqc9krY+tv8nfMcqLFsr4NhXgCu1GfEVJ cH7RZpDpNWUGB4rcBH2llAj/Zwgf8FvjPLmjIsVFqqbUB8l482VMvgUhI2w0dgcHB8fR H9AJ7jDdpIwDQljD6lvkWxp8+nCILyhoNnCaGjgKcfODpPX/vC2MQJeASqA0Kbv/ThRj QWTiRYQIx8zS/b+OJ8J9mP3ntoa4J19Rx/I04XpDdBA/v6aF7w6edMOpji5+whceY6i3 uXswC/r9GYq+eN6H9SojfzlrjCsTwB9+YttVZBx9PQ9m2VFElNrsMQnS9GnL7/y71Z34 24cA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r26si2769738otc.163.2020.01.08.17.01.49; Wed, 08 Jan 2020 17:02:01 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727769AbgAIBBH convert rfc822-to-8bit (ORCPT + 99 others); Wed, 8 Jan 2020 20:01:07 -0500 Received: from mga05.intel.com ([192.55.52.43]:19165 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbgAIBBG (ORCPT ); Wed, 8 Jan 2020 20:01:06 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 17:01:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,412,1571727600"; d="scan'208";a="233869969" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by orsmga002.jf.intel.com with ESMTP; 08 Jan 2020 17:01:05 -0800 Received: from orsmsx103.amr.corp.intel.com ([169.254.5.250]) by ORSMSX110.amr.corp.intel.com ([169.254.10.84]) with mapi id 14.03.0439.000; Wed, 8 Jan 2020 17:01:05 -0800 From: "Brown, Aaron F" To: Jia-Ju Bai , "Kirsher, Jeffrey T" , "davem@davemloft.net" CC: "intel-wired-lan@lists.osuosl.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] net: intel: e1000e: fix possible sleep-in-atomic-context bugs in e1000e_get_hw_semaphore() Thread-Topic: [PATCH] net: intel: e1000e: fix possible sleep-in-atomic-context bugs in e1000e_get_hw_semaphore() Thread-Index: AQHVta3aFEjLZ+EvHEi0p4CGcL5CcqfhpOxw Date: Thu, 9 Jan 2020 01:01:05 +0000 Message-ID: <309B89C4C689E141A5FF6A0C5FB2118B971A925B@ORSMSX103.amr.corp.intel.com> References: <20191218141656.12416-1-baijiaju1990@gmail.com> In-Reply-To: <20191218141656.12416-1-baijiaju1990@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjlkZmI1NDAtYjM2NC00MTIwLWI2MjgtZjQ3ZTk4Y2IyZDM1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiWGdFY0pPWVVaVjZhVkNlSlhkVDZtdDlJdXc2V2EwUEs4ZEI3ZUtEa2xSRnEyU20ybEZcL2tySzlwWEM0UHVcL1A4In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: netdev-owner@vger.kernel.org > On Behalf Of Jia-Ju Bai > Sent: Wednesday, December 18, 2019 6:17 AM > To: Kirsher, Jeffrey T ; davem@davemloft.net > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; linux- > kernel@vger.kernel.org; Jia-Ju Bai > Subject: [PATCH] net: intel: e1000e: fix possible sleep-in-atomic-context bugs > in e1000e_get_hw_semaphore() > > The driver may sleep while holding a spinlock. > The function call path (from bottom to top) in Linux 4.19 is: > > drivers/net/ethernet/intel/e1000e/mac.c, 1366: > usleep_range in e1000e_get_hw_semaphore > drivers/net/ethernet/intel/e1000e/80003es2lan.c, 322: > e1000e_get_hw_semaphore in > e1000_release_swfw_sync_80003es2lan > drivers/net/ethernet/intel/e1000e/80003es2lan.c, 197: > e1000_release_swfw_sync_80003es2lan in > e1000_release_phy_80003es2lan > drivers/net/ethernet/intel/e1000e/netdev.c, 4883: > (FUNC_PTR) e1000_release_phy_80003es2lan in > e1000e_update_phy_stats > drivers/net/ethernet/intel/e1000e/netdev.c, 4917: > e1000e_update_phy_stats in e1000e_update_stats > drivers/net/ethernet/intel/e1000e/netdev.c, 5945: > e1000e_update_stats in e1000e_get_stats64 > drivers/net/ethernet/intel/e1000e/netdev.c, 5944: > spin_lock in e1000e_get_stats64 > > drivers/net/ethernet/intel/e1000e/mac.c, 1384: > usleep_range in e1000e_get_hw_semaphore > drivers/net/ethernet/intel/e1000e/80003es2lan.c, 322: > e1000e_get_hw_semaphore in > e1000_release_swfw_sync_80003es2lan > drivers/net/ethernet/intel/e1000e/80003es2lan.c, 197: > e1000_release_swfw_sync_80003es2lan in > e1000_release_phy_80003es2lan > drivers/net/ethernet/intel/e1000e/netdev.c, 4883: > (FUNC_PTR) e1000_release_phy_80003es2lan in > e1000e_update_phy_stats > drivers/net/ethernet/intel/e1000e/netdev.c, 4917: > e1000e_update_phy_stats in e1000e_update_stats > drivers/net/ethernet/intel/e1000e/netdev.c, 5945: > e1000e_update_stats in e1000e_get_stats64 > drivers/net/ethernet/intel/e1000e/netdev.c, 5944: > spin_lock in e1000e_get_stats64 > > (FUNC_PTR) means a function pointer is called. > > To fix these bugs, usleep_range() is replaced with udelay(). > > These bugs are found by a static analysis tool STCheck written by myself. > > Signed-off-by: Jia-Ju Bai > --- > drivers/net/ethernet/intel/e1000e/mac.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > Tested-by: Aaron Brown