Commit 446ab1fc authored by Pavel Emelyanov's avatar Pavel Emelyanov

irmap: Don't let proc-parse free handle's mem before caching

Bug was introduced by on-disk-irmap-cache patch. The proc-parse
routine allocates memory for handle, calls ->cb then frees handle.

The problem is that the cb in case of pre-dump saves the handle
for future reference. So, in this future handle's mem happen to
be corrupted.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c4b5a9d5
......@@ -271,6 +271,7 @@ int irmap_queue_cache(unsigned int dev, unsigned long ino,
ip->dev = dev;
ip->ino = ino;
ip->fh = *fh;
fh->handle = NULL; /* don't free in free_fhandle */
pr_debug("Queue %x:%lx for pre-dump\n", dev, ino);
......
......@@ -854,7 +854,8 @@ static int alloc_fhandle(FhEntry *fh)
static void free_fhandle(FhEntry *fh)
{
xfree(fh->handle);
if (fh->handle)
xfree(fh->handle);
}
static void parse_fhandle_encoded(char *tok, FhEntry *fh)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment