|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH net-next 15/15] net: update comments that still describe the skb BUG_ON()s
The skbuff BUG_ON() conversions left a few comments behind:
- bpf_skb_net_grow() says skb_segment() BUG()s on a frag_list with
head_frag set at the downgraded MSS. It fails the segmentation and
the packet is dropped, which is still why the skb gets linearized.
- The GSO KUnit test says the non-uniform frag_list case would hit
BUG_ON(i >= nfrags) with SG. That check now fails with -EINVAL.
- The skb_to_sgvec() kernel-doc doesn't list the -EINVAL that
__skb_to_sgvec() returns when @offset and @len run past the end of
the skb.
No functional change.
Assisted-by: LLM
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
net/core/filter.c | 6 +++---
net/core/net_test.c | 4 ++--
net/core/skbuff.c | 5 +++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 3ee1a093337e..f5bce0dc43fe 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3696,9 +3696,9 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 off,
u32 len_diff,
shinfo->gso_segs = 0;
/* Due to header growth, MSS needs to be downgraded.
- * There is a BUG_ON() when segmenting the frag_list with
- * head_frag true, so linearize the skb after downgrading
- * the MSS.
+ * Segmenting a frag_list with head_frag true at the new MSS
+ * fails and the packet gets dropped, so linearize the skb
+ * after downgrading the MSS.
*/
if (!(flags & BPF_F_ADJ_ROOM_FIXED_GSO)) {
skb_decrease_gso_size(shinfo, len_diff);
diff --git a/net/core/net_test.c b/net/core/net_test.c
index 12a175268a01..d38dfeed163b 100644
--- a/net/core/net_test.c
+++ b/net/core/net_test.c
@@ -325,8 +325,8 @@ static void gso_test_func(struct kunit *test)
if (tcase->id == GSO_TEST_GSO_PARTIAL)
features |= NETIF_F_GSO_PARTIAL;
- /* TODO: this should also work with SG,
- * rather than hit BUG_ON(i >= nfrags)
+ /* TODO: this should also work with SG, rather than fail the
+ * i >= nfrags check in skb_segment()
*/
if (tcase->id == GSO_TEST_FRAG_LIST_NON_UNIFORM)
features &= ~NETIF_F_SG;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b6ada54ecc57..4822f96fc1c8 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5554,8 +5554,9 @@ __skb_to_sgvec(struct sk_buff *skb, struct scatterlist
*sg, int offset, int len,
*
* Fill the specified scatter-gather list with mappings/pointers into a
* region of the buffer space attached to a socket buffer. Returns either
- * the number of scatterlist items used, or -EMSGSIZE if the contents
- * could not fit.
+ * the number of scatterlist items used, -EMSGSIZE if the contents
+ * could not fit, or -EINVAL if @offset and @len run past the end of
+ * the skb.
*/
int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int
len)
{
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |