From patchwork Wed Apr 11 07:32:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10334963 X-Patchwork-Delegate: jgg@ziepe.ca Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 613FD60134 for ; Wed, 11 Apr 2018 07:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C8D028747 for ; Wed, 11 Apr 2018 07:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 410CD2874A; Wed, 11 Apr 2018 07:32:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE84D28747 for ; Wed, 11 Apr 2018 07:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752103AbeDKHcl (ORCPT ); Wed, 11 Apr 2018 03:32:41 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:45139 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbeDKHcj (ORCPT ); Wed, 11 Apr 2018 03:32:39 -0400 Received: by mail-io0-f193.google.com with SMTP id 141so1300280iou.12; Wed, 11 Apr 2018 00:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bKrVjtlQrcgosXNPiP3BZhrgWSidzqrM/BmDgZ0/5dk=; b=RxcgXJv4lj/z4aK5e8XJh6Jc84qqVot815OwB7ThYcOfzKIY62byGIUPK04Qr85BLl 5CI1ytbNuduJQGX2tTbaNd39TomBI4jh849FFpWYZraezx2lD+CCR1Eo76Td/ktgLOz1 gXJocei54wYnhxlRyEx5Z1rBVZIWpUVkLwT44q+tqbFOOu6ff9lZdqXDK/Wh7mrkFxf+ jTKOY0PYhXxiof6E6KYs84+AIATMLe1lPZQ6dRUUwgGfxLmHKiGaOnniRkTydbWWmDsl 6kzuxBNAoJh6FOPzpL0gaOOJJfoiW8GDZgIc9QVSvyMzzpQuO4DJdXinm3wdjd1UeUIH T//w== 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:date:message-id; bh=bKrVjtlQrcgosXNPiP3BZhrgWSidzqrM/BmDgZ0/5dk=; b=o/MR62NeSF87KGRYkb4cujD4eVQUGYsyZcIhWuoOIBpt/Tl+/7wk5rMZN4PkZBCa3Y oRkLIhqFi3I81BTt7Wv+Orc3W29QEN47JPgIsew9nRIukoEbMzB6AMaH+2zC2/6BHyQW hrYt//cmpfpm4Dan0RRj3J/e+yzxqL2VesyHRZ/Sff+wklhBQ3WvhSkYPVvIppjEELFc IivuW+BwR0k4misrzPsBbTnd37HpfXv7rE1iPKp0ZWbQ4BUGIwGKggubjn85QgAHf/bo nF4cdH1AVZOktwZoS2DP9YjKqDNr0ONV5pWCatlO9qaG9qkghSanz1ma4IFMUuypdW3J yK1w== X-Gm-Message-State: ALQs6tBXruAuKcahGnSRGC9Kt5rsiUkbbSKrGWSvpb71ZIAItW1UsJcl ESiKL+8t9l5vpOcxji5kpqEWOtVH X-Google-Smtp-Source: AIpwx4+Axd7R0Q8AR1/Y261yl6BjZXWjaofWWxhuhK8waGGaMjgZ8eCoxetsTngLAtulCGJKFZkq1Q== X-Received: by 10.107.21.71 with SMTP id 68mr3425445iov.231.1523431958878; Wed, 11 Apr 2018 00:32:38 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id d14sm255700ioe.24.2018.04.11.00.32.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 00:32:38 -0700 (PDT) From: Jia-Ju Bai To: faisal.latif@intel.com, shiraz.saleem@intel.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/3] infiniband: i40iw: Replace GFP_ATOMIC with GFP_KERNEL in i40iw_add_mqh_4 Date: Wed, 11 Apr 2018 15:32:25 +0800 Message-Id: <1523431945-3508-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP i40iw_add_mqh_4() is never called in atomic context, because it calls rtnl_lock() that can sleep. Despite never getting called from atomic context, i40iw_add_mqh_4() calls kzalloc() with GFP_ATOMIC, which does not sleep for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL, which can sleep and improve the possibility of sucessful allocation. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai Acked-by: Shiraz Saleem --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 5230dd3..4e79af5 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -1758,7 +1758,7 @@ static enum i40iw_status_code i40iw_add_mqh_4( &ifa->ifa_address, rdma_vlan_dev_vlan_id(dev), dev->dev_addr); - child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_ATOMIC); + child_listen_node = kzalloc(sizeof(*child_listen_node), GFP_KERNEL); cm_parent_listen_node->cm_core->stats_listen_nodes_created++; i40iw_debug(&iwdev->sc_dev, I40IW_DEBUG_CM,