]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
pnfs/flexfiles: Fix PTR_ERR() dereferences in ff_layout_track_ds_error
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 17 Jul 2019 17:57:44 +0000 (13:57 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
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 <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # 4.10+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/nfs/flexfilelayout/flexfilelayoutdev.c

index 2de6e87e5ee50205e3f8d5f3722b47240fd4041e..2464b9b80698899d1d11aaf5bf7568de5be7aeef 100644 (file)
@@ -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);