This is a note to let you know that I've just added the patch titled ntb: Fix calculation ntb_transport_tx_free_entry() to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ntb-fix-calculation-ntb_transport_tx_free_entry.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 5a7693e6bbf19b22fd6c1d2c4b7beb0a03969e2c Mon Sep 17 00:00:00 2001 From: Dave Jiang <dave.jiang@xxxxxxxxx> Date: Tue, 22 Aug 2023 09:04:57 -0700 Subject: ntb: Fix calculation ntb_transport_tx_free_entry() From: Dave Jiang <dave.jiang@xxxxxxxxx> commit 5a7693e6bbf19b22fd6c1d2c4b7beb0a03969e2c upstream. ntb_transport_tx_free_entry() never returns 0 with the current calculation. If head == tail, then it would return qp->tx_max_entry. Change compare to tail >= head and when they are equal, a 0 would be returned. Fixes: e74bfeedad08 ("NTB: Add flow control to the ntb_netdev") Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx> Signed-off-by: renlonglong <ren.longlong@xxxxxxx> Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx> Signed-off-by: Jon Mason <jdmason@xxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c @@ -2429,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entry unsigned int head = qp->tx_index; unsigned int tail = qp->remote_rx_info->entry; - return tail > head ? tail - head : qp->tx_max_entry + tail - head; + return tail >= head ? tail - head : qp->tx_max_entry + tail - head; } EXPORT_SYMBOL_GPL(ntb_transport_tx_free_entry); Patches currently in stable-queue which might be from dave.jiang@xxxxxxxxx are queue-6.4/virtio_pmem-add-the-missing-req_op_write-for-flush-bio.patch queue-6.4/dmaengine-idxd-allow-ats-disable-update-only-for-con.patch queue-6.4/ntb-fix-calculation-ntb_transport_tx_free_entry.patch queue-6.4/dmaengine-idxd-simplify-wq-attribute-visibility-chec.patch queue-6.4/ntb-clean-up-tx-tail-index-on-link-down.patch queue-6.4/nvdimm-fix-dereference-after-free-in-register_nvdimm.patch queue-6.4/ntb-drop-packets-when-qp-link-is-down.patch queue-6.4/dmaengine-idxd-fix-issues-with-prs-disable-sysfs-kno.patch queue-6.4/nvdimm-fix-memleak-of-pmu-attr_groups-in-unregister_.patch queue-6.4/dmaengine-idxd-modify-the-dependence-of-attribute-pa.patch queue-6.4/dmaengine-idxd-expose-ats-disable-knob-only-when-wq-.patch