[lustre-devel] [PATCH 177/622] lustre: obdclass: lu_dirent record length missing '0'
James Simmons
jsimmons at infradead.org
Thu Feb 27 13:10:45 PST 2020
From: Lai Siyao <lai.siyao at whamcloud.com>
In lu_dirent packing, a '0' is appended after name, but it's not
counted in size calcuation, which may cause crash.
WC-bug-id: https://jira.whamcloud.com/browse/LU-11753
Lustre-commit: 77f01308c509 ("LU-11753 obdclass: lu_dirent record length missing '0'")
Signed-off-by: Lai Siyao <lai.siyao at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/33865
Reviewed-by: Stephan Thiell <sthiell at stanford.edu>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
include/uapi/linux/lustre/lustre_idl.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/lustre/lustre_idl.h b/include/uapi/linux/lustre/lustre_idl.h
index 599fe86..4236a43 100644
--- a/include/uapi/linux/lustre/lustre_idl.h
+++ b/include/uapi/linux/lustre/lustre_idl.h
@@ -480,10 +480,11 @@ static inline size_t lu_dirent_calc_size(size_t namelen, __u16 attr)
if (attr & LUDA_TYPE) {
const size_t align = sizeof(struct luda_type) - 1;
- size = (sizeof(struct lu_dirent) + namelen + align) & ~align;
+ size = (sizeof(struct lu_dirent) + namelen + 1 + align) &
+ ~align;
size += sizeof(struct luda_type);
} else {
- size = sizeof(struct lu_dirent) + namelen;
+ size = sizeof(struct lu_dirent) + namelen + 1;
}
return (size + 7) & ~7;
--
1.8.3.1
More information about the lustre-devel
mailing list