-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libxdp: always clone program fd before taking ownership of it
Coverity pointed out that we introduced use after free errors when converting xdp_program__from_fd() to call xdp_program__close() instead of just freeing the xdp_program object. However, we do need to call the destructor or we won't free up all resources. At the same time, we don't want xdp_program__from_fd() to take ownership of the fd, since that function is also public API. To fix this, change xdp_program__fill_from_fd() so it always duplicates the fd before filling in the object, taking ownership of the duplicate instead of the original fd. We already did this in a couple of call sites, which we can then get rid of, leading to an overall simplification. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
- Loading branch information
Showing
1 changed file
with
23 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters