Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4660252imm; Mon, 17 Sep 2018 19:03:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdazItytShaRxNVbO6ZWNVMzEB6FDm/2swBU6CGTv6a225jGaVKOikvO2hTrU5O+5bgIFEZ3 X-Received: by 2002:a17:902:2:: with SMTP id 2-v6mr27680679pla.181.1537236222796; Mon, 17 Sep 2018 19:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537236222; cv=none; d=google.com; s=arc-20160816; b=uyD11RccPqrTJhfaMVJGBTNQ4iHzqR31pSK+SD+9GX/lT+lHjHPsVj+aL+uof6DpkL DjJboQXu0bpMj+U0mlXb89K3E3sAxObaOmAZGAcvrx8EDnfzoJmlidi25FrcWj4V7GqR euN/Imy6fcP0CRHckkmMRvf2jP++ggRnSM731BxO3azREemHFsz2XNgqikD8smda9SHt 76iO8DFgNiacZkGD6sLVRexoxb2PTNPcAl6l7JOTOgFvgVqZBTt8JZ4whf+jobO0O7iX QMP0kBsUXWIL6npRNSmG5+OvpZVhKGC+tVPHKJAgAdmzIPlCf4Zj+FiP/dXl0/4fsOPT s4rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=QOJub0QMmQ4BYW9RXqSTChvALOVcuh8L6ZkQlAA11XM=; b=uZ80IBvso8hA6kFZBweu/X8o+PuGoYa7snhNOIf/M3ZwkWuc4+6nNynjBDNc7/BWct K7dxot52iSUU1Q7rHkw7MtQ5rHOyD6/XvxwqiZXQeJx3FRFkQ6zKAV7KCxOHbWV9Lcdl iJTcobJHm5YVbmQW/Yw+GLSffYtbdLVkACFDF+gk+CbAOXnRmtzBA7m3ZDYt39qAZ5Fq vD+eyUfgH2QXQTELUjvoh5XD5L4LzFBnFNLqZsaqwTE941u2UT7XTDCMpg20/DiQITaG 4v972vCvOb3jo1DaPJfCxj9N1OD8fxPTQLGYATYwNpnmbGLOc0r7ph6K40HW8CoAg54w wW0g== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si16663692plz.492.2018.09.17.19.03.27; Mon, 17 Sep 2018 19:03:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728770AbeIRHdT (ORCPT + 99 others); Tue, 18 Sep 2018 03:33:19 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:54096 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728645AbeIRHdS (ORCPT ); Tue, 18 Sep 2018 03:33:18 -0400 Received: from localhost (unknown [104.240.4.228]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 0817D1462227F; Mon, 17 Sep 2018 19:03:09 -0700 (PDT) Date: Mon, 17 Sep 2018 19:03:08 -0700 (PDT) Message-Id: <20180917.190308.350168193472877492.davem@davemloft.net> To: baijiaju1990@gmail.com Cc: hayashi.kunihiko@socionext.com, yamada.masahiro@socionext.com, robh@kernel.org, andrew@lunn.ch, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: socionext: Fix two sleep-in-atomic-context bugs in ave_rxfifo_reset() From: David Miller In-Reply-To: <20180915040246.22703-1-baijiaju1990@gmail.com> References: <20180915040246.22703-1-baijiaju1990@gmail.com> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 17 Sep 2018 19:03:09 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai Date: Sat, 15 Sep 2018 12:02:46 +0800 > The driver may sleep with holding a spinlock. > The function call paths (from bottom to top) in Linux-4.17 are: > > [FUNC] usleep_range > drivers/net/ethernet/socionext/sni_ave.c, 892: > usleep_range in ave_rxfifo_reset > drivers/net/ethernet/socionext/sni_ave.c, 932: > ave_rxfifo_reset in ave_irq_handler > > [FUNC] usleep_range > drivers/net/ethernet/socionext/sni_ave.c, 888: > usleep_range in ave_rxfifo_reset > drivers/net/ethernet/socionext/sni_ave.c, 932: > ave_rxfifo_reset in ave_irq_handler > > To fix these bugs, usleep_range() is replaced with udelay(). > > These bugs are found by my static analysis tool DSAC. > > Signed-off-by: Jia-Ju Bai Applied to net-next.