Re: [PATCH 1/2] nfsd: avoid ref leak in nfsd_open_local_fh()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 18 Jul 2025, Mike Snitzer wrote:
> On Fri, Jul 18, 2025 at 11:26:14AM +1000, NeilBrown wrote:
> > If two calls to nfsd_open_local_fh() race and both successfully call
> > nfsd_file_acquire_local(), they will both get an extra reference to the
> > net to accompany the file reference stored in *pnf.
> > 
> > One of them will fail to store (using xchg()) the file reference in
> > *pnf and will drop that reference but WONT drop the accompanying
> > reference to the net.  This leak means that when the nfs server is shut
> > down it will hang in nfsd_shutdown_net() waiting for
> > &nn->nfsd_net_free_done.
> > 
> > This patch adds the missing nfsd_net_put().
> > 
> > Reported-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> > Fixes: e6f7e1487ab5 ("nfs_localio: simplify interface to nfsd for getting nfsd_file")
> > Signed-off-by: NeilBrown <neil@xxxxxxxxxx>
> 
> Tested-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> Reviewed-by: Mike Snitzer <snitzer@xxxxxxxxxx>
> 
> Looks really solid now, thanks!
> 
> Mike
> 

Thanks Mike - I appreciate the prompt testing!

NeilBrown





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux