From nobody Sun Oct 5 16:14:15 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D62B13A3ED for ; Fri, 1 Aug 2025 10:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754043240; cv=none; b=bJx4rVNLCdxJNsmvyTa34HaeRe8RXZWA05hiVhN7rO0iDr++/B2B90M2/hCvVfXEG8a1ygrzXIU6SUxNWK+hE1FhevVG/6VmPqxiN4bp434fIFxCqK/MWVKZC6RjKSHr3cXZNgn4Vub/0SLKzXU3hXLBf8IBMhsuHdD5UWPfIro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754043240; c=relaxed/simple; bh=RxTq86rHJNrOa+BmajMZGiX1rV8aJVIqJ8sAET9PRL8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=c5opgAvHrYoqGL3HwJ2sXBY1pMMfiQRaK5z8gp6n++xBPN+MeYy6AjVZXa9mnyjiDFcZbUaaJYrQT1CDdRtdP54DVHXywXeB1ozhc/koSv6/r/n+QcJckxZplRLI+xNGNgCCnC52Ls1ar5Vef8LeM4nf4IwGz1g6Rmy9DSi795g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UIE8680p; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UIE8680p" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1754043238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3eQ5sa84X5wOi+N7HjGs5mDcZ+fhrm6LLTF2HzJMk3w=; b=UIE8680pvhwE9EH9dc+GW3jz5oC4Ajs9emCGzh8ILSuEa/SA/m4e80jZdoWrck4+AiwYlI sZJclpKwp9Raf2tHJAOF2zmk0O5NbgdXBUndHSBqH+p5XXK0FBmWQWPy3OjVi1bHpvVIyp i0jfb4vxodWH/nwYlDDXxwpQz0a66SY= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-HB9WZrOcMmKUW7-qz7w7Xw-1; Fri, 01 Aug 2025 06:13:52 -0400 X-MC-Unique: HB9WZrOcMmKUW7-qz7w7Xw-1 X-Mimecast-MFC-AGG-ID: HB9WZrOcMmKUW7-qz7w7Xw_1754043231 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 979CE19373E5; Fri, 1 Aug 2025 10:13:50 +0000 (UTC) Received: from rhel-developer-toolbox.redhat.com (unknown [10.44.32.151]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7A53B180035E; Fri, 1 Aug 2025 10:13:46 +0000 (UTC) From: Michal Schmidt To: Ajit Khaparde , Sriharsha Basavapatna , Somnath Kotur , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nikolay Aleksandrov Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] benet: fix BUG when creating VFs Date: Fri, 1 Aug 2025 12:13:37 +0200 Message-ID: <20250801101338.72502-1-mschmidt@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" benet crashes as soon as SRIOV VFs are created: kernel BUG at mm/vmalloc.c:3457! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 4 UID: 0 PID: 7408 Comm: test.sh Kdump: loaded Not tainted 6.16.0+ #1= PREEMPT(voluntary) [...] RIP: 0010:vunmap+0x5f/0x70 [...] Call Trace: __iommu_dma_free+0xe8/0x1c0 be_cmd_set_mac_list+0x3fe/0x640 [be2net] be_cmd_set_mac+0xaf/0x110 [be2net] be_vf_eth_addr_config+0x19f/0x330 [be2net] be_vf_setup+0x4f7/0x990 [be2net] be_pci_sriov_configure+0x3a1/0x470 [be2net] sriov_numvfs_store+0x20b/0x380 kernfs_fop_write_iter+0x354/0x530 vfs_write+0x9b9/0xf60 ksys_write+0xf3/0x1d0 do_syscall_64+0x8c/0x3d0 be_cmd_set_mac_list() calls dma_free_coherent() under a spin_lock_bh. Fix it by freeing only after the lock has been released. Fixes: 1a82d19ca2d6 ("be2net: fix sleeping while atomic bugs in be_ndo_brid= ge_getlink") Signed-off-by: Michal Schmidt Reviewed-by: Nikolay Aleksandrov --- drivers/net/ethernet/emulex/benet/be_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethe= rnet/emulex/benet/be_cmds.c index d730af4a50c7..bb5d2fa15736 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c @@ -3856,8 +3856,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u= 8 *mac_array, status =3D be_mcc_notify_wait(adapter); =20 err: - dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); spin_unlock_bh(&adapter->mcc_lock); + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); return status; } =20 --=20 2.49.0