Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp173338imu; Thu, 10 Jan 2019 21:09:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6a2MwWKMUsJzl1g+Wmk0HxS0rM+jOIXzxDDcf1qqKuN8e5WG69k+JN1O3ulPVGmxgLc1B/ X-Received: by 2002:a17:902:b48b:: with SMTP id y11mr12811320plr.200.1547183391976; Thu, 10 Jan 2019 21:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547183391; cv=none; d=google.com; s=arc-20160816; b=NlUtputpgtGeVhsOxRrJBZiG97oh4sxwpXP430nolkotMp/chzxtHxPgOMIqJ7HJ/4 CoXxZ7lSILE9XrfJf10nfwJO/BiCGdQlz32i5nWdH84gyBTzowbbz6wOVHxqJjNltY3h F/Scq5SV3sBju1nguV53uzo6+JXrydRHfRh7dZVVGr43f7e4Bu1PJJFFM3Ud65t6STv6 y09mjjnB9G2g+ymsUbuLeDhCLVHK73RN41lyPSOuHi2SxLYPDw3GOnzSzLXxmt4oVJSz yzaCqqQ2C1Hy3nvrtP5bngZbFk9Psi8Md+XRLnNF/MzFWvfBI+uNGeZQNSB45Fjc7RAR Htmw== 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 :content-language:mime-version:user-agent:date:message-id:subject:cc :to:from:dkim-signature; bh=ZKVPLxsVvmavmhEhg/It9g/craYjRgUjLhGShe9xX3E=; b=fW2UYcUg4pipGMFPzkq00aKlSHGHtxQLshJehrP9HJseOPrBJYtQJFbyh2AP35b5rz EsFKmdF/LJVY7es3opIHa7KFe5LfT/K+o5ukl15A/HnvBwlQGu3nY/oftjwu2lbHqymB SfrqqSyuU2f/6NQD/uPFpJ1VeBoSJGjETAkL/aE4GTII0rS9r6ZCKtdfQ5Iw98EQd9Jb 2w1qmIaihrzi98CCI3ViVDchTiUlVeHhyLnTpSqP0tO0QYylu/mdVPzM6V2umasr/sI1 dszcDixDjDvPvJQk+QfktnUD/UW/O3Tgzk4MV6W1F7wQuYtcj6QgK0ExMXLMsbZSUpor MyQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vYzbwGCA; 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 6si25851888plc.241.2019.01.10.21.09.37; Thu, 10 Jan 2019 21:09:51 -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=vYzbwGCA; 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 S1729172AbfAKCcc (ORCPT + 99 others); Thu, 10 Jan 2019 21:32:32 -0500 Received: from mail-pf1-f174.google.com ([209.85.210.174]:36482 "EHLO mail-pf1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbfAKCcc (ORCPT ); Thu, 10 Jan 2019 21:32:32 -0500 Received: by mail-pf1-f174.google.com with SMTP id b85so6219023pfc.3; Thu, 10 Jan 2019 18:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=ZKVPLxsVvmavmhEhg/It9g/craYjRgUjLhGShe9xX3E=; b=vYzbwGCA6o2OEf6yCTf0LRiFacVhwZQyn9f+R3+tBpCHbzq9GGTFe7HsHc1PPCKneD wtXtrXD5Shyr5gWtgocabZ1df2JeK/Zq2uQ7J/8sICQkbqdjfzhqDBOgVmgJTpWAuCBl P8hfxtIReeq6104gXTRhHl6lflvw7QgZbY7+xkT4f/mYzh1PagfbWkLzyfvZkJ8Q9bVM ShiVTfIm6+pp0+VfNF5bOlDY4FiKhDFUvo5mifpek7YE/+OeX0HOHdDMfwNXE7k0f6sB wdwfaaATtlBhpLrTMcV8x1G9oxTiHWPIkU4o8pTn57kEq660ghDnMeSTC8jxLYzGEhXb 2Z/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=ZKVPLxsVvmavmhEhg/It9g/craYjRgUjLhGShe9xX3E=; b=B1B7bgnvJwzm55V1plZtmXyqJtnidcGOmxQxoMDi0VdChkoNKtDmPxI96mEU3rLNY4 R0gtPtW6I34h3nChv5S5avdQt1ShclaSvSw42lvsQ1CrqnejhRVB8CA78b+Qb0lCj/xW J9m43/NJFARqpPxPqVhQTYqneFt5p8VwmwHEe5RZrs5dETc3A3E5mhUi57UNyq3GYvdG pdIJD+k4apqwKgPf4VJ2PxZKPpTv5eE/Yu/imYhPgDJw718hoYGsat/qqcoHAAgaZF/7 iQLenP7jPFpSCZiv5RHsxixKgTEqKGcpa3J0YEmzbxbWa8uyhonq7NCk+RUuqGMFT0/C EM8g== X-Gm-Message-State: AJcUukeIb69smDAmZFD5ITspHCdp0A8HP+iVDqXs218aReijs1NdK4S3 H81x6w7EuO5muYG+8lpbTDDpCexy X-Received: by 2002:a62:3adc:: with SMTP id v89mr12506395pfj.109.1547173951513; Thu, 10 Jan 2019 18:32:31 -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 e86sm117555755pfb.6.2019.01.10.18.32.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jan 2019 18:32:30 -0800 (PST) From: Jia-Ju Bai To: aviad.krawczyk@huawei.com, davem@davemloft.net Cc: netdev , Linux Kernel Mailing List Subject: [BUG] net: huawei: hinic: a possible sleep-in-atomic-context bug in msg_to_mgmt_async Message-ID: Date: Fri, 11 Jan 2019 10:32:25 +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-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver may sleep in an interrupt handler. The function call path (from bottom to top) in the directory "drivers/net/ethernet/huawei/hinic/" in Linux-4.17 is: [FUNC] down hinic_hw_mgmt.c, 324: down in msg_to_mgmt_async hinic_hw_mgmt.c, 408: msg_to_mgmt_async in mgmt_recv_msg_handler hinic_hw_mgmt.c, 464:mgmt_recv_msg_handler in recv_mgmt_msg_handler hinic_hw_mgmt.c, 484: recv_mgmt_msg_handler in mgmt_msg_aeqe_handler hinic_hw_eqs.c, 264: [FUNC_PTR]mgmt_msg_aeqe_handler in aeq_irq_handler hinic_hw_eqs.c, 355: aeq_irq_handler in eq_irq_handler hinic_hw_eqs.c, 383: eq_irq_handler in ceq_tasklet 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