Received: by 10.213.65.68 with SMTP id h4csp3967448imn; Tue, 10 Apr 2018 07:19:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+X5yQUY45RqFECaNd1cMsLS4VRCBXlSs6U+OBoduWme8ZJtuQyxnT6uNG8SUorQ8iXoeum X-Received: by 10.98.16.142 with SMTP id 14mr572906pfq.22.1523369981982; Tue, 10 Apr 2018 07:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523369981; cv=none; d=google.com; s=arc-20160816; b=aFmEcvQaCT95NdCkSpccMFKmS4t+dqDM+UC8loX5Bv4X/45xxmhHdVI2DHX8P50NQA Iz0KvtzdBaE/+VGjFfuIif6GCWHyTKZP/zvkoR/MS2+AQSSJaAPe429dpjC3YI6ijkXK LDW/tqsaGl4NbMfOq9nZ4BppZM8ct+HctSdKAc34yr63SrgEc9DgUGSkprRz20f70pue BhV7bq1BdGD1vp8BKks8KnmYFMZ1008R5T1/r3K/Ns8AeNYNt5tZk2aVnpJlh7h6NRCW en1THMJS+76n5xR5re/XUfStUdYF0PwiMdoAAPF0U6lZ2f3ol0ItSRzqreYR7YdpbgCb K9NQ== 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=j0d1f1pVYdCHLgyRcKNmBKko7voCeN1keEZ+FxGwoNY=; b=ld2xEGHa8C+dV6M1nCC4cb+2+HvlU29bhrADKmvKWhkZbsE6ZS1JvRs27+wZsfHm3c pTGN9hqHtcq0v6lzd+13T+MuIARY5oSbtgEiJh6ZHLs61FCuaa6LodrH+KKJ+7zpvKGf molYzKDDS0G+FbWFLvkrpPhRTA5dDVz54o+V+iMAXOC+95n0tn7Bl0hMVzBePB0BOWoh WYMQRiIonUFOQHhS1aQMOrBvVCFFHy/lyUumFwyf+EPwYvwD+HGdmDNJJlDJx+gC+r5c CWmOlV6l0V9kubO7FLBzIK8LNUeKk4uxJL1vhB1AUWHq/j7UqrMLJ/0aOZY5/iduhTqc 30OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DAmmvmWc; 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 11-v6si2725828plb.658.2018.04.10.07.19.05; Tue, 10 Apr 2018 07:19:41 -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=DAmmvmWc; 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 S1754113AbeDJOOR (ORCPT + 99 others); Tue, 10 Apr 2018 10:14:17 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:46418 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752909AbeDJOOQ (ORCPT ); Tue, 10 Apr 2018 10:14:16 -0400 Received: by mail-pf0-f193.google.com with SMTP id h69so8411339pfe.13; Tue, 10 Apr 2018 07:14:16 -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=j0d1f1pVYdCHLgyRcKNmBKko7voCeN1keEZ+FxGwoNY=; b=DAmmvmWc20ybVATUswC6+GmLX8QQlgp1jfgXv75M5x7qg6LClhG0IPcdz0O/9o0O1D 6COdkm5xdNIYCZNAnZs1kVrZCkwujl03lZUjC3uDNZJnnhGzHb5WZdlLn6e3K7Swm4Lp ZhtQz/Es5WwHsDMuyZgm0B3T8gBf6XPHjUw5pJDlQsXcAIhm2kC+kzz5TQFqVsXByAof O9H/R5erzHRaP4U7gkV9ZXM3srXGz0ghwA9EL5f7jRIf51kiq9c7SMSXEG9cwdh/9r10 6Skn7bTaaRvOhx91IMA5JiDNtVcXiAeu0gXPvWHyzk2J4oAw8XqH+IdQBBUVtfiMrTuQ fPug== 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=j0d1f1pVYdCHLgyRcKNmBKko7voCeN1keEZ+FxGwoNY=; b=Up4GmL9ShhgWFOmmgZR4oFXF0qphGF9TWMn59dB5TwIlmGXxq03pIxzfpWAymvxIop B5/Hrqju73rtdSkqh1xyVh0jx2UyAkP5cUxMjzFvewrZb/uD3A1lcfyTrq+QrjAi7/vZ nCrfk5ud8RLvi1FfKKT8+0xpAxli5si5jzroMKtFQ1nC/e423VS7NV8XW7shhgJ8vN0H 2GQ4o+Db375RE9tpjeZU6DdfFbmH0VN7rpIB0srvuQ/u++ErkU+4rhtVymfYKpPnK4Bs /iay2oHbiSDztcQF6rwNbliIRYUQV61pAVLOLucU+ytQZSLtijBtdKWzxE3xUN6YbD7u Loaw== X-Gm-Message-State: ALQs6tBCSRv4G2XPkN8Uo8PweSFXD5O8AAe2xHoxhk+e9d/nLvsxwSRL tgrGh2OktLSqCb97BB88k6no7iAl X-Received: by 10.101.100.132 with SMTP id e4mr457072pgv.240.1523369655704; Tue, 10 Apr 2018 07:14:15 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id q13sm5480313pgr.52.2018.04.10.07.14.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 07:14:15 -0700 (PDT) From: Jia-Ju Bai To: inaky.perez-gonzalez@intel.com Cc: linux-wimax@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: wimax: i2400m: Replace GFP_ATOMIC with GFP_KERNEL in i2400m_tx_setup Date: Tue, 10 Apr 2018 22:14:07 +0800 Message-Id: <1523369647-32271-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 i2400m_tx_setup() is never called in atomic context. The call chains ending up at i2400m_tx_setup() are: [1] i2400m_tx_setup() <- __i2400m_dev_start() <- __i2400m_dev_reset_handle() [2] i2400m_tx_setup() <- __i2400m_dev_start() <- i2400m_dev_start() <- i2400m_setup() <- i2400mu_probe() [3] i2400m_tx_setup() <- __i2400m_dev_start() <- i2400m_post_reset() <- i2400mu_post_reset() __i2400m_dev_reset_handle() is only set as a parameter of INIT_WORK() in i2400m_init(). i2400mu_probe() is only set as ".probe" in struct usb_driver. i2400mu_post_reset() is only set as ".post_reset" in struct usb_driver. These functions are not called in atomic context. Despite never getting called from atomic context, i2400m_tx_setup() calls kmalloc() 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/net/wimax/i2400m/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wimax/i2400m/tx.c b/drivers/net/wimax/i2400m/tx.c index f20886a..cfbc187 100644 --- a/drivers/net/wimax/i2400m/tx.c +++ b/drivers/net/wimax/i2400m/tx.c @@ -973,7 +973,7 @@ int i2400m_tx_setup(struct i2400m *i2400m) * the WS was scheduled on another CPU */ INIT_WORK(&i2400m->wake_tx_ws, i2400m_wake_tx_work); - tx_buf = kmalloc(I2400M_TX_BUF_SIZE, GFP_ATOMIC); + tx_buf = kmalloc(I2400M_TX_BUF_SIZE, GFP_KERNEL); if (tx_buf == NULL) { result = -ENOMEM; goto error_kmalloc; -- 1.9.1