From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9365B282F1F; Sat, 12 Sep 2026 15:39:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227577; cv=none; b=C3eVoO7Y2mNzKyVKrStt+v6YBi2IgFPtMxb9M19kNILNRFhfM4X6xLlxviTedw0JcjI9JG5VvLXtsSsRJ8XWy2LNFRqENq318QTG8rA1UpSbvMq1U068gwV1PoO2svq2dodXwxcSL1PTPBceJkZyqlbyfUMX+Fux/CGriA3CA4s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227577; c=relaxed/simple; bh=o68FsajLw1rP+NkzfYOKCXxotw/cYTY81Vcc9R54y10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mstFCwXwtVgCmvIXzMhzZQkfsNJOMdyjZExQXXH3RN7LC+oIlfy3rsSl/4OrqnVVeDlfevm9sB1he0E/Q+4FCiRXjwdg3YV7YeZIaq/7BlnXUxJyPeXM+uN+O16yTsdOS4IjJ3sl11sK/+aQfsJuJKyAqKEGj3VulUkkn5DUGZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=qb390ifn; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="qb390ifn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A1C81F000FF; Sat, 12 Sep 2026 15:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789227575; bh=T4/CiKi3v6CDHoR5i/Ws6OvQmMgxWZQmjl6rvhtao1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=qb390ifnIOGRoIw+poz6j/hWd8EbtCWoxzCiapV1MAXzt2LeDSFyqsvgxa2YEyb7V 56K062mKTeVS12nA33oCpeCpIMVMrVb3PlnbXvnI14FYx6Gm+gLCm3F/kxx04F9//3 l3a267tUxjA6hTR2Cg+7rBu+ozJdlnIsXOdeYQWQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Koichiro Den , Dave Jiang , Jakub Kicinski Subject: [PATCH 6.1 0210/1191] NTB: ntb_transport: Fail TX enqueue when the QP link is down Date: Sat, 12 Sep 2026 08:48:58 +0200 Message-ID: <20260912065552.927440053@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Koichiro Den commit 873ce713fef5dde0939220f04f3484ec86a16fba upstream. Commit f195a1a6fe41 ("ntb: Drop packets when qp link is down") meant to make ntb_transport_tx_enqueue() drop packets submitted while the QP link is down, but it only returns 0 without consuming the packet. Zero means success by this function's contract, so ntb_netdev reports NETDEV_TX_OK and forgets the skb: nothing queued it, nothing frees it, and it leaks, one skb for every transmit racing a link-down. Return -ENOLINK instead, restoring the contract that a non-zero return leaves the buffer owned by the caller. With the preceding patch, ntb_netdev frees the skb on non-retryable enqueue failures and returns NETDEV_TX_OK, so a packet racing with link-down is dropped without leaking or entering a busy retry loop. Fixes: f195a1a6fe41 ("ntb: Drop packets when qp link is down") Cc: stable@vger.kernel.org Signed-off-by: Koichiro Den Reviewed-by: Dave Jiang Link: https://patch.msgid.link/20260817053519.4135287-4-den@valinux.co.jp Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/ntb/ntb_transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -2304,9 +2304,8 @@ int ntb_transport_tx_enqueue(struct ntb_ if (!qp || !len) return -EINVAL; - /* If the qp link is down already, just ignore. */ if (!qp->link_is_up) - return 0; + return -ENOLINK; entry = ntb_list_rm(&qp->ntb_tx_free_q_lock, &qp->tx_free_q); if (!entry) {