]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4/pNFS: Fix another issue with a list iterator pointing to the head
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Mar 2022 12:36:34 +0000 (08:36 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Mar 2022 12:36:34 +0000 (08:36 -0400)
commit0254061b61c35d5425240c6f4adac932d5be3e94
tree6e4ae22ac7fa2cdee6477c86f1d4b3caa6ef7733
parent53e69e5a92b516b9aa75e275c6cbdcd3ed13efcc
NFSv4/pNFS: Fix another issue with a list iterator pointing to the head

In nfs4_callback_devicenotify(), if we don't find a matching entry for
the deviceid, we're left with a pointer to 'struct nfs_server' that
actually points to the list of super blocks associated with our struct
nfs_client.
Furthermore, even if we have a valid pointer, nothing pins the super
block, and so the struct nfs_server could end up getting freed while
we're using it.

Since all we want is a pointer to the struct pnfs_layoutdriver_type,
let's skip all the iteration over super blocks, and just use APIs to
find the layout driver directly.

Reported-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Fixes: 6e91f898b4bd ("pnfs: CB_NOTIFY_DEVICEID")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/callback_proc.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h