diff options
Diffstat (limited to 'fs/dlm/user.c')
-rw-r--r-- | fs/dlm/user.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/dlm/user.c b/fs/dlm/user.c index 173b3873a4f4..1925d6d222b8 100644 --- a/fs/dlm/user.c +++ b/fs/dlm/user.c | |||
@@ -515,14 +515,9 @@ static ssize_t device_write(struct file *file, const char __user *buf, | |||
515 | if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN) | 515 | if (count > sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN) |
516 | return -EINVAL; | 516 | return -EINVAL; |
517 | 517 | ||
518 | kbuf = kzalloc(count + 1, GFP_NOFS); | 518 | kbuf = memdup_user_nul(buf, count); |
519 | if (!kbuf) | 519 | if (!IS_ERR(kbuf)) |
520 | return -ENOMEM; | 520 | return PTR_ERR(kbuf); |
521 | |||
522 | if (copy_from_user(kbuf, buf, count)) { | ||
523 | error = -EFAULT; | ||
524 | goto out_free; | ||
525 | } | ||
526 | 521 | ||
527 | if (check_version(kbuf)) { | 522 | if (check_version(kbuf)) { |
528 | error = -EBADE; | 523 | error = -EBADE; |