Skip to content
/ linux Public

Commit 082083c

Browse files
Ezrak1eSasha Levin
authored andcommitted
dlm: validate length in dlm_search_rsb_tree
[ Upstream commit 080e556 ] The len parameter in dlm_dump_rsb_name() is not validated and comes from network messages. When it exceeds DLM_RESNAME_MAXLEN, it can cause out-of-bounds write in dlm_search_rsb_tree(). Add length validation to prevent potential buffer overflow. Signed-off-by: Ezrak1e <ezrakiez@gmail.com> Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 31fefc1 commit 082083c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/dlm/lock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ int dlm_search_rsb_tree(struct rhashtable *rhash, const void *name, int len,
626626
struct dlm_rsb **r_ret)
627627
{
628628
char key[DLM_RESNAME_MAXLEN] = {};
629-
629+
if (len > DLM_RESNAME_MAXLEN)
630+
return -EINVAL;
630631
memcpy(key, name, len);
631632
*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
632633
if (*r_ret)

0 commit comments

Comments
 (0)