Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135891
b: refs/heads/master
c: 1fecb1c
h: refs/heads/master
i:
  135889: 303b88a
  135887: 3840548
v: v3
  • Loading branch information
David Teigland committed Mar 11, 2009
1 parent 2bf439a commit 8779627
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a536e38125fe5da8ed49690f30c30a8f651cf1f5
refs/heads/master: 1fecb1c4b62881e3689ba2dcf93072ae301b597c
24 changes: 15 additions & 9 deletions trunk/fs/dlm/user.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved.
* Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
Expand Down Expand Up @@ -84,7 +84,7 @@ struct dlm_lock_result32 {

static void compat_input(struct dlm_write_request *kb,
struct dlm_write_request32 *kb32,
size_t count)
int namelen)
{
kb->version[0] = kb32->version[0];
kb->version[1] = kb32->version[1];
Expand All @@ -96,8 +96,7 @@ static void compat_input(struct dlm_write_request *kb,
kb->cmd == DLM_USER_REMOVE_LOCKSPACE) {
kb->i.lspace.flags = kb32->i.lspace.flags;
kb->i.lspace.minor = kb32->i.lspace.minor;
memcpy(kb->i.lspace.name, kb32->i.lspace.name, count -
offsetof(struct dlm_write_request32, i.lspace.name));
memcpy(kb->i.lspace.name, kb32->i.lspace.name, namelen);
} else if (kb->cmd == DLM_USER_PURGE) {
kb->i.purge.nodeid = kb32->i.purge.nodeid;
kb->i.purge.pid = kb32->i.purge.pid;
Expand All @@ -115,8 +114,7 @@ static void compat_input(struct dlm_write_request *kb,
kb->i.lock.bastaddr = (void *)(long)kb32->i.lock.bastaddr;
kb->i.lock.lksb = (void *)(long)kb32->i.lock.lksb;
memcpy(kb->i.lock.lvb, kb32->i.lock.lvb, DLM_USER_LVB_LEN);
memcpy(kb->i.lock.name, kb32->i.lock.name, count -
offsetof(struct dlm_write_request32, i.lock.name));
memcpy(kb->i.lock.name, kb32->i.lock.name, namelen);
}
}

Expand Down Expand Up @@ -539,17 +537,25 @@ static ssize_t device_write(struct file *file, const char __user *buf,
#ifdef CONFIG_COMPAT
if (!kbuf->is64bit) {
struct dlm_write_request32 *k32buf;
int namelen = 0;

if (count > sizeof(struct dlm_write_request32))
namelen = count - sizeof(struct dlm_write_request32);

k32buf = (struct dlm_write_request32 *)kbuf;
kbuf = kmalloc(count + 1 + (sizeof(struct dlm_write_request) -
sizeof(struct dlm_write_request32)), GFP_KERNEL);

/* add 1 after namelen so that the name string is terminated */
kbuf = kzalloc(sizeof(struct dlm_write_request) + namelen + 1,
GFP_KERNEL);
if (!kbuf) {
kfree(k32buf);
return -ENOMEM;
}

if (proc)
set_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags);
compat_input(kbuf, k32buf, count + 1);

compat_input(kbuf, k32buf, namelen);
kfree(k32buf);
}
#endif
Expand Down

0 comments on commit 8779627

Please sign in to comment.