From: Trond Myklebust Date: Wed, 17 Jul 2019 17:57:44 +0000 (-0400) Subject: pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error X-Git-Tag: Ubuntu-4.15.0-61.68~659 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f0e32a214618d5f0e9ca742c54795e96b5f5f154;p=mirror_ubuntu-bionic-kernel.git pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error BugLink: https://bugs.launchpad.net/bugs/1839036 commit 8e04fdfadda75a849c649f7e50fe7d97772e1fcb upstream. mirror->mirror_ds can be NULL if uninitialised, but can contain a PTR_ERR() if call to GETDEVICEINFO failed. Fixes: 65990d1afbd2 ("pNFS/flexfiles: Fix a deadlock on LAYOUTGET") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # 4.10+ Signed-off-by: Greg Kroah-Hartman Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c index 2de6e87e5ee5..2464b9b80698 100644 --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c @@ -306,7 +306,7 @@ int ff_layout_track_ds_error(struct nfs4_flexfile_layout *flo, if (status == 0) return 0; - if (mirror->mirror_ds == NULL) + if (IS_ERR_OR_NULL(mirror->mirror_ds)) return -EINVAL; dserr = kmalloc(sizeof(*dserr), gfp_flags);