Received: by 10.213.65.68 with SMTP id h4csp3831036imn; Tue, 10 Apr 2018 05:28:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49JoZCzNvfogMxmp2PCsCQfHOXNqt2OBfqOrjCcWKkzSPOI5ynzcPYxE3t0+T8KglLRbjEP X-Received: by 2002:a17:902:4324:: with SMTP id i33-v6mr183731pld.379.1523363316942; Tue, 10 Apr 2018 05:28:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363316; cv=none; d=google.com; s=arc-20160816; b=q6F5DD+MWCAHYEeCOBwI09OB1htHYR6JDhE55Mn6Nf2uym/qKoG5ZK++Odf/veETHy siHV6NxXSN0lwRpqrZzpEWm4Hw/U6KLrq0NiFO5l6lLM3YSANFakkZoYsaJUL0sM/UmQ L88t1HyNSj0H3NF5uCR7Fc+kW7dexrJDxP8bBRCUU5JRgsmTVWGNKMmQpf88YyRYWDPN QaTPsK6d7HPDDo5rYtqcfBnCpOC16tkxrR+SMyM2b1YjzA1v6ur1cioBvBvsFJfJ5gL6 o3J9fWqTc+hGim3DLxyjebmVjuuoS5Z6A/CcNBQPgeUOYSjlWBNuVDeS5YTgejvdgnWF QDeg== 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=yaXJLnV9gFEtimlCHSa0mTAqhFxmkyz+0KVQ5DLuN2A=; b=Ya/U0DRLjhGhZfD2RXdmJqmJrSZOIJISRkkUSHTCDUoBX+MEP5HR61AUB6YZHu3AUq S/t93irMTGetPVlr/q2thtGWZ2H3nAlnXTxNz0FORzl8C5vBdgsOdkBcnRUaAhYiAPE2 JIpvwIi5jvtS4Znm5aFmdu2DhQbMhaU63rawfmkuESEWQm6LWNQacCmmd43u7a9sjuLP Jk+vpDBOOUoSE4CtNcnILGLzdYKrSza4jKU5xDZxuceQ/FjnjvF8itoZd2F49TCUrB+/ LSAFXylEoDH1kNUriuTFPYxgslbXhl2eF8ARVDMNxdua6dvpYTnhJZBc8/68GRefJnIo eRuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IXyMjKsD; 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 k63si1794063pgc.290.2018.04.10.05.27.59; Tue, 10 Apr 2018 05:28:36 -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=IXyMjKsD; 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 S1752881AbeDJMYc (ORCPT + 99 others); Tue, 10 Apr 2018 08:24:32 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34066 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbeDJMYb (ORCPT ); Tue, 10 Apr 2018 08:24:31 -0400 Received: by mail-pf0-f193.google.com with SMTP id q9so8171266pff.1 for ; Tue, 10 Apr 2018 05:24:31 -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=yaXJLnV9gFEtimlCHSa0mTAqhFxmkyz+0KVQ5DLuN2A=; b=IXyMjKsDucCRrwwn5W/mc26AUVZIH1lCdqiEsNJRjmgW6cAE2ocUkl7pncyHacOsSi i1K0Y8INi5N6lhdckYbgXcKq/FAHSbRSvRMR4/t3MKN7rl/0yw3N3IkszG1l9TlTx020 QES65OmxWO13AaJXURmfTxXoSuk8C6WP9SNecyJUx28P2IzntUlpdE2culK1L/fZPUIA qFCBq1AIG8guFaN+KsZIvtjWkihRYA1iY3eWj/dPBQ//iyzV8/QKM69c2bUMmXreud1J DANAxtMChXgGxwpy8SyKc/DvkwaQMQp8b8n3+A8jG0MH2zlxB8r8oa01IZaVNjOUqvHu 89dA== 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=yaXJLnV9gFEtimlCHSa0mTAqhFxmkyz+0KVQ5DLuN2A=; b=k/0oHM4l1wq7YXBkkwFmKlTbCD3U9MYy7DAeKgDhPeWGKxhS3LhetregS4g8hnpR9l g42Je5Oggevawg/XVdcEScVT9DE63ZXQ7dzHS+S+PeLe+jafK661wp9gWf7S4RxPXejp 2DRUjrVEtoCtrsDreD8qgKCIy6gKFZEe77GXsAnCLaiCS0LOVisvgYGXg9agKM1pnC1x DhSH9RgtBV2fkV4Qq/o7hEf+SZIqC43xw/XLZgQen7wsrql786lLDL5HsTqVnExmZf01 yJMDpXhYK1xxTUci7Y1TFKmeQ3BnDYJ2vYqygAo5teS+G2dEyOaanNe4LdagjDLbuE52 a9xQ== X-Gm-Message-State: ALQs6tBoEk/IWLGCxJKvcyWaiGSNLTemwA/jBvUkvmMzusKhpoYVYdHu cV2v+YD5XSs4xAWnPNZJRg8= X-Received: by 10.98.13.71 with SMTP id v68mr161191pfi.69.1523363071035; Tue, 10 Apr 2018 05:24:31 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id f86sm6037938pfk.153.2018.04.10.05.24.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:24:30 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org, davem@davemloft.net, johannes.berg@intel.com, Linyu.Yuan@alcatel-sbell.com.cn, stephen@networkplumber.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 4/6] staging: rtl8192u: Replace GFP_ATOMIC with GFP_KERNEL in ieee80211_softmac_init Date: Tue, 10 Apr 2018 20:24:23 +0800 Message-Id: <1523363063-30950-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_softmac_init() is never called in atomic context. The call chains ending up at ieee80211_softmac_init() is: [1] ieee80211_softmac_init() <- alloc_ieee80211_rsl() <- rtl8192_usb_probe() rtl8192_usb_probe() is set as ".probe" in struct usb_driver. Despite never getting called from atomic context, ieee80211_softmac_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_softmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index fe6f38b..cb4a2ad 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -2682,7 +2682,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) for(i = 0; i < 5; i++) { ieee->seq_ctrl[i] = 0; } - ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC); + ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_KERNEL); if (!ieee->pDot11dInfo) IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n"); //added for AP roaming -- 1.9.1