public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: devmem: remove min_t(iter_iov_len) in sendmsg
@ 2025-05-17  0:04 Stanislav Fomichev
  2025-05-17  0:09 ` Al Viro
  0 siblings, 1 reply; 11+ messages in thread
From: Stanislav Fomichev @ 2025-05-17  0:04 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, horms, willemb, sagi, stfomichev,
	asml.silence, almasrymina, kaiyuanz, linux-kernel

iter_iov_len looks broken for UBUF. When iov_iter_advance is called
for UBUF, it increments iov_offset and also decrements the count.
This makes the iterator only go over half of the range (unless I'm
missing something). Remove iter_iov_len clamping. net_devmem_get_niov_at
already does PAGE_SIZE alignment and min_t(length) makes sure that
the last chunk (potentially smaller than PAGE_SIZE) is accounted
correctly.

Fixes: bd61848900bf ("net: devmem: Implement TX path")
Signed-off-by: Stanislav Fomichev <stfomichev@gmail.com>
---
 net/core/datagram.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index e04908276a32..48fcfc1dcf47 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -712,7 +712,6 @@ zerocopy_fill_skb_from_devmem(struct sk_buff *skb, struct iov_iter *from,
 			return -EFAULT;
 
 		size = min_t(size_t, size, length);
-		size = min_t(size_t, size, iter_iov_len(from));
 
 		get_netmem(net_iov_to_netmem(niov));
 		skb_add_rx_frag_netmem(skb, i, net_iov_to_netmem(niov), off,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-05-20 15:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-17  0:04 [PATCH net-next] net: devmem: remove min_t(iter_iov_len) in sendmsg Stanislav Fomichev
2025-05-17  0:09 ` Al Viro
2025-05-17  1:24   ` Stanislav Fomichev
2025-05-17  2:06     ` Al Viro
2025-05-17  2:17       ` Stanislav Fomichev
2025-05-17  3:39         ` Al Viro
2025-05-17  3:53           ` Stanislav Fomichev
2025-05-17  4:05             ` Al Viro
2025-05-17  4:29               ` Stanislav Fomichev
2025-05-17  4:53                 ` Mina Almasry
2025-05-20 15:10                 ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox