Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp149828imu; Thu, 10 Jan 2019 20:30:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN70wQ0y7ugEDt6FFD4tF3kwjjKgjYXJmD7l4yxoBRBQhwQxxHo/q1eA/Nrwj3fpSo+hhIxK X-Received: by 2002:a17:902:48:: with SMTP id 66mr12772756pla.68.1547181031081; Thu, 10 Jan 2019 20:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547181031; cv=none; d=google.com; s=arc-20160816; b=VKXYF0SIoU5SCfr02MqBFifqANC4wvLuW07mXSWPrZXVv8qDRnpDvDJ2rwoKeOWYlG u9T8UO0R8DaYurcF4MYmGGTjBmUUFN6p6guAp/7RgWsq6En8bmGNAJpnXnySpG/UWaRE Q5yVfEKoy1q/3xy9hVXCnOUWmHDhF4On9bulqh1cjfEFkm+A1YT9t4ioTJk20njMB200 L9Hd+0Q6SpNhYWwrk6e9Rk9oN3SMKSL1iUvGWUmp1SkrRbDrNooAYZSX7Rq5Lkuz40Ou ODfDg5cMLlUwC81KLgMdgv9R0DzZYBwdeZMgUHYTT8aPldhqR9a6xft3kQNlfpQdC0kn YEsA== 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:cc:references:to:from:subject:dkim-signature; bh=2gYExETUN2qZwC6w1JQx2+NWPxWko9KH+Z2H35nmEJE=; b=IaiuQfBSVpHMoJdkYfOlv9zAk7d/TxMpwWuacY+RGA1AGyhCFKBBBJIB4nFqu43Zsn iP198LN0oh2UJU7kQCPOL1sNsxDW1R1bDyqppAK3yL0wXQvpkWsC2sPI/pIyq95IeTDV U34Qdl3v5WY9c6rX/ZKevlho/msmRcdvAzkRTI3Jo7r1cc5pMxl3qZPuaH6rJknCwQ0H ktctJR263GBN6nA3Qlpapi+vJhmF46CT4RzwNWbMSgJB8UBULvzfWAgTPTZ+AYHjttd0 pXKICJmQzvkY61bdEu52tN2ZGpSNFrvV9R7fzWl+1hfBRUu1z2BSES6ImRaNQsXwL8XU Ux2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=S9C9sJfe; 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=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si8160587pfc.156.2019.01.10.20.30.15; Thu, 10 Jan 2019 20:30:31 -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=@163.com header.s=s110527 header.b=S9C9sJfe; 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=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729706AbfAKCMH (ORCPT + 99 others); Thu, 10 Jan 2019 21:12:07 -0500 Received: from m12-17.163.com ([220.181.12.17]:49705 "EHLO m12-17.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728083AbfAKCMG (ORCPT ); Thu, 10 Jan 2019 21:12:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=2gYEx ETUN2qZwC6w1JQx2+NWPxWko9KH+Z2H35nmEJE=; b=S9C9sJfei2o362/yGuDNk nOuO2b0Ra2wYWQ8gd3jx7oMC6EiKukqVnUxt5mfzPCXUIkDlraeBAAP1suMX/ilZ 5JO3Q5wSRPZ6cc+zA5WD0jWUodJOKV3aXOteb52Q+7hilqdVUuJHdJaqsdNY5I7I XINtyMejKxyRH64uZwNomI= Received: from [166.111.71.59] (unknown [166.111.71.59]) by smtp13 (Coremail) with SMTP id EcCowACXt69v+zdc7TORAQ--.31623S2; Fri, 11 Jan 2019 10:12:00 +0800 (CST) 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 References: Cc: netdev , Linux Kernel Mailing List Message-ID: Date: Fri, 11 Jan 2019 10:11:56 +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 X-CM-TRANSID: EcCowACXt69v+zdc7TORAQ--.31623S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrKF4rXr47JrykCF43XF4ktFb_yoWxtwcE9r 4FgF1DJw18uFsxKr4Ykr48WFyUKw1jvF97Ar409rWfCr9rZaykAFyDur17GrWxX3yavF1r ur15tw1qgwnFvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU5D-PUUUUUU== X-Originating-IP: [166.111.71.59] X-CM-SenderInfo: xedlyx5dmximizq6il2tof0z/1tbiHhA5elSIfIVnWwAAsU 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