Re: [PATCH net-next v3 2/2] net: prevent mixing frags from different memory providers or bindings

From
Stanislav Fomichev <hidden>
Date
2026-11-06 22:22:49
Also in
lkml
Reply to
Mina Almasry, 2026-11-06
On 11/06, Mina Almasry wrote:
On Thu, Nov 5, 2026 at 8:59 AM Stanislav Fomichev [off-list ref] wrote:
quoted
quoted
+static inline void *skb_net_iov_provider(const struct sk_buff *skb)
+{
+     struct net_iov *niov;
+
[..]
quoted
+     if (!skb_has_net_iovs(skb) || !skb_shinfo(skb)->nr_frags)
+             return NULL;
(a few nits/questions)

Why !skb_has_net_iovs is not enough? (and if !nr_frags is required,
maybe fold it into skb_has_net_iovs?)
Well skb_has_net_iovs only checks skb->unreadable, which is not
actually enough. The skb doesn't necessarily have net_iovs if it's
unreadable, it technically could be that it has no frags, right?

Technically we should never have the edge case where
skb->unreadable==true && skb_shinfo->nr_frags==0, but I don't think
the code is careful about that today, and I don't know that I want to
do a global refactor everywhere we remove frags, which skb-> flags
need to be updated.

but you're right that it can be folded.
Not sure I'm buying that, but happy to look again if you disagree. I think
the only way to make an skb unreadable right now is to add at least
one niov frag? Don't think this is (ever?) gonna change? What does
and unreadable skb without frags even means?
Thread (8 messages) 8 messages, 2 authors, last reply 12d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help