Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4375497imw; Tue, 19 Jul 2022 05:36:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uBjvrivHxo+E0rDIXO7R9Nd0Tbzuw9Sb/f2QjXWm7a8uRB8GfO1gNM22dFiC0vQP8LC+jE X-Received: by 2002:a05:6402:510a:b0:43a:91ff:3f4b with SMTP id m10-20020a056402510a00b0043a91ff3f4bmr43530011edd.187.1658234212394; Tue, 19 Jul 2022 05:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658234212; cv=none; d=google.com; s=arc-20160816; b=mDjiiO3vjJ1KnvmhipUfrWrBvZvwzejrRlF0MWkIfEtgbFftUactbPCLOoIzZ5ZCig pQPBAmTyIxWQzeBFjjhAPevR7VfRezFWYAx6uiFBTEa1BBGpprS6hcT7kfYtLPAtpSat bPiApyP9vuHKxRJIAf1X+8gVmL6dD5sgh+/v9IIts+3gYbcBE6cPpbdblsQleGcab/xt KXweIv7qtyI9X4Bj9jROcWcnH2gua336xTGIWZaeXhEvprr3O771khmVlsC02kLnj9AK rPAbhrHPjDdpO7U7EBQF+zfs6r8YaILk1+STxpSOCR6Bap/e0jr3AXQyEamqrVdg+iu2 4IzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WCHP7xsKRBYmfmCH9Xz4FltqG9WfFvEPgEBSHVPLddg=; b=rFI8OF72I9PZHvxB8TwUxj97RQcq7n02iy04sR7EqFrEJffnLzPXpnsMH/ECv3ixHB Tg9kFzfNfudaQFa+r6niMbyhmBJnw7cKZPppnaWc4iO9X/Yd+8ADix7crCU6yN3ZFZIe R7VLdDyQ/qDtoUcq381jSjX+5hhZ3uX0mxXhqmE+6Kitn89JF08Fzu7g9kZHl4Hwg/vr wjheBiJd+n5q3AsvzdoUKICjTv4LFj/rQoJpoLEoAmLQkcViBhgSfc70erPJf1y6ZQqU Lx3woWAQRNCKPhLCiOYNhWnh0uMBVR3fVfNvwyuk3Q7hXjq5tD5EYKPFh8mRx9GUaQ+U lQuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wTNU0yWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a05640208d600b00437dbb4d30bsi18612613edz.208.2022.07.19.05.36.22; Tue, 19 Jul 2022 05:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wTNU0yWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239705AbiGSMZZ (ORCPT + 99 others); Tue, 19 Jul 2022 08:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239735AbiGSMYP (ORCPT ); Tue, 19 Jul 2022 08:24:15 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F9661135; Tue, 19 Jul 2022 05:09:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 295DACE1BE2; Tue, 19 Jul 2022 12:07:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E692CC341C6; Tue, 19 Jul 2022 12:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232476; bh=TowrKb8G5TdIC9gGhKJdMt+9W5rjZOZsSfutDb6ykYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTNU0yWgFePoSL6JndgnQ4CRRBV31yqlAemdcUaIAMl2Y4y4xUpYp1zVY8iND/Etb MGd4X3jV/MYyUM7e4BIj8oCN2I0WJHQUgegQ6Tu28jzSRx9A//Rn9w4XVtK/CGAgQJ ldOPb0PPm2xoBIYHYoKveLko5NAX8D9m/dz++R18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ma Yuying , =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= , Edward Cree , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 071/112] sfc: fix kernel panic when creating VF Date: Tue, 19 Jul 2022 13:54:04 +0200 Message-Id: <20220719114633.349673504@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114626.156073229@linuxfoundation.org> References: <20220719114626.156073229@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Íñigo Huguet [ Upstream commit ada74c5539eba06cf8b47d068f92e0b3963a9a6e ] When creating VFs a kernel panic can happen when calling to efx_ef10_try_update_nic_stats_vf. When releasing a DMA coherent buffer, sometimes, I don't know in what specific circumstances, it has to unmap memory with vunmap. It is disallowed to do that in IRQ context or with BH disabled. Otherwise, we hit this line in vunmap, causing the crash: BUG_ON(in_interrupt()); This patch reenables BH to release the buffer. Log messages when the bug is hit: kernel BUG at mm/vmalloc.c:2727! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 6 PID: 1462 Comm: NetworkManager Kdump: loaded Tainted: G I --------- --- 5.14.0-119.el9.x86_64 #1 Hardware name: Dell Inc. PowerEdge R740/06WXJT, BIOS 2.8.2 08/27/2020 RIP: 0010:vunmap+0x2e/0x30 ...skip... Call Trace: __iommu_dma_free+0x96/0x100 efx_nic_free_buffer+0x2b/0x40 [sfc] efx_ef10_try_update_nic_stats_vf+0x14a/0x1c0 [sfc] efx_ef10_update_stats_vf+0x18/0x40 [sfc] efx_start_all+0x15e/0x1d0 [sfc] efx_net_open+0x5a/0xe0 [sfc] __dev_open+0xe7/0x1a0 __dev_change_flags+0x1d7/0x240 dev_change_flags+0x21/0x60 ...skip... Fixes: d778819609a2 ("sfc: DMA the VF stats only when requested") Reported-by: Ma Yuying Signed-off-by: Íñigo Huguet Acked-by: Edward Cree Link: https://lore.kernel.org/r/20220713092116.21238-1-ihuguet@redhat.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/sfc/ef10.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index fa1a872c4bc8..5b7413305be6 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c @@ -1916,7 +1916,10 @@ static int efx_ef10_try_update_nic_stats_vf(struct efx_nic *efx) efx_update_sw_stats(efx, stats); out: + /* releasing a DMA coherent buffer with BH disabled can panic */ + spin_unlock_bh(&efx->stats_lock); efx_nic_free_buffer(efx, &stats_buf); + spin_lock_bh(&efx->stats_lock); return rc; } -- 2.35.1