Page MenuHomeFreeBSD

Fix a double free in ixgbe_rxeof()
ClosedPublic

Authored by rstone on Apr 3 2017, 7:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 1, 1:13 PM
Unknown Object (File)
Feb 22 2024, 4:09 PM
Unknown Object (File)
Jan 25 2024, 5:34 AM
Unknown Object (File)
Jan 13 2024, 2:25 PM
Unknown Object (File)
Dec 22 2023, 10:17 PM
Unknown Object (File)
Sep 26 2023, 5:11 PM
Unknown Object (File)
Sep 17 2023, 10:16 AM
Unknown Object (File)
Sep 14 2023, 12:16 PM
Subscribers
None

Details

Summary

When a packet is longer than PAGE_SIZE bytes, ixgbe has to
split it across multiple descriptors. As it build up the
mbuf chain representing the packet, it saves the mbuf chain
in the rxbuf struct for the next descriptor index. If the
interface is disabled while ixgbe is doing this, a stale mbuf
chain will be left in the rxbuf.

When the interface is brought back up, the init routine ignores
the built-up mbuf chain, but it does free the mbuf associated with
the descriptor. This means that the mbuf chain is left in a state
where the final mbuf in the chain is now free. When receive starts
again, once it processes that descriptor rxeof will encounter the
stale mbuf chain and begin processing it, eventually passing it up
the stack. Eventually the chain is freed and the final mbuf in
the chain is freed a second time, leading to all the hilarity that
a double free in the kernel can cause.

Also correct an error case that did not perform proper locking
before touching an rx ring.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'm not sure what we want to do with this fix given the imminent iflib conversion, but at least this should go into stable branches.

Add the locking mentioned the description but omitted from the
actual revision.

I'm going to commit this to head and then mfc it next week to stable/11 and whatnot. This shouldn't be blocked due to iflib-ification.

This revision is now accepted and ready to land.Apr 5 2017, 7:49 PM
This revision was automatically updated to reflect the committed changes.