Skip to contentSkip to conversation

dlm: fix dlm_dir_lookup() handling of too long names

PATCH New David Teigland 1 participant 1 message Feb 7, 2008 Distributed lock manager (DLM)

lore
Share & tools
lore

David Teigland

author maintainer
#0 lore raw

PATCH 12/16 dlm: fix dlm_dir_lookup() handling of too long names

From: Al Viro <[email protected]>

... those can happen and BUG() from DLM_ASSERT() in allocate_direntry() is not a good way to handle them.

---
 fs/dlm/dir.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
fs/dlm/dir.c +3 -0
index 831050e..85defeb 100644
@@ -319,6 +319,9 @@ static int get_entry(struct dlm_ls *ls, int nodeid, char *name,
 
 	write_unlock(&ls->ls_dirtbl[bucket].lock);
 
+	if (namelen > DLM_RESNAME_MAXLEN)
+		return -EINVAL;
+
 	de = kzalloc(sizeof(struct dlm_direntry) + namelen, GFP_KERNEL);
 	if (!de)
 		return -ENOMEM;
Signature · 1 line
1.5.3.3