diff options
author | Toke Høiland-Jørgensen | 2019-09-08 09:20:16 +0100 |
---|---|---|
committer | Daniel Borkmann | 2019-09-16 10:19:51 +0200 |
commit | af58e7ee6a8d83726ad8a2696e98d86400a7639c (patch) | |
tree | f2f1158df0620009367550df13f9b050b39dd46f /tools | |
parent | a4fa6e169007d85c2d71ee994aad5a85d966a9d0 (diff) |
xdp: Fix race in dev_map_hash_update_elem() when replacing element
syzbot found a crash in dev_map_hash_update_elem(), when replacing an
element with a new one. Jesper correctly identified the cause of the crash
as a race condition between the initial lookup in the map (which is done
before taking the lock), and the removal of the old element.
Rather than just add a second lookup into the hashmap after taking the
lock, fix this by reworking the function logic to take the lock before the
initial lookup.
Fixes: 6f9d451ab1a3 ("xdp: Add devmap_hash map type for looking up devices by hashed index")
Reported-and-tested-by: syzbot+4e7a85b1432052e8d6f8@syzkaller.appspotmail.com
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions