Received: by 10.213.65.68 with SMTP id h4csp3609804imn; Tue, 10 Apr 2018 01:35:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+xRfoQ8i2SJfcEHbFG7v8zoABj3JRrniku+X+JgfQH7aFdD1ykrdvOIVMfBxbFvqMQfIzS X-Received: by 10.99.116.74 with SMTP id e10mr17198385pgn.169.1523349329687; Tue, 10 Apr 2018 01:35:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523349329; cv=none; d=google.com; s=arc-20160816; b=o6nD3FtuKt189rD2l2r6mwE3saLcWmvopGkk6Ywal4/gvYmectAHiHtgOh2rzU3ouC n+7xm7gZL9oR/cnEiwabO+9sYIx9SVR1uD6P78ulkjGwUCMPVkhx1cL4w5oqElBViyNM uKnEA8J46WBtiS+XG9wovUYhQJjhAv9qlQV4ASLng2TDFHd8qek4IWTBrHuPRyksSlnM sWudz7f372H8bfcJi3b41juYeW5f1MtPHiZwQvOo99fkJnlNinzGuRegLCgwfEORl5EB 5MSyDk5UfJVTgatvHW4kuv++oBk7jlelnTDflKcEyRL4x/8tLLtJXQPg8mpM7+73bq9x 6WNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=PRNd3WQ5KTqLN/obWZagAzEka+HhE7FsLmm4OYIVPDk=; b=iRvaiRnHQxIn9wuqtg2c0uSQpTHunQdlr2nlL2XwbAC72zvDKC9GoIR3D4RGD68Alv DRMfP/JtcFd6IEXuCm4aCldJL9oQKChUS85rdUB41XGdVadNK2JmDGVw/zd7PairtHCV bOwGLV43cn26JxfG4tCzsBO4K0ED5GSfjVGUucrcNgtUWTcKcxMMHw5yuAnYjpxiQUZ+ HYucCnycb9v6PjmX15wjOnqXHhK3dp6ehtLtY9dk0KbAhAcCvPjdftyV1o9JznHGyheW AOKwzMVp9C14NoVMug6jvHueUV8WIfffEqgC70P58Ni8yuTqxso0fXO+GsA3+KQK1pBm Gwvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ekWqouU9; 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 l6-v6si2048259plk.489.2018.04.10.01.34.52; Tue, 10 Apr 2018 01:35:29 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ekWqouU9; 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 S1752210AbeDJIb5 (ORCPT + 99 others); Tue, 10 Apr 2018 04:31:57 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:37258 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751504AbeDJIbz (ORCPT ); Tue, 10 Apr 2018 04:31:55 -0400 Received: by mail-io0-f196.google.com with SMTP id y128so12765063iod.4 for ; Tue, 10 Apr 2018 01:31:55 -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=PRNd3WQ5KTqLN/obWZagAzEka+HhE7FsLmm4OYIVPDk=; b=ekWqouU9DNNsyxk5xwBq/rb+EwtI56HFUAvdlQgMisSsuiCo8AoFyZwoKIuTUdOqsw VBc8vih+jygBmrULB7RPyUnn21JRRCUUZCt8MazMqGPMXje+CvHSJmifCQ5H/GGQBKpx zL3RnQEmjkfwkaUL2ccmKEsy7uiUE95Nc1OyTrkw4lspb5WYq3+Y/misRG80EFSDinlw 5KUD5A+wfrWj2mU/gDmu+B1XNTPgaVXcS4qkpnqTcCfh8H0jNl4OM6XUgDQoUGSuS3p5 2XJXLl5VJlFgruFV0X3r+e7fAMAHYydQjBogEqsN2et0W+APCdRIaPX4mWnthliwRPrR QESg== 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=PRNd3WQ5KTqLN/obWZagAzEka+HhE7FsLmm4OYIVPDk=; b=ZHXtvalk/LcuDZPiDyVf1WMdDle6rWjd5L7QMSZ+aAcToqf+VQh2E+h5Ky4ldOYu9F CdYyLDv0ygNU5iauJqj15Cee6swwk2+eGsMMpYez5H7r7a+QL5QSa1dkFYhB7olvsL19 khklFhXFvm65PjNn6ULX3ioYdAw86x7N0vCb9NjP3wFZ/wLuE0u1LRAv1RGzFbkhUeJI 1bOGF1JAVG0ZmIdTAzlNPh/1PXmnc6YOy0N22aN/kawxjj/Eiz3n7X3w1bnrGWA6HcIb mRPbbTT2+6rVxuqERfIXzqjcntMYYZe1z1eDxK8ueCkNtC+uxbp+S1hfO/+I45TKW70Q 6N6g== X-Gm-Message-State: ALQs6tAUhYa/zZejO4k36/0o1oZPRrNDIKfQKnrRUiNt5IcAJeH1FOPx wZyM5Y4qoEkOJVDdFam3ENQ= X-Received: by 10.107.163.82 with SMTP id m79mr2038665ioe.26.1523349115047; Tue, 10 Apr 2018 01:31:55 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id k7sm993117ioc.44.2018.04.10.01.31.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 01:31:54 -0700 (PDT) From: Jia-Ju Bai To: jikos@kernel.org, dsterba@suse.com, gregkh@linuxfoundation.org, jslaby@suse.com, johannes.berg@intel.com, stephen@networkplumber.org, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] tty: ipwireless: Replace GFP_ATOMIC with GFP_KERNEL in ipwireless_network_create Date: Tue, 10 Apr 2018 16:31:46 +0800 Message-Id: <1523349106-29584-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ipwireless_network_create() is never called in atomic context. The call chain ending up at ipwireless_network_create() is: [1] ipwireless_network_create() <- config_ipwireless() <- ipwireless_attach() ipwireless_attach() is only set as ".probe" in struct pcmcia_driver. Despite never getting called from atomic context, ipwireless_network_create() 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 --- drivers/tty/ipwireless/network.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c index c2f9a32..17b04b5 100644 --- a/drivers/tty/ipwireless/network.c +++ b/drivers/tty/ipwireless/network.c @@ -415,7 +415,7 @@ void ipwireless_network_packet_received(struct ipw_network *network, struct ipw_network *ipwireless_network_create(struct ipw_hardware *hw) { struct ipw_network *network = - kzalloc(sizeof(struct ipw_network), GFP_ATOMIC); + kzalloc(sizeof(struct ipw_network), GFP_KERNEL); if (!network) return NULL; -- 1.9.1