mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
dlm: validate length in dlm_search_rsb_tree
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>
This commit is contained in:
parent
1416bd508c
commit
080e5563f8
|
|
@ -626,7 +626,8 @@ int dlm_search_rsb_tree(struct rhashtable *rhash, const void *name, int len,
|
||||||
struct dlm_rsb **r_ret)
|
struct dlm_rsb **r_ret)
|
||||||
{
|
{
|
||||||
char key[DLM_RESNAME_MAXLEN] = {};
|
char key[DLM_RESNAME_MAXLEN] = {};
|
||||||
|
if (len > DLM_RESNAME_MAXLEN)
|
||||||
|
return -EINVAL;
|
||||||
memcpy(key, name, len);
|
memcpy(key, name, len);
|
||||||
*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
|
*r_ret = rhashtable_lookup_fast(rhash, &key, dlm_rhash_rsb_params);
|
||||||
if (*r_ret)
|
if (*r_ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user