Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp205778imu; Thu, 10 Jan 2019 22:04:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN62WBEmbxHbb1SdHbM6nGg5izAba2cJTh58VduQzLFMivJigUz1M94G/fLXgZet/wIG9u0L X-Received: by 2002:a63:374e:: with SMTP id g14mr12448806pgn.59.1547186640678; Thu, 10 Jan 2019 22:04:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547186640; cv=none; d=google.com; s=arc-20160816; b=MzH2MLBAqfR369yWdRXYPwup87hBRnH0HWd+BUfgkVZGqCaAEHoPe4a5BnIhT+i58D f+hHN6f2Hz6aJHvU+IZevIqoeqea9qdVbGCw2Mkv/XPnJ7lYfhWOrxkpxLRYIXtj5ewb UUOBZ9wU3FPUf1JfccNGMOynDoX8DV/9tdO3oVlBjHBPsAtOu0MfqsNoIjil7WbEHVeG 6eyT6d27JBe8RZ4M2HpdonDM1qNQNMX7cFYu5q6OewtEA6vktW6bsIVnv1uf4Lo37Y/t aYTGoxFadJCDb//xo+wx5fWEHnobzwJRor4LWUGFK//9n+BjXFU8DejrsxNiE7ZQBoxR jcAg== 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:references:to:from:subject:dkim-signature; bh=2gYExETUN2qZwC6w1JQx2+NWPxWko9KH+Z2H35nmEJE=; b=yZjgwgbsmFpVkT6P0Tenv+FW5aNF2B1ZDFj5gAeLap1lddOwyERxn49cVLmLukUUlh +qUB78Kt4ZFMLwy6XOcJqg4uo+FZMZ/aTFZOQ2gzNlHJiZ/EdMOaODWbq8mfctqa3+nl STLCpGROBfppzLcgODtXu+wk/cW4SHRzJb0p1Y2utXswPeyms8YriE3wG5ZYkubsgtRJ +a4aTcYy+n07EuavyY49cAwRmySWF2aF+y2epXtTgU8s8ccx0V6j4CiBeGsMhrfd1o9R 5aAoi9eHIznUgRvdpcw/81TTt1ISWqTzGEdb/NWp+QTtqcaiKBlBEddxgspXdKaBop7E RUfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u1Fiekhv; 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 j22si70679140pgj.244.2019.01.10.22.03.43; Thu, 10 Jan 2019 22:04:00 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u1Fiekhv; 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 S1729864AbfAKCSy (ORCPT + 99 others); Thu, 10 Jan 2019 21:18:54 -0500 Received: from mail-pg1-f171.google.com ([209.85.215.171]:41275 "EHLO mail-pg1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728243AbfAKCSx (ORCPT ); Thu, 10 Jan 2019 21:18:53 -0500 Received: by mail-pg1-f171.google.com with SMTP id m1so5642782pgq.8; Thu, 10 Jan 2019 18:18:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=2gYExETUN2qZwC6w1JQx2+NWPxWko9KH+Z2H35nmEJE=; b=u1FiekhvOHveaAYCfwOq67smYExLaWCUdYrbY/0Dd6JXouTsscGLqcV5A60W4rfUPc OWgg/FCUROxAVKmfDsvJVeqIhME7KuCtUt0t9BuPBMznv1UlgqBc0U+uEK9j2EW+mwpn 6Grd1yxmlb31ucVRU6FvGAICNpYdy1EaPs2BdLFhH7+8045EILL/A+rDFxST76wvvWMD BFgjX1VVc8lhRmLazNApHjYyHpw8HJzKTfKpkTclNutZPuQNDNEqXZs0wOmcL9etijPP IkPvPvbWzOSvbn+PpiYTFeUDS4fzLMaLWB84z+by8tcOFbnipWIGHPnRMj++o5x3+ORZ u0gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=2gYExETUN2qZwC6w1JQx2+NWPxWko9KH+Z2H35nmEJE=; b=lJLAj7Pw5a/PeNn6ogUF1avRjxTEWxFnmM2x/WobR7lAeAqMAm2xVkQ7Rap96JFVq3 CteF27W6toCZEW8LbfM71n2t62oYzkJMIMvNYQT0YmNn+7rAk7u97wIrHbTV8T6B4900 Cti7nZ5ISCDVj3PVHzItZuLyqounofMa9Na93oXazYfGY13gUFU1MD/h6469DQD87IqY Qy8nDoA+K+venfivSya7U+QzEK1PUJtFpXiLnAq849yKPP66nH3fDhjnUdJrGpjB42CQ OShp+sJaF4MRXCSmDGBHiItvdvgAHekvK4aybaoczndZlGVWj7yY7OYIPZev4CKoQar4 alnQ== X-Gm-Message-State: AJcUukfjDDp90+8q7R7hfWMV2KErLNrlh5fTin23nileYcjtv4E0GZsM Ud3UGwqwMtKGPJWT7K/uBb9BdFdh X-Received: by 2002:a63:4d0e:: with SMTP id a14mr11759125pgb.408.1547173131496; Thu, 10 Jan 2019 18:18:51 -0800 (PST) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.59? ([2402:f000:1:1501:200:5efe:a66f:473b]) by smtp.gmail.com with ESMTPSA id n186sm104484746pfn.137.2019.01.10.18.18.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 18:18:50 -0800 (PST) Subject: [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in hinic_get_stats64 From: Jia-Ju Bai To: aviad.krawczyk@huawei.com, netdev , Linux Kernel Mailing List References: Message-ID: <9a6a88cc-7509-d54b-3465-36cb536cb795@gmail.com> Date: Fri, 11 Jan 2019 10:18:46 +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: 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 The driver may sleep while holding a RCU lock. The function call path (from bottom to top) in Linux-4.17 is: [FUNC] down drivers/net/.../hinic/hinic_main.c, 775: down in hinic_get_stats64 net/core/dev.c, 8278: [FUNC_PTR]hinic_get_stats64 in dev_get_stats net/core/net-sysfs.c, 568: dev_get_stats in netstat_show net/core/net-sysfs.c, 565: _raw_read_lock in netstat_show Note that [FUNC_PTR] means a function pointer call. This bug is found by my static analysis tool (DSAC-2) and checked by my manual code review. I do not know how to correctly fix this bug, so I just report it. A possible way may be to replace up() and down() with spin_lock() and spin_unlock(). Best wishes, Jia-Ju Bai