Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp8039ybt; Tue, 23 Jun 2020 13:52:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz25T+CDY7zjy2ENuTH8C2x6mbjOnyRQZawzbvbbU9ke5rtJEAd//iQ7Zwx535W0YaZNPV X-Received: by 2002:a17:906:7f90:: with SMTP id f16mr6590079ejr.507.1592945526375; Tue, 23 Jun 2020 13:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592945526; cv=none; d=google.com; s=arc-20160816; b=br3qSuAUjhCmGbwH44Z8KIL2KNUSzJLaftyVF2VClhf6m4TKjt0O4rSZ0RmwM7A4lT 9/IYhJ89Y0mnGheK3MKfHWG6hbFsgGDJK1qErMHmb+AKF7MMlZCqkyaZNisv4Xg1bU+E 0C7ilVO/Ltj5blWWEwYmLX9n/FGN9xe02qODaqFCm1SASBOdHHlBgRur12vEMsF61+Ce exnfvtJrCfGwYw5dcaktp8bdTyeoRclRw3pq5vINQWE+9heUrUY+RHz6ztakxK5rMl4R /MBA59xzsgOR2ZeEHWIQFgWnFa4ZWwPvFUFrRMHhYjiLRcZjkK2UPh2aLwWQjSoBRVjg nsHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=B4hBhw4t37Apt3HaVEH2GTBhPAABUMPCu0cqN+zbixg=; b=o7Mv8zLyfCx+G5CmAQh/yBnn9QuiRpvCerR/s+vrO6LKO6bj8N2cxcd5izAiv7UHGZ R5t1EAz5tWtZQt7wlFVN6cQ9V1ikfgPY1I6B2c0HDxh7OpBwru3t2DYZsgAgJVGgjxVd tF2nAGC7am23WnPIageG6Ql8Oxj2vZfAsJxfuPFL+cInC0rPOLlH5lJxXkX9WQHckFP2 SWSpYmsgt01ty+IRum3Pd1RuRbfd+pbsVi6bAZt8Uhbu+0WUcHsWk5QPdtDG2Oh+H7vZ XSSlYrruVvgP78JABjYkLkAt85V5sn9d6MRoAOVt215DL+dnZqOsSrV6Xr7ulzmc6f8k jvcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Crr6UFiw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si13193185edb.116.2020.06.23.13.51.43; Tue, 23 Jun 2020 13:52:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Crr6UFiw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393150AbgFWUu0 (ORCPT + 99 others); Tue, 23 Jun 2020 16:50:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:49752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404143AbgFWUuK (ORCPT ); Tue, 23 Jun 2020 16:50:10 -0400 Received: from kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EDDE72145D; Tue, 23 Jun 2020 20:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945409; bh=n3Dwo2ucZ0JQxiocnRaLLDeGlCzh4hohybtbn2oJiMA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Crr6UFiwqsiN4Km8Ra7FSY/aeoxMjRRnq7id5zOD+eMKMaql6akRAtOOt5QX2UTAv KdJMIh1VoOE4k+cS0H+bS2UZciGUE/7BM4xad87ywPxneYmMrAW0XBJXmYrh/HHWY4 tJSsYSktkna61XWn8xc2SL/wcKg62kgVvG7PT4uA= Date: Tue, 23 Jun 2020 13:50:07 -0700 From: Jakub Kicinski To: Kaige Li Cc: "David S. Miller" , Christian Benvenuti , Govindarajulu Varadarajan <_govind@gmx.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Xuefeng Li , Tiezhu Yang Subject: Re: [PATCH RESEND] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint() Message-ID: <20200623135007.3105d067@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <1592899989-22049-1-git-send-email-likaige@loongson.cn> References: <1592899989-22049-1-git-send-email-likaige@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Jun 2020 16:13:09 +0800 Kaige Li wrote: > 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 I don't think this is sufficient. Calling open with a spin lock held seems like a very bad idea. At a quick look the driver also calls request_irq() from open - request_irq() can sleep.