aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-07 15:12:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-07 15:12:18 -0700
commitc593e8978722f7f4a12932733cfeed6c0c74fbaa (patch)
tree364ad0542f0208b161ad848281273354e6fc037d
parent052e5c7e28cc22017f9ad3f67026f911fdfc2edc (diff)
parent01a9a8a9e20012f5676ec9cd16b6aed08b267066 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fix from Chris Mason: "I had this in my 3.16 merge window queue, but it is small and obvious enough for 3.15. I cherry-picked and retested against current rc8" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: send, fix corrupted path strings for long paths
-rw-r--r--fs/btrfs/send.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index fd38b5053479..484aacac2c89 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -360,10 +360,13 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
/*
* First time the inline_buf does not suffice
*/
- if (p->buf == p->inline_buf)
+ if (p->buf == p->inline_buf) {
tmp_buf = kmalloc(len, GFP_NOFS);
- else
+ if (tmp_buf)
+ memcpy(tmp_buf, p->buf, old_buf_len);
+ } else {
tmp_buf = krealloc(p->buf, len, GFP_NOFS);
+ }
if (!tmp_buf)
return -ENOMEM;
p->buf = tmp_buf;