Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit 09ba8c4

Browse files
XidianGeneralMSe1969
authored andcommitted
net: sched: Fix a possible null-pointer dereference in dequeue_func()
[ Upstream commit 051c7b39be4a91f6b7d8c4548444e4b850f1f56c ] In dequeue_func(), there is an if statement on line 74 to check whether skb is NULL: if (skb) When skb is NULL, it is used on line 77: prefetch(&skb->end); Thus, a possible null-pointer dereference may occur. To fix this bug, skb->end is used when skb is not NULL. This bug is found by a static analysis tool STCheck written by us. Fixes: 76e3cc1 ("codel: Controlled Delay AQM") Signed-off-by: Jia-Ju Bai <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Change-Id: I6b1eeec3af97b20376e5020e421b61f35d0e9c58
1 parent dc75486 commit 09ba8c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/sched/sch_codel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ static struct sk_buff *dequeue(struct codel_vars *vars, struct Qdisc *sch)
6868
{
6969
struct sk_buff *skb = __skb_dequeue(&sch->q);
7070

71-
prefetch(&skb->end); /* we'll need skb_shinfo() */
71+
if (skb)
72+
prefetch(&skb->end); /* we'll need skb_shinfo() */
7273
return skb;
7374
}
7475

0 commit comments

Comments
 (0)