HomeFreeBSD

Check the index hasn't changed after writing the cmp entry.

Description

Check the index hasn't changed after writing the cmp entry.

If an interrupt fires while writing the cmp entry we may have a partial
entry. Work around this by using atomic_cmpset to set the new index. If it
fails we need to set the previous index value and try again as the entry
may be in an inconsistent state.

This fixes messages similar to the following from syzkaller:
bad comp 224 type 2163727253

Reviewed by: tuexen
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19287

Details

Committed
andrewFeb 25 2019, 1:15 PM
Reviewer
tuexen
Differential Revision
D19287: Check the index hasn't changed after writing the cmp entry
Parents
rS344516: MFC r344428:
Branches
Unknown
Tags
Unknown