diff options
author | Moritz Wanzenböck <[email protected]> | 2023-10-19 14:58:47 +0200 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2023-10-23 10:19:33 -0700 |
commit | 7798b59409c345d4a6034a4326bceb9f7e2e8b58 (patch) | |
tree | 6274e5c929824616d2f6d062cf89b0a5ee385a2b /tools/perf/util/trace-event-scripting.c | |
parent | 13454e6e0df2ff37853596d546438ac84ca6a413 (diff) |
net/handshake: fix file ref count in handshake_nl_accept_doit()
If req->hr_proto->hp_accept() fail, we call fput() twice:
Once in the error path, but also a second time because sock->file
is at that point already associated with the file descriptor. Once
the task exits, as it would probably do after receiving an error
reading from netlink, the fd is closed, calling fput() a second time.
To fix, we move installing the file after the error path for the
hp_accept() call. In the case of errors we simply put the unused fd.
In case of success we can use fd_install() to link the sock->file
to the reserved fd.
Fixes: 7ea9c1ec66bc ("net/handshake: Fix handshake_dup() ref counting")
Signed-off-by: Moritz Wanzenböck <[email protected]>
Reviewed-by: Chuck Lever <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions