mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 08:49:45 +00:00
dlm: fix overflows when copying from ->m_extra to lvb
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
ef58bccab7
commit
a9cc915928
1 changed files with 4 additions and 0 deletions
|
@ -1226,6 +1226,8 @@ static void set_lvb_lock_pc(struct dlm_rsb *r, struct dlm_lkb *lkb,
|
||||||
b = dlm_lvb_operations[lkb->lkb_grmode + 1][lkb->lkb_rqmode + 1];
|
b = dlm_lvb_operations[lkb->lkb_grmode + 1][lkb->lkb_rqmode + 1];
|
||||||
if (b == 1) {
|
if (b == 1) {
|
||||||
int len = receive_extralen(ms);
|
int len = receive_extralen(ms);
|
||||||
|
if (len > DLM_RESNAME_MAXLEN)
|
||||||
|
len = DLM_RESNAME_MAXLEN;
|
||||||
memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
|
memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
|
||||||
lkb->lkb_lvbseq = ms->m_lvbseq;
|
lkb->lkb_lvbseq = ms->m_lvbseq;
|
||||||
}
|
}
|
||||||
|
@ -2993,6 +2995,8 @@ static int receive_lvb(struct dlm_ls *ls, struct dlm_lkb *lkb,
|
||||||
if (!lkb->lkb_lvbptr)
|
if (!lkb->lkb_lvbptr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
len = receive_extralen(ms);
|
len = receive_extralen(ms);
|
||||||
|
if (len > DLM_RESNAME_MAXLEN)
|
||||||
|
len = DLM_RESNAME_MAXLEN;
|
||||||
memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
|
memcpy(lkb->lkb_lvbptr, ms->m_extra, len);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue