Whamcloud - gitweb
LU-18056 osp: fix KASAN warning when lu2dt_dev() lwp device 25/55825/2
authorTimothy Day <timday@amazon.com>
Sun, 21 Jul 2024 21:47:29 +0000 (17:47 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 Jul 2024 16:06:42 +0000 (16:06 +0000)
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 <timday@amazon.com>
Change-Id: Ib52b0f93c35a7d966314b6375ee963bc59f86abb
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55825
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lu_object.h
lustre/osp/lwp_dev.c

index 50f361b..e5c976f 100644 (file)
@@ -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)
 };
 
index fd825c6..2101718 100644 (file)
@@ -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