Skip to content

Commit 0c92210

Browse files
shauryarane05marckleinebudde
authored andcommitted
net/sched: em_canid: fix uninit-value in em_canid_match
Use pskb_may_pull() to ensure a complete CAN frame is present in the linear data buffer before reading the CAN ID. A simple skb->len check is insufficient because it only verifies the total data length but does not guarantee the data is present in skb->data (it could be in fragments). pskb_may_pull() both validates the length and pulls fragmented data into the linear buffer if necessary, making it safe to directly access skb->data. Reported-by: syzbot+5d8269a1e099279152bc@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=5d8269a1e099279152bc Fixes: f057bbb ("net: em_canid: Ematch rule to match CAN frames according to their identifiers") Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in> Link: https://patch.msgid.link/20251126085718.50808-1-ssranevjti@gmail.com Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 6d849ff commit 0c92210

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/sched/em_canid.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static int em_canid_match(struct sk_buff *skb, struct tcf_ematch *m,
9999
int i;
100100
const struct can_filter *lp;
101101

102+
if (!pskb_may_pull(skb, CAN_MTU))
103+
return 0;
104+
102105
can_id = em_canid_get_id(skb);
103106

104107
if (can_id & CAN_EFF_FLAG) {

0 commit comments

Comments
 (0)