aboutsummaryrefslogtreecommitdiff
path: root/lib/test_fortify/write_overflow-strlcpy-src.c
diff options
context:
space:
mode:
authorAl Viro <[email protected]>2022-05-16 16:42:13 +0800
committerAl Viro <[email protected]>2022-05-18 12:33:51 -0400
commitfb4554c2232e44d595920f4d5c66cf8f7d13f9bc (patch)
treeb11f7865439a1f0325d8c7ff14d976fba82d3213 /lib/test_fortify/write_overflow-strlcpy-src.c
parenta91714312eb16f9ecd1f7f8b3efe1380075f28d4 (diff)
Fix double fget() in vhost_net_set_backend()
Descriptor table is a shared resource; two fget() on the same descriptor may return different struct file references. get_tap_ptr_ring() is called after we'd found (and pinned) the socket we'll be using and it tries to find the private tun/tap data structures associated with it. Redoing the lookup by the same file descriptor we'd used to get the socket is racy - we need to same struct file. Thanks to Jason for spotting a braino in the original variant of patch - I'd missed the use of fd == -1 for disabling backend, and in that case we can end up with sock == NULL and sock != oldsock. Cc: [email protected] Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Jason Wang <[email protected]> Signed-off-by: Al Viro <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-strlcpy-src.c')
0 files changed, 0 insertions, 0 deletions