From: Timothy Day Date: Sun, 21 Jul 2024 21:47:29 +0000 (-0400) Subject: LU-18056 osp: fix KASAN warning when lu2dt_dev() lwp device X-Git-Tag: 2.15.65~29 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fa9b2021e60872cf20fcc370643262244d28d092;p=fs%2Flustre-release.git LU-18056 osp: fix KASAN warning when lu2dt_dev() lwp device A lwp device isn't really a dt device, so it shouldn't be marked as such. This causes a KASAN warning when obd_setup() attempts to access dt device fields using lu2dt_dev(): BUG: KASAN: slab-out-of-bounds in obd_setup+0x208/0x4b0 [obdclass] Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: Ib52b0f93c35a7d966314b6375ee963bc59f86abb Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55825 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Shaun Tancheff Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 50f361b..e5c976f 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -314,16 +314,18 @@ struct lu_device { struct lu_device_type_operations; -/** +/* * Tag bits for device type. They are used to distinguish certain groups of * device types. */ enum lu_device_tag { - /** this is meta-data device */ + /* this device doesn't implement any particular API */ + LU_DEVICE_MISC = 0, + /* this is meta-data device */ LU_DEVICE_MD = BIT(0), - /** this is data device */ + /* this is data device */ LU_DEVICE_DT = BIT(1), - /** data device in the client stack */ + /* data device in the client stack */ LU_DEVICE_CL = BIT(2) }; diff --git a/lustre/osp/lwp_dev.c b/lustre/osp/lwp_dev.c index fd825c6..2101718 100644 --- a/lustre/osp/lwp_dev.c +++ b/lustre/osp/lwp_dev.c @@ -395,7 +395,7 @@ static const struct lu_device_type_operations lwp_device_type_ops = { }; struct lu_device_type lwp_device_type = { - .ldt_tags = LU_DEVICE_DT, + .ldt_tags = LU_DEVICE_MISC, .ldt_name = LUSTRE_LWP_NAME, .ldt_ops = &lwp_device_type_ops, .ldt_ctx_tags = LCT_MD_THREAD