Received: by 10.213.65.68 with SMTP id h4csp3830969imn; Tue, 10 Apr 2018 05:28:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx49NQjeaM2fGrgWPbtnEP7Y4O1k/1HMG23kyOpqT9xiEgD+nF+hYIPy2zYdHmNHMt9tt2ctz X-Received: by 10.101.89.65 with SMTP id g1mr137771pgu.185.1523363313441; Tue, 10 Apr 2018 05:28:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363313; cv=none; d=google.com; s=arc-20160816; b=fVdhE2+/UIx4VHQMM6bqX3DKIJJ2XAa//uupsY1UvM7x1tby4OQ6EcDIknGk5RUVBG +TqI5XyTTyVwJ4F5SqeCzNjVgdK5j+WGAkpLRElbnunp+80wxwvbvbs3R/kF1A5v0UAa fGjW+8Lx8K18xzvPgfWZeRVtDZ0Z3t28lh96SRdNnnbPoiHlrxqQ2fN0mZdOSTN+aPoD 9EGCt+uaHDIagjvE2Q3fzayLp5lbej+KPor+nlrmVtmd3eSzNAAI1PRI2hIUqLJ2e/0Z +SksV/oEXY4jFXqUzDK7kKEfO7nkSltvDih8RFlFPfStqgixdiq1o4N65CNIrsHHfPdx 1F4g== 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=u/A8GOsSh+Y6aAjr5cTQO3SIudDIXhXmlKNyTmHxr58=; b=VaY4iGC4xeYjCyxxoaCP3AHOh/vm/bqI9e77y4SnIsXCJ3ibJQ1pHN7NnCh46Blvf6 B+3wjkzG9/FLe2MQJ3CfUmKXX85/HhBfQmjKF+w5zfNFxKzsagE7ZILGrt16BQ9P2nEc 22BhXBRmU2uaW0YYN70NODGswpD2swQOif4z4r4j29VyiQVjGs+jgXrFsQX42NzvU5Gb acKuHgJf6kkyxEvVmifPBLZxlpIz8dfGsSQm7Cer7FO7hPVsHGunCf4twSGmswEYIH3M NR8xA8L3FlhRXJ55VEWWUr4TbCmC3wjlQqu4s1Y0NGGgmYq6NUJr7nsVnYKaP81JoKWJ JR4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P2IfDdQT; 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 q124si1765969pgq.215.2018.04.10.05.27.56; Tue, 10 Apr 2018 05:28:33 -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=P2IfDdQT; 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 S1752847AbeDJMYD (ORCPT + 99 others); Tue, 10 Apr 2018 08:24:03 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38454 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbeDJMYC (ORCPT ); Tue, 10 Apr 2018 08:24:02 -0400 Received: by mail-pf0-f195.google.com with SMTP id y69so8163753pfb.5 for ; Tue, 10 Apr 2018 05:24:01 -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=u/A8GOsSh+Y6aAjr5cTQO3SIudDIXhXmlKNyTmHxr58=; b=P2IfDdQToEA9HS2YPifGW8LczHHFY2Z+8fJl/7Q6HwaB7UCMUIbKOm3TC/LTxUTSOD 9G1G+7DPkhUsm/0ewX3x5X+6nXI28fZSgK+v3H8BQrRbFgpjmQKxMgcLG7+O5CJ6bxvf PCRRc6e0ZMjoMnazNtJHI0GwiJahF3qw61UvGQj7hDIO/15QV24tlQTs9liSBSEyPd6A doeNiMX5wEzqyVQwG1ryb/0Ul9txXXukxFwDP81l0Bst7W63EAKBbguu69RdSBEkMAJu KzjMoe2/LH7GH0g96QhPBnW+Do0d9JIqIlbaIW6dQqxjISs5mmm+7/zlMkF32JpLNMVc aE7g== 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=u/A8GOsSh+Y6aAjr5cTQO3SIudDIXhXmlKNyTmHxr58=; b=SE5x2w4hpM5DqzbHkvBncVWbIZKzn/Kgq9NvbcxLkHRJFT/2y4mnNjwoElDPV3MbNV 0aZ9RcfuDVf5tlZs6u+IG+wsSTaGgZWP4GAXSrpjw2ZrSIMWzk3PJ8qsqkaEu5rNrP1c gcNX5lIQla0AwHFsfd4/ZXZIVxZD13UPb04hi7l7U8Yv0+WJaczjb2NnOMTroSooEEow iH/LH5j/4LWXI6H03JqQZY6FsItowcXhjtiJAb3phFbvjeFLqai4CYT288qFEfVHp+3x wXP7XjFuXWzrEC5RJVxICmfNRJH6H5QtEJKrx2vlR4tvqoTYgdhEa2Hlr/gL8O0UITHY UhkA== X-Gm-Message-State: ALQs6tCUm7S2pnDBLuNLZbAlCdUQ2T8sf1YZOzUcL30MMoL96biUad2+ R063OuX+23ejv8ZF8AN5Uds= X-Received: by 10.98.225.20 with SMTP id q20mr182933pfh.142.1523363041698; Tue, 10 Apr 2018 05:24:01 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id y15sm5265732pfb.37.2018.04.10.05.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:24:01 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 3/6] staging: rtl8192u: Replace GFP_ATOMIC with GFP_KERNEL in prism2_wep_init Date: Tue, 10 Apr 2018 20:23:54 +0800 Message-Id: <1523363034-30892-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 prism2_wep_init() is never called in atomic context. prism2_wep_init() is only set as ".init" in struct ieee80211_crypto_ops. The call chains ending up at "->init" function are: [1] ->init() <- ieee80211_wpa_set_encryption() <- ieee80211_wpa_supplicant_ioctl() [2] ->init() <- ieee80211_wx_set_encode_ext_rsl() <- r8192_wx_set_enc_ext() [3] ->init() <- ieee80211_wx_set_encode_rsl() <- r8192_wx_set_enc() ieee80211_wpa_supplicant_ioctl(), r8192_wx_set_enc_ext() and r8192_wx_set_enc() call mutex_lock(), which indicates these functions are not called in atomic context. Despite never getting called from atomic context, prism2_wep_init() 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/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 7ba4b07..b9f86be 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -41,7 +41,7 @@ static void *prism2_wep_init(int keyidx) { struct prism2_wep_data *priv; - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return NULL; priv->key_idx = keyidx; -- 1.9.1