aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/ceph/mds_client.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2020-04-08 08:41:38 -0400
committerIlya Dryomov <idryomov@gmail.com>2020-04-13 19:33:47 +0200
commit2a575f138d003fff0f4930b5cfae4a1c46343b8f (patch)
tree81df5b30d09f3b0360216ef0842dc0e26c7c77f7 /fs/ceph/mds_client.h
parentrbd: don't mess with a page vector in rbd_notify_op_lock() (diff)
downloadwireguard-linux-2a575f138d003fff0f4930b5cfae4a1c46343b8f.tar.xz
wireguard-linux-2a575f138d003fff0f4930b5cfae4a1c46343b8f.zip
ceph: fix potential bad pointer deref in async dirops cb's
The new async dirops callback routines can pass ERR_PTR values to ceph_mdsc_free_path, which could cause an oops. Make ceph_mdsc_free_path ignore ERR_PTR values. Also, ensure that the pr_warn messages look sane even if ceph_mdsc_build_path fails. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/mds_client.h')
-rw-r--r--fs/ceph/mds_client.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 4e5be79bf080..903d9edfd4bf 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -521,7 +521,7 @@ extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
static inline void ceph_mdsc_free_path(char *path, int len)
{
- if (path)
+ if (!IS_ERR_OR_NULL(path))
__putname(path - (PATH_MAX - 1 - len));
}