net: Set fput_needed iff FDPUT_FPUT is set
Subsystems (2)
Quoted 10 lines · Al Viro
Quoted 9 lines · Al Viro
Quoted 7 lines · linmiaohe
From: Miaohe Lin <[email protected]>
We should
fput()file iffFDPUT_FPUTis set. So we should setfput_neededaccordingly.Fixes 00e188ef6a7e ("sockfd_lookup_light(): switch to fdget^W^Wawayfrom
fget_light")
Quoted 8 lines
Quoted 1 line
Explain, please. We are getting it from
fdget(); what else can we get in flags there?FWIW, struct fd ->flags may have two bits set:
FDPUT_FPUTandFDPUT_POS_UNLOCK.
The latter is set only by__fdget_pos()and its callers, and that only for regular files and directories.Nevermind that
sockfd_lookup_light()does *not* use ..._pos() family of primitives, even if it started to use e.g.fdget_pos()it *still* would not end up with anything other thanFDPUT_FPUTto deal with on that path - it checks that what it got is a socket. Anything else is dropped right there, without leavingfput()to caller.So could you explain what exactly the bug is - if you are seeing some breakage and this patch fixes it, something odd is definitely going on and it would be nice to figure out what that something is.
I'am sorry, but I did not find something odd. I do this because this would make code more clear and consistent. It's pure a clean up patch. Maybe Fixes tag makes this looks like a bugfix.
Thanks for your reply and detailed explaination. :)
And sorry for my rookie mistake, I wasn't meant to make these as a patch set...