Selaa lähdekoodia

dlm: fix dlm_dir_lookup() handling of too long names

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

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Teigland <teigland@redhat.com>
Al Viro 17 vuotta sitten
vanhempi
commit
043b19cdc0
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  1. 3 0
      fs/dlm/dir.c

+ 3 - 0
fs/dlm/dir.c

@@ -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;