Re: [PATCH net 7/7] net/handshake: Verify file-reference balance in submit paths
Hannes Reinecke <[email protected]> Tue, 19 May 2026 10:03:05 +0200
| Newsgroups | dev.linux.lists.kernel-tls-handshake,org.infradead.lists.linux-nvme,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 5/18/26 20:24, Chuck Lever wrote: > From: Chuck Lever <[email protected]> > > The new file-reference contract on struct handshake_req is silently > breakable: a missing get_file() at submit or a missing fput() on an > error path leaves the file leaked but does not crash the test, so > the existing absence-of-crash checks pass either way. > > Snapshot file_count(filp) before each handshake_req_submit() in > the submit-success, EAGAIN, EBUSY, and cancel tests, and assert > the expected balance after submit and again after cancel. The > already-completed cancel test also asserts the post-complete > balance, which pins down that handshake_complete() drops the > reference and that the subsequent cancel does not double-fput. > The destroy test gets the same treatment before __fput_sync(), > which double-checks that cancel's fput() ran and the only > remaining reference is the one sock_alloc_file() established. > > Signed-off-by: Chuck Lever <[email protected]> > --- > net/handshake/handshake-test.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > One wonders why this is not part of the kunit test suite. But that's probably neither here nor there. So: Reviewed-by: Hannes Reinecke <[email protected]> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich