Received: by 10.223.176.46 with SMTP id f43csp1918707wra; Thu, 25 Jan 2018 02:03:18 -0800 (PST) X-Google-Smtp-Source: AH8x224KE7X/dZwGnRNU4SaaNIY/WPlBIdvuq8oPXXC/jW3ID7JreztyNUcwf09Bw8jG/oYnp59L X-Received: by 10.99.125.78 with SMTP id m14mr13097956pgn.383.1516874598144; Thu, 25 Jan 2018 02:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516874598; cv=none; d=google.com; s=arc-20160816; b=rl/+kmvo4hYYvsfdKsY1+28E+Di5fCsW4ANyfTOAbq3UltHOPeSU35TDzChQ3Nf7r4 u3+M5LqJEkzOcCNoc23yws2/yanH8+x3EFzEQ+ghohDfYrj03V5KlrO4EareTGKs3sAF mM+7RQsM0B95IYTpWrVR5RwKRZIhZUUhxzEoMGb9MkOu9wYwKUjmng6a0MCyuDfIcfcu eLsD94e6d3mqlruXNGMLBAtXJ8Tgsb/6HZwWovWKZ4Kqzj0BsjmdNRUiQb/GG0+VcRoU 3zewDaPe3BvmXRd1AyHXESl7hnAYQGMc4BW2GC0+GNe3aWEJnSPGxoPCBj8o87EssUos ShzA== 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=8URkHNlcoa4rHfFcRZZN4rkcuNZZk54ZrG8WeLln1qo=; b=Q6RjIaMW7DL6t5/yfF5zDf2Uq9STDLQkIHN/fPshQkgjoMv9NwKsdofKff5oPFnrjt DzALDySBeg1vlwvR1uHYzN66wkHfc07UaooYMAX82YAYriDA/lUKcmv+0yBxSRLMgjiS RFuKu7MmEIo0WLYX5Xfl4msVTBhK9+GFPdZcLfQvtuQZEA8GmxKdf4ZhsmbJw939kKpf gM6NM7cHDwegkWk/HIEWzH/fACf0bN0NpXDBNBldGnIf2POMWMX1MLLDpabtsqaDk1pC llrq1V5fI91Rok14/9vkHZa3bc4J5MSylHlJUc5xRchHhhMsXj5mSCjHIqEGZsBqWjBn ZmSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Oc2Yhpwf; 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=NONE 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 f3-v6si1718442plo.610.2018.01.25.02.03.04; Thu, 25 Jan 2018 02:03:18 -0800 (PST) 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=Oc2Yhpwf; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751647AbeAYKBf (ORCPT + 99 others); Thu, 25 Jan 2018 05:01:35 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:37290 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751642AbeAYKBb (ORCPT ); Thu, 25 Jan 2018 05:01:31 -0500 Received: by mail-it0-f68.google.com with SMTP id q8so8701004itb.2; Thu, 25 Jan 2018 02:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8URkHNlcoa4rHfFcRZZN4rkcuNZZk54ZrG8WeLln1qo=; b=Oc2YhpwfLPkFIoh2uAOkqkSV1I6ke2O3YN3eOGXR5vDjfcWoqrDp9MezoDf3mvhQg2 rovNfuC5lF84zfiDdB4POyOZt9OKuv+s+Jn4jTZ/5r1Igr/GCFlx61nSrgXr9OYwp5Ux pO9v1hNJ9fE9igl3w1YI5MVY8eCRweOPNNRzjPi0n7ISzKoK8+4rChbkfDrZDn0bPaoj Jl5PUoRV2+5D8HsMqb8bBe7tXhpe+9fMPcA2DP1noUWToeUoXQS7F6210TKiPZ5CvZzT P/ABG5/L7I57czbW0OiUJEd72HQYpugzT+rap0b2MPd5dyAP5qHYUQgV1Bpdln/l+s8O km2g== 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=8URkHNlcoa4rHfFcRZZN4rkcuNZZk54ZrG8WeLln1qo=; b=mDNyRalUCyC+2teXAl1xu/jESKJG9JgbSDkKZFK3XRg0yWI+EQsI2h++9Hn34tU4im MJ9Y62RcuA70cRMn6nF555hz7Ax7bRU2q3AUdosV30rBQ05l8mM8aA8qRTx6hjmOD2Ci 96WbwBFiU+aeU72T+KmyjGlpOD8/081bat5Iou4ZSoddAARJhF8+mrdUy0r2PJAxlpPj 6UgZ0UTEg4IUnnaZE0WOtl5IU/REh5ms0tUr4kXl1rMIecEHZ+pGNS1PWWkRBjMsX9HM tKlTarUs+kV48FC/T2gOVcsttki8J5Bulr3jKIRKfUkLdU50c7Sn4mHNOr8trlmwEmjt G1YA== X-Gm-Message-State: AKwxytfKGFhSuwpSte3N5baDASLuQYhtBqZ8L4hjz62iaXw5EYn5YxDp dz8XKfS8kfwd9pkIfank6dY= X-Received: by 10.36.91.210 with SMTP id g201mr12338541itb.50.1516874491108; Thu, 25 Jan 2018 02:01:31 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:9980:256a:8e6d:5903]) by smtp.gmail.com with ESMTPSA id v2sm1479613iob.72.2018.01.25.02.01.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 02:01:30 -0800 (PST) From: Jia-Ju Bai To: herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] crypto: crypto_user: Replace GFP_ATOMIC with GFP_KERNEL in crypto_report Date: Thu, 25 Jan 2018 18:06:02 +0800 Message-Id: <1516874762-12046-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to crypto_report here, my tool finds that crypto_report is never called in atomic context. And crypto_report calls crypto_alg_match which calls down_read, thus it proves again that crypto_report can call functions which may sleep. Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- crypto/crypto_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c index 0dbe2be7..23baef1 100644 --- a/crypto/crypto_user.c +++ b/crypto/crypto_user.c @@ -271,7 +271,7 @@ static int crypto_report(struct sk_buff *in_skb, struct nlmsghdr *in_nlh, return -ENOENT; err = -ENOMEM; - skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!skb) goto drop_alg; -- 1.7.9.5