Skip to content

Commit e1e8399

Browse files
vaverinchucklever
authored andcommitted
nfsd: memory corruption in nfsd4_lock()
New struct nfsd4_blocked_lock allocated in find_or_allocate_block() does not initialized nbl_list and nbl_lru. If conflock allocation fails rollback can call list_del_init() access uninitialized fields and corrupt memory. v2: just initialize nbl_list and nbl_lru right after nbl allocation. Fixes: 76d348f ("nfsd: have nfsd4_lock use blocking locks for v4.1+ lock") Signed-off-by: Vasily Averin <vvs@virtuozzo.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 8f3d9f3 commit e1e8399

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/nfsd/nfs4state.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh,
267267
if (!nbl) {
268268
nbl= kmalloc(sizeof(*nbl), GFP_KERNEL);
269269
if (nbl) {
270+
INIT_LIST_HEAD(&nbl->nbl_list);
271+
INIT_LIST_HEAD(&nbl->nbl_lru);
270272
fh_copy_shallow(&nbl->nbl_fh, fh);
271273
locks_init_lock(&nbl->nbl_lock);
272274
nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client,

0 commit comments

Comments
 (0)