The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e5bcf7b99fcbe06d381525ffdd5027b846cdc1d3

commit e5bcf7b99fcbe06d381525ffdd5027b846cdc1d3
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2026-02-03 22:13:24 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-07-17 15:48:52 +0000

    LinuxKPI: skbuff: improve debugging
    
    Deal with SKB_TRACE_FMT optional arguments; while here properly indent.
    
    Add KASSERT to __skb_unlink() to catch incorrect skbuffs encountered
    while debugging a wireless driver (which had other pre-conditions failing).
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h 
b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index c43d6daff5ee..3133944ed72e 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2020-2025 The FreeBSD Foundation
+ * Copyright (c) 2020-2026 The FreeBSD Foundation
  * Copyright (c) 2021-2025 Bjoern A. Zeeb
  *
  * This software was developed by Björn Zeeb under sponsorship from
@@ -74,9 +74,9 @@ extern int linuxkpi_debug_skb;
     if (linuxkpi_debug_skb & DSKB_TRACE)                               \
        printf("SKB_TRACE %s:%d %p, %p\n", __func__, __LINE__, _s, _p)
 #define        SKB_TRACE_FMT(_s, _fmt, ...)                                    
\
-   if (linuxkpi_debug_skb & DSKB_TRACE)                                        
\
+    if ((linuxkpi_debug_skb & DSKB_TRACE) != 0)                                
\
        printf("SKB_TRACE %s:%d %p " _fmt "\n", __func__, __LINE__, _s, \
-           __VA_ARGS__)
+           ##__VA_ARGS__)
 #else
 #define        SKB_TODO()              do { } while(0)
 #define        SKB_IMPROVE(...)        do { } while(0)
@@ -653,6 +653,8 @@ __skb_unlink(struct sk_buff *skb, struct sk_buff_head *q)
        WRITE_ONCE(q->qlen, q->qlen - 1);
        p = skb->prev;
        n = skb->next;
+       KASSERT(p != NULL && n != NULL,
+           ("%s: skb %p q %p p %p n %p\n", __func__, skb, q, p, n));
        WRITE_ONCE(n->prev, p);
        WRITE_ONCE(p->next, n);
        skb->prev = skb->next = NULL;

Reply via email to