diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-01-25 20:22:22 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2008-02-04 02:25:58 -0500 |
commit | a5dd06313dbcec3a2c8a5e4a6f3ddb2a8fc72ec9 (patch) | |
tree | 50927394b52a4fa2d01cb9300cd49c3bb2f014c2 /fs/dlm/lock.c | |
parent | ae773d0b74bf2244887a6d0504372748381ab9c7 (diff) |
dlm: receive_rcom_lock_args() overflow check
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lock.c')
-rw-r--r-- | fs/dlm/lock.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c index 6c605fc10613..0593dd81d46d 100644 --- a/fs/dlm/lock.c +++ b/fs/dlm/lock.c | |||
@@ -4271,7 +4271,6 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
4271 | struct dlm_rsb *r, struct dlm_rcom *rc) | 4271 | struct dlm_rsb *r, struct dlm_rcom *rc) |
4272 | { | 4272 | { |
4273 | struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf; | 4273 | struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf; |
4274 | int lvblen; | ||
4275 | 4274 | ||
4276 | lkb->lkb_nodeid = rc->rc_header.h_nodeid; | 4275 | lkb->lkb_nodeid = rc->rc_header.h_nodeid; |
4277 | lkb->lkb_ownpid = le32_to_cpu(rl->rl_ownpid); | 4276 | lkb->lkb_ownpid = le32_to_cpu(rl->rl_ownpid); |
@@ -4288,11 +4287,13 @@ static int receive_rcom_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb, | |||
4288 | lkb->lkb_astaddr = (void *) (long) (rl->rl_asts & AST_COMP); | 4287 | lkb->lkb_astaddr = (void *) (long) (rl->rl_asts & AST_COMP); |
4289 | 4288 | ||
4290 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { | 4289 | if (lkb->lkb_exflags & DLM_LKF_VALBLK) { |
4290 | int lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) - | ||
4291 | sizeof(struct rcom_lock); | ||
4292 | if (lvblen > ls->ls_lvblen) | ||
4293 | return -EINVAL; | ||
4291 | lkb->lkb_lvbptr = dlm_allocate_lvb(ls); | 4294 | lkb->lkb_lvbptr = dlm_allocate_lvb(ls); |
4292 | if (!lkb->lkb_lvbptr) | 4295 | if (!lkb->lkb_lvbptr) |
4293 | return -ENOMEM; | 4296 | return -ENOMEM; |
4294 | lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) - | ||
4295 | sizeof(struct rcom_lock); | ||
4296 | memcpy(lkb->lkb_lvbptr, rl->rl_lvb, lvblen); | 4297 | memcpy(lkb->lkb_lvbptr, rl->rl_lvb, lvblen); |
4297 | } | 4298 | } |
4298 | 4299 | ||