Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3407960ybt; Tue, 23 Jun 2020 01:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgXbuvO+7KhpTXnVnL+C7pecPzpFBksRvRXLORk9cBasYkPhwbB6+NUyX5VcUGtuZA19Io X-Received: by 2002:a17:906:c443:: with SMTP id ck3mr9704952ejb.153.1592900253805; Tue, 23 Jun 2020 01:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592900253; cv=none; d=google.com; s=arc-20160816; b=SBSHqBNGcOw4E3N0kmrEbktsxcNBsfIxh2qUV28NMkThuXbn1ltqRQYFBtDk4rRZ51 2Gzcj+yIA24yGGuWDWFSxVt5itvYt+rJH5EsRiJtYjVR8LBv8CpM/IOUiLMJ9ac6xofT jOhKVOBblDNxnsE/5wzUDsyKcGlHxFINHztr53uX2+xM0gmG37ZyHRTol8p+F0aHFnVr 5gpepcxobQX56VLvlikfAgG+hDhuDMNKTyLSNwnWQJYaj2uVBQCXiU+ezi9k36wQfhTA x/T+ho9yppqItlQQpBsa5giCuX5BavgZq2yS40KEshzhSe0UXFZkZje7BWirSp7BCpzS HiCw== 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; bh=lmi1Ubv9ZT54J7jT4Lri+FoOxO+hkHBgi15wQZhuvKY=; b=NLUve4tb1TG0U7tt/kVM4gOelF5CO2ToxJifYdAsQEPAjoBdRY+VNUShyHAb/55gpD 3mgJ8WoAqbVS1XTk6e4f3sSR9u3xk7NtTSOUOijQgXZFZHljTUM88U+A3v1uBacFgnIE PcQiYvg63NmmxnZ6ABONB0bdKjRFrwdz3zQI541K17YTbE4I7mzSpjM3q88qNXn3DXM7 vKiFweXs/oz8g2NbcPgwR22IUuNbaKN3QJ6atWHf3E3+ijy2Dxs9IClVN2uWsD6LjJL7 5cbITY2ykMb69HB9JZodhUgHCTAwsbOENLqnXkzya4wfz6CAsqgTGcZyPmSwiYRHWOm9 sRTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n16si10791528eja.95.2020.06.23.01.17.09; Tue, 23 Jun 2020 01:17:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731626AbgFWINT (ORCPT + 99 others); Tue, 23 Jun 2020 04:13:19 -0400 Received: from mail.loongson.cn ([114.242.206.163]:33466 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731158AbgFWINT (ORCPT ); Tue, 23 Jun 2020 04:13:19 -0400 Received: from bogon.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dxj2uVufFeEK1IAA--.8S2; Tue, 23 Jun 2020 16:13:10 +0800 (CST) From: Kaige Li To: "David S. Miller" , Christian Benvenuti , Govindarajulu Varadarajan <_govind@gmx.com> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Tiezhu Yang Subject: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint() Date: Tue, 23 Jun 2020 16:13:09 +0800 Message-Id: <1592899989-22049-1-git-send-email-likaige@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9Dxj2uVufFeEK1IAA--.8S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Ww4DurW5Aw47Wr1UAFykuF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Mailing-List: linux-kernel@vger.kernel.org The kernel module may sleep with holding a spinlock. The function call paths (from bottom to top) are: [FUNC] zalloc_cpumask_var(GFP_KERNEL) drivers/net/ethernet/cisco/enic/enic_main.c, 125: zalloc_cpumask_var in enic_init_affinity_hint drivers/net/ethernet/cisco/enic/enic_main.c, 1918: enic_init_affinity_hint in enic_open drivers/net/ethernet/cisco/enic/enic_main.c, 2348: enic_open in enic_reset drivers/net/ethernet/cisco/enic/enic_main.c, 2341: spin_lock in enic_reset To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. Signed-off-by: Kaige Li --- +cc netdev@vger.kernel.org drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index cd5fe4f..ee62065 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -122,7 +122,7 @@ static void enic_init_affinity_hint(struct enic *enic) !cpumask_empty(enic->msix[i].affinity_mask))) continue; if (zalloc_cpumask_var(&enic->msix[i].affinity_mask, - GFP_KERNEL)) + GFP_ATOMIC)) cpumask_set_cpu(cpumask_local_spread(i, numa_node), enic->msix[i].affinity_mask); } -- 2.1.0