On Mon, Mar 23, 2020 at 09:50:34AM -0400, Chuck Lever wrote: > > > > On Mar 23, 2020, at 3:55 AM, Vasily Averin <vvs@xxxxxxxxxxxxx> wrote: > > > > New struct nfsd4_blocked_lock allocated in find_or_allocate_block() > > does not initialised nbl_list and nbl_lru. > > If conflock allocation fails rollback can call list_del_init() > > access uninitialized fields and corrupt memory. > > > > Fixes: 76d348fadff5 ("nfsd: have nfsd4_lock use blocking locks for v4.1+ lock") > > Signed-off-by: Vasily Averin <vvs@xxxxxxxxxxxxx> > > --- > > fs/nfsd/nfs4state.c | 32 +++++++++++++++----------------- > > 1 file changed, 15 insertions(+), 17 deletions(-) > > > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > > index 369e574c5092..176ef8d24fae 100644 > > --- a/fs/nfsd/nfs4state.c > > +++ b/fs/nfsd/nfs4state.c > > @@ -6524,6 +6524,13 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, > > goto out; > > } > > > > + conflock = locks_alloc_lock(); > > + if (!conflock) { > > + dprintk("NFSD: %s: unable to allocate lock!\n", __func__); > > + status = nfserr_jukebox; > > + goto out; > > + } > > Nit: What do people think about removing this dprintk() as part of the fix? I don't think we want a dprintk every place we kmalloc. All for removing them.--b.