Skip to contentSkip to conversation

net: Fix potential out of bound write in skb_try_coalesce()

PATCH linmiaohe 1 participant 1 message Aug 6, 2020

Subsystems (2)
lore
Share & tools
lore

linmiaohe

author
#0 lore raw
Quoted 14 lines · Eric Dumazet
Quoted 6 lines · linmiaohe

From: Miaohe Lin <[email protected]>

The head_frag of skb would occupy one extra skb_frag_t. Take it into account or out of bound write to skb frags may happen.

Please share a stack trace if this was a real bug spotted in the wild.

I do not believe this patch is correct.

if (A + B >= MAX) is equivalent to if (A + B + 1 > MAX)

Quoted 7 lines

Note how the other condition (when there is no bytes in skb header) is coded :

if (A + B > MAX) return false;

In anycase, please always provide a Fixes: tag for any bug fix.

Thanks.

Many thanks for your patient explaination. I compared (A + B >= MAX) with (A + B + 1 > MAX) in skb_gro_receive(), but I missed the '='. It's my oversight, I'am really sorry about it.

Thanks again.