Received: by 10.213.65.68 with SMTP id h4csp3829138imn; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx48KXKcJCKLDo+k11mCR0XZy1Cgeg2y3ws3X7JOgLZpM+wiZ3Axgz2sBLI6IlpVnDshaDe3z X-Received: by 2002:a17:902:86:: with SMTP id a6-v6mr228420pla.298.1523363211858; Tue, 10 Apr 2018 05:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363211; cv=none; d=google.com; s=arc-20160816; b=EgpYi2cCoPJMEmrqZlhjYTxEQuO3MhTtNlaB8wl7AfPoVcHvh0eYLT6sBUHMySg/mi jePvpR1ep18ZescC/lWt1isuwk5rxDLScTCZhezxwQd8nld7cE/IG9SP2UBRaCVFP7Lp mqcVCeG2O/bS19YZGDJhKTeyw8s9iPv3n9mf9YkB7/3wwBLYX810G497yIo7Ni9d5tou O5f2MZd/rXefGZN6SqGx7EOkfs4TswiH2peA2jSnjAaRx3BcI4o5r/HjdnUXl0CIfvpB pMw+MVe5WMrq6OJezdoOSIdd/7KmzSwWAiKqkJl6Xgao5cUKeB6Euawq1In0uVJDdsaE ckcA== 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=uGBmd9EiyAEfFV3p5+Jzyh/llZbaN1tUJbMJj5XyEdQ=; b=tyW28kvyDIHtbZ6pQ2jYWYu9BlYIvwldLGc1znguhM8Q1zCHxMXLTlm0OzaoVIuyH5 79sWBOTasJnaud3Oe2DDkVx2fjlgcgnSQ/bVJvct0ixqPgyC6rTA7CjV0UrEAHO1uWET ncUlYd0jpHFT2lZkGPEXurDmIF3FUdPp8UWb7JdBMyAQRCuHGvL1BzJ6AZQ6RLddfXYV IgA8g0f0Arn6REN4senzlC9IyagK8mpG2AE92DSYcwhoWuDxPyNpNu5ZHUGOPgrYUH9E O+w4ogAtllYvUfdnY68Lm5c+G9/wXlK8uj6QOTiqLsGL/KkNaJh7jTv1uGGnl2NZZpK8 Lvqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uE2Hb0qN; 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 f35-v6si2543831plh.691.2018.04.10.05.26.14; Tue, 10 Apr 2018 05:26:51 -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=uE2Hb0qN; 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 S1752690AbeDJMXJ (ORCPT + 99 others); Tue, 10 Apr 2018 08:23:09 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:41399 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbeDJMXI (ORCPT ); Tue, 10 Apr 2018 08:23:08 -0400 Received: by mail-pf0-f194.google.com with SMTP id a2so8154798pff.8 for ; Tue, 10 Apr 2018 05:23:08 -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=uGBmd9EiyAEfFV3p5+Jzyh/llZbaN1tUJbMJj5XyEdQ=; b=uE2Hb0qN8f4tc9T80wGwhXJBWas9We3IEh8uGDa+2+m8jx83YYIz+IRX5SJJF+exec n98/Emic3hABZb7UehD+Bd1u4dZgTUn2snRbMgcGOnJXfthTzEwQ4AvZivy/O9Y4ecSW MpI2+30r6owDIzJXMW5gjjtsl0JrYoJisFnCz/OK1xbXS0CWPnlHjw8xsa4G1LKzrxcI HiEbTzJxcjpgpTMGJjmsxhpT7whjVTE79WQsa2eDuZgWN952TuDqr3k2ZAdco54QghnU BEMbPRrQ0y0R9slV831wvA71OPiAK72vmgkGeo7bs/V8d1JBFqQx/gP/FofZZ907YGas TvNg== 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=uGBmd9EiyAEfFV3p5+Jzyh/llZbaN1tUJbMJj5XyEdQ=; b=lHLQnNaBU2bZ0KsuoqeOAnOW+wVVN+kGxct+B/9XhMivlUpFiCFu0gAaiZ+vSbPo++ +Yz686JhHOQDc2Tpg1BpF7SCA2xFty4sQ96jidG5XcW7at4CFnQ24n5/PVfYC0PsvHZi HYpeUUOFwRgX+TfMesEeurtscckN1KLa/fPXb6GpoMe5g/q0GmUrjt+3xf8tH4IYr1RJ qYkEqX4vo+DRLEvbQ6azoaK4X3jrpxDUGawkYFSd12qLSNUv4QmSd5bhpFre11NNZiaX Dd7zb82MyXC5ndbovB8rMIc4JOSf4AUhZYLLo4G1npJPx9pDt6Msdrbs+/vF/7CikneP c/bA== X-Gm-Message-State: ALQs6tAF7CgN2tHUThnvyJd7qvahpkGvL2oAbF4PNzx0T0xtjf5bO43n V+CSViXAsgEQ/wlcajDZTtU= X-Received: by 10.99.167.6 with SMTP id d6mr114982pgf.287.1523362988172; Tue, 10 Apr 2018 05:23:08 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id o18sm5150859pgd.59.2018.04.10.05.23.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:23:07 -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 1/6] staging: rtl8192u: Replace GFP_ATOMIC with GFP_KERNEL in ieee80211_ccmp_init Date: Tue, 10 Apr 2018 20:23:00 +0800 Message-Id: <1523362980-30800-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 ieee80211_ccmp_init() is never called in atomic context. ieee80211_ccmp_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, ieee80211_ccmp_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_ccmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index e6648f7..a8d39f1 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -66,7 +66,7 @@ static void *ieee80211_ccmp_init(int key_idx) { struct ieee80211_ccmp_data *priv; - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) goto fail; priv->key_idx = key_idx; -- 1.9.1