diff mbox series

[B,3/3] test_bpf: Fix NULL vs IS_ERR() check in test_skb_segment()

Message ID 20210212204159.28472-4-gpiccoli@canonical.com
State New
Headers show
Series Fix oops in skb_segment for Bionic series | expand

Commit Message

Guilherme G. Piccoli Feb. 12, 2021, 8:41 p.m. UTC
From: Dan Carpenter <dan.carpenter@oracle.com>

BugLink: https://bugs.launchpad.net/bugs/1915552

The skb_segment() function returns error pointers on error.  It never
returns NULL.

Fixes: 76db8087c4c9 ("net: bpf: add a test for skb_segment in test_bpf module")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 99fe29d3a25f813146816b322367b4c6a0fdec84)
Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
---
 lib/test_bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 3f0821cb0ab4..9f5530b8a2f8 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -6557,7 +6557,7 @@  static __init int test_skb_segment(void)
 	}
 
 	segs = skb_segment(skb, features);
-	if (segs) {
+	if (!IS_ERR(segs)) {
 		kfree_skb_list(segs);
 		ret = 0;
 		pr_info("%s: success in skb_segment!", __func__);