Skip to content

Commit 7a40f1f

Browse files
Alexander Aringteigland
authored andcommitted
fs: dlm: stop unnecessarily filling zero ms_extra bytes
Commit 7175e13 ("fs: dlm: fix invalid derefence of sb_lvbptr") fixes an issue when the lkb->lkb_lvbptr set to an dangled pointer and an followed memcpy() would fail. It was fixed by an additional check of DLM_LKF_VALBLK flag. The mentioned commit forgot to add an additional check if DLM_LKF_VALBLK is set for the additional amount of LVB data allocated in a dlm message. This patch is changing the message allocation to check additionally if DLM_LKF_VALBLK is set otherwise a dangled lkb->lkb_lvbptr pointer would allocated zero LVB message data which not gets filled with actual data. This patch is however only a cleanup to reduce the amount of zero bytes transmitted over network as receive_lvb() will only evaluates message LVB data if DLM_LKF_VALBLK is set. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David Teigland <[email protected]>
1 parent 1361737 commit 7a40f1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/dlm/lock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
33813381
case DLM_MSG_REQUEST_REPLY:
33823382
case DLM_MSG_CONVERT_REPLY:
33833383
case DLM_MSG_GRANT:
3384-
if (lkb && lkb->lkb_lvbptr)
3384+
if (lkb && lkb->lkb_lvbptr && (lkb->lkb_exflags & DLM_LKF_VALBLK))
33853385
mb_len += r->res_ls->ls_lvblen;
33863386
break;
33873387
}

0 commit comments

Comments
 (0)