Article View: linux.kernel.netdev
Article #20781Re: [PATCH net-next 1/2] ibmveth: drop TX on a queue whose long term buffer was freed
From: mingming cao
Date: Mon, 23 Nov 2026 07:31
Date: Mon, 23 Nov 2026 07:31
86 lines
15959 bytes
15959 bytes
On 11/22/26 4:44 PM, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 1 · Low: 1 > > If you believe none of the issues are legitimate, please reply to each > issue of Medium severity or higher and explain why the AI is wrong. > If any of them are legitimate and you plan to respin, please let patchwork > know by including "pw-bot: cr" as a separate line at the end of your reply > (one such reply per series is enough). > > - [Medium] The new NULL check in ibmveth_start_xmit() > (drivers/net/ethernet/ibm/ibmveth.c:1312) depends on the sender seeing… > - [Low] The patch treats adapter->tx_ltb_ptr[] as lockless-read state. > > -- ... > [Severity: Medium] > Is this NULL check ordered against the queue wake in > ibmveth_set_channels()? > > netif_tx_disable() takes and releases each txq lock while it sets > DRV_XOFF. The LTB updates and the wake come after that, with no txq lock > held: > > ibmveth_set_channels() > netif_tx_disable(netdev); <- all txq locks dropped here > ... > ibmveth_free_tx_ltb(adapter, i - 1); > WRITE_ONCE(adapter->tx_ltb_ptr[idx], NULL); > dma_unmap_single(...); > kfree(ptr); > netif_tx_wake_all_queues(netdev); <- test_and_clear_bit on every queue, > including the removed ones > > A sender still using a removed queue, such as AF_PACKET with > PACKET_QDISC_BYPASS, goes through: > > __dev_direct_xmit() > HARD_TX_LOCK(dev, txq, smp_processor_id()); > if (!netif_xmit_frozen_or_drv_stopped(txq)) <- plain load of txq->state > netdev_start_xmit() > ibmveth_start_xmit() > ltb = READ_ONCE(adapter->tx_ltb_ptr[queue_num]); > > The writer's last txq unlock comes before the NULL store, so the lock > does not order that store against the sender. The only link between the > two sides is the fully ordered test_and_clear_bit(). On the reader side, > its two loads are separated only by a control dependency. That is the > MP+fence+ctrl pattern, and both LKMM and Power allow it. > > Could a sender then see the queue as awake, still load the old kfree'd > LTB pointer, and memcpy() packet data into freed memory? The window is > very narrow, but nothing here seems to rule it out. > > The grow path has a similar gap. ibmveth_allocate_tx_ltb() stores > tx_ltb_ptr[i] and then tx_ltb_dma[i], and ibmveth_start_xmit() re-reads > the DMA address later with no ordering: > > desc.fields.address = adapter->tx_ltb_dma[queue_num]; > > ibmveth_free_tx_ltb() never clears tx_ltb_dma[]. Can a sender pair a new > non-NULL ltb with a stale tx_ltb_dma[] value and post a descriptor with an > unmapped or old IOVA? The commit message says this case is handled: > > On a grow, that sender could otherwise see a new LTB before it is DMA > mapped, or one that the failure path frees again. > > Would any of these close the gap? > > - Call netif_tx_lock_bh()/netif_tx_unlock_bh() after the LTB updates and > before waking the queues. > - Update the pointers while holding each txq lock. > - Do not wake queues >= real_num_tx_queues. > > [ ... ] I'll send version 2. it wakes the queues under netif_tx_lock_bh(), and only publishes a new LTB pointer after it is mapped. pw-bot: cr Thanks, Mingming
Technical Details
Message-ID:
<45443018-951c-452c-a3e4-383b7b9a9cb4@linux.ibm.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369107-linux-kernel-netdev=dewy.ruReferences:
<20261119000235.15622-2-mmc@linux.ibm.com> <179539467281.3135.6706630717389291385@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369107-linux-kernel-netdev=dewy.ru
From: mmc@linux.ibm.com (mingming cao)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 1/2] ibmveth: drop TX on a queue whose long term
buffer was freed
Date: Sun, 22 Nov 2026 23:31:33 -0800
Organization: Usenet Network
Message-ID: <45443018-951c-452c-a3e4-383b7b9a9cb4@linux.ibm.com>
References: <20261119000235.15622-2-mmc@linux.ibm.com>
<179539467281.3135.6706630717389291385@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="3817419"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:bHbnbpPFw1PY2RhH3eJ+KNOKq18= sha256:uTnNAElp3IeIKfjsWQo9A0LvBC7xtKDIHl74+H6AAVM=
sha1:MsULzYyx081+MgX0ZLRL9jbt8Vo= sha256:ETD6P/jkKituJPjjJbuNXCJAMutfsjfzPbrMmM5Z1nk=
Content-Language: en-US
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 5059B125D94; Mon, 23 Nov 2026 10:32:37 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=ibm.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id Cf3r52Ln5TJq;
Mon, 23 Nov 2026 10:32:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369107-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=linux.ibm.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id A8730125D93; Mon, 23 Nov 2026 10:32:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 5F3682CC8D; Mon, 23 Nov 2026 07:32:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795419137;
b=k/REG9PVA3sBFKayEwbjR6z8BvEaV73tWN7vAKJOd+fiCDr3qloCUyXGLYb1HeVBPNie
5gK2XQmUfRdqmSmaYtDqXEyFYpLDnnYnzt3mIhO6FyRVtAC09HDWSvGSHzefKRJUJqcaD
AVErZdRRhu8B8/zXQF9XJSdG6m0zesu90KM4wcfC3WaLEiZoi1UxBTFRgyeuDOd2429l/
0pb+z90DxLRaWS2pC39V6C/RHGExvc/1YV6GJXuv2tQEToVjt9ma221QkPYU1Yxo6k3um
j2eBtWOyBvoESmJOlOMxrcKPBhp7k8MS4olMi5E1iNd46ywQOjxPOOT8fpecPPu4lpg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795419137;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
Received:Received:Received:Received:Received:Received:Message-ID:Date:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
Subject:To:Cc:References:Content-Language:From:In-Reply-To:
Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
X-Proofpoint-Reinject:X-Authority-Analysis:X-Proofpoint-Spam-Info:
X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:
X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
X-Proofpoint-Spam-Details;
bh=3hHzv9Q9OnZbjwI3vCzRnxwHM3TQIwftV3QfNN0qDtQ=;
b=my/4qMQT4Fumi0Un2bYh3Gk+pPEcsFdHfPxEwhgnr8aM6rJxIdyhM8oAoVjdvgexsWPz
tyPdVKWFUDwO4CINotsNGwcp2Akz+S3WtJ3PafOL28Dunbw+XA+oZb0pEljs2KKnVKLaa
gfgCFxE6mAxgJ04FOXDaWSTGT62oBmuDSnVu8AepPw370pyO/nHjH5PplYDPYBgVg7Asu
0mTjbYXJkw+4mNMwa6Lh3jgp+oM1LxlDOPI30NAGYq056SX/GHETOwu5g6l1uEQ2Nez0g
W2Gu+SCszCo98l22tMMt9nxE5B5gZyZsbNjmn1GzzAStFSOQisjIE1X4I6yMPZAEjgQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=HhOZC6Ti;
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 36D1E606A32C;
Mon, 23 Nov 2026 07:32:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=HhOZC6Ti
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.156.1
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795419136;
b=Q6zXDbfH0lEu550xxU2UGPNuBtukmipUdzK9lfo0jlCXXOJS+ld4p4iGHMpWYlnUe7DF
I9IaofoOG8gQ61R1zBmnLz9EwjdY9rgJU9nzBG5B4cz72s9VAEQ69dn3QW+JG7g2z85QK
du14+8dtsW7+5zJopeRfuaRYin3eBwRWGSkOHNY8q8AccCCKafQA4WyX7tNdRe6q3OO/G
4bmAlE9aNNQ6W5ZOx5Vh0nVUnowRm4tMeoMJ5MBg5clsIdsx4mR2yI1IMHLluNnx+2Y+6
dRV5rFgtw7YGgy/NmAItLKrmvfjdeG68BUkty8u902Izhc+4ciGnsEommQi846kzxTA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795419136;
h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received:
Received:Received:Received:Received:Message-ID:Date:MIME-Version:
User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To:
Content-Type:Content-Transfer-Encoding:X-TM-AS-GCONF:
X-Proofpoint-Reinject:X-Authority-Analysis:X-Proofpoint-Spam-Info:
X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:
X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Virus-Version:
X-Proofpoint-Spam-Details;
bh=3hHzv9Q9OnZbjwI3vCzRnxwHM3TQIwftV3QfNN0qDtQ=;
b=SSyqIdcy7cOIxtfA1nVsG0e4B1yEse8KQriqyA5RQ5T8DNIr5uwnUnZVvLTN3QOUX2e2
JIcBlwQ72+yq7OPVuiVuycIhZt1QNwX3Pmo0b9E6eftC9CKH4UcEPdqDhKPVu3uf/vBWQ
kBWgS4Q5amYghABtaWffnqkwoFSGeG1g2JUJ2vcHj0/cqG2K+v0IyqBqsyO4rwB4A/oJT
IIr08Rs5M12ZuhiisYzizC88AAxE7bfj4hMlF6LWNFTyBjnABA2zO3jLLmCAJC2sgeWmc
WXOTJQcH12t3Eadvas/s9tJUuDw9l1NFKd6vK57HQQt1DIv2YT+pau0ClAsoLWVSyiA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=linux.ibm.com;
spf=pass smtp.mailfrom=linux.ibm.com;
dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=HhOZC6Ti;
arc=none smtp.remote-ip=148.163.156.1
X-Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id F227F606A31A
for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 07:32:15 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F227F606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com
X-Received: from pps.filterd (m0353729.ppops.net [127.0.0.1])
by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AN55L2e983215;
Mon, 23 Nov 2026 07:31:40 GMT
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc
:content-transfer-encoding:content-type:date:from:in-reply-to
:message-id:mime-version:references:subject:to; s=pp1; bh=3hHzv9
Q9OnZbjwI3vCzRnxwHM3TQIwftV3QfNN0qDtQ=; b=HhOZC6TimbTvyuTy4dgKIR
yFv0kClbNICmQAmSI8iUXoaJEwYVAHJh201Dt2LD7EoDQqn1rPUXT/uylFEZoyzo
cl5aBQ3m9jfMHD8RGm4ek1+Yhg3uVo5wbVqvBY21U1EwFRXb8fjLkGQzJA/4N1bY
mJ8NqdFLB92z9MG78tLiJUejUdwv+qvtjnYnoxRSUNwGGS5QtzSfi6B0scImQV7U
kUKwl7vRSiFwHNyYFU69QYYnm5xva8C40yfj+AXlep97v6ep6S5/2yycrVsYdDI9
Uta/WsP2kp3baEpMNVUeuz6R6XcetEpe7w6Wpfh2i2qECLBziLcgsaH3xWNSUFbw
==
X-Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221])
by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j34g320xk-1
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);
Mon, 23 Nov 2026 07:31:40 +0000 (GMT)
X-Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1])
by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6AN54FX2264429;
Mon, 23 Nov 2026 07:31:39 GMT
X-Received: from smtprelay05.wdc07v.mail.ibm.com ([172.16.1.72])
by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j3qufnk5n-1
(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
Mon, 23 Nov 2026 07:31:39 +0000 (GMT)
X-Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102])
by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6AN7Va2v7602716
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
Mon, 23 Nov 2026 07:31:37 GMT
X-Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id A58BB58061;
Mon, 23 Nov 2026 07:31:36 +0000 (GMT)
X-Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1])
by IMSVA (Postfix) with ESMTP id 520EC5805A;
Mon, 23 Nov 2026 07:31:34 +0000 (GMT)
X-Received: from [9.67.2.38] (unknown [9.67.2.38])
by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP;
Mon, 23 Nov 2026 07:31:34 +0000 (GMT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, nnac123@linux.ibm.com, maddy@linux.ibm.com,
mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org,
ritesh.list@gmail.com, sshegde@linux.ibm.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, linuxppc-dev@lists.ozlabs.org, horms@kernel.org,
davemarq@linux.ibm.com, haren@linux.ibm.com, ricklind@linux.ibm.com,
bjking1@linux.ibm.com, shaik.abdulla1@ibm.com
X-In-Reply-To: <179539467281.3135.6706630717389291385@kernel.org>
X-TM-AS-GCONF: 00
X-Proofpoint-Reinject: loops=2 maxloops=12
X-Authority-Analysis: v=2.4 cv=SoQFe/O0 c=1 sm=1 tr=0 ts=6b03ebdc cx=c_pps
a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17
a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=VkNPw1HP01LnGYTKEx00:22
a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8
a=TB4SNFFisFmkm4egyhgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10
X-Proofpoint-Spam-Info: AW1haW4tMjYxMTIzMDAyOCBTYWx0ZWRfX0Iaygy5T9Jlm
1IrdC49mei2t/ev5em3R0ePiDPJkwt9a/pc/8MS+CvB1ETSXoHtOXgFqvMhtvbM8+fAu2NLujxb
Jja8pLSZDVhRJNRUqyC14blBd1iPoAU=
X-Proofpoint-ORIG-GUID: gQGMCjfmLgydpZJxnMrs6_Y_r_bo7b7f
X-Proofpoint-GUID: tSni1Li1-f6V70ssQDGNe34mtjN9RvQG
X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTIzMDAyOCBTYWx0ZWRfX6j2siFgbiYBs
rrylYcXqDCTBH+IH0Pg1+B83KBzBhTwbu0/mwf8LOZbXT7fCC2Brru+GQOCD4aeG20wgxDAAxxw
usNX1oNSKHgOxLyVuWofEoW7m8CgJgP4l/m4jQwY3zwctR3rs7HQujHsWUc+dox8RKhxrqcj8N3
G1bNHWm66q8mN1Gd7CxywISzq2IxbUVntrQSN3AzWMFdSsSy/H24p4Nt+n/IKg8dNt680XzqJ8D
USxo8IUKQISSh0Re2qwOKz1CX5KzL/NT/FpIGOnQ0NqnZTHEZjRh3Lvxj/MWfTgDUQin64CsroJ
DLhzzK++hcRwSllnGlCmivZ7wlnaDHySEDSsfArtTDUc2W3JHgJypDGFZQ/M/Lqsdiy++igonb4
CLtyLtM9PRGJNKxpdue9nyernzpA5hQ37hFvTBUTddcZFsavnthhEDgZuFbHXbFhNAIlmu8pHkI
ffSpp36UGfxhhjQWqZg==
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49
definitions=2026-11-23_01,2026-11-22_01,2025-10-01_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
priorityscore=1501 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0
lowpriorityscore=0 clxscore=1015 malwarescore=0 impostorscore=0 phishscore=0
classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0
reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611230028