Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a5dd06313dbcec3a2c8a5e4a6f3ddb2a8fc72ec9
Commit:     a5dd06313dbcec3a2c8a5e4a6f3ddb2a8fc72ec9
Parent:     ae773d0b74bf2244887a6d0504372748381ab9c7
Author:     Al Viro <[EMAIL PROTECTED]>
AuthorDate: Fri Jan 25 20:22:22 2008 -0500
Committer:  David Teigland <[EMAIL PROTECTED]>
CommitDate: Mon Feb 4 01:25:58 2008 -0600

    dlm: receive_rcom_lock_args() overflow check
    
    Signed-off-by: Al Viro <[EMAIL PROTECTED]>
    Signed-off-by: David Teigland <[EMAIL PROTECTED]>
---
 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 6c605fc..0593dd8 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,
                                  struct dlm_rsb *r, struct dlm_rcom *rc)
 {
        struct rcom_lock *rl = (struct rcom_lock *) rc->rc_buf;
-       int lvblen;
 
        lkb->lkb_nodeid = rc->rc_header.h_nodeid;
        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,
        lkb->lkb_astaddr = (void *) (long) (rl->rl_asts & AST_COMP);
 
        if (lkb->lkb_exflags & DLM_LKF_VALBLK) {
+               int lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) -
+                        sizeof(struct rcom_lock);
+               if (lvblen > ls->ls_lvblen)
+                       return -EINVAL;
                lkb->lkb_lvbptr = dlm_allocate_lvb(ls);
                if (!lkb->lkb_lvbptr)
                        return -ENOMEM;
-               lvblen = rc->rc_header.h_length - sizeof(struct dlm_rcom) -
-                        sizeof(struct rcom_lock);
                memcpy(lkb->lkb_lvbptr, rl->rl_lvb, lvblen);
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to