From: Ian Abbott <abbotti@mev.co.uk>
To: barebox@lists.infradead.org
Cc: Ian Abbott <abbotti@mev.co.uk>, Norbert Wiedmann <info@n-wiedmann.de>
Subject: [PATCH] state: Fix "pack" returning freed data for DTB backend
Date: Fri, 21 Apr 2017 10:53:25 +0100 [thread overview]
Message-ID: <20170421095325.7142-1-abbotti@mev.co.uk> (raw)
`state_backend_format_dtb_pack()` passes a buffer containing state
packed in flattened DTB format back to its caller via its `buf`
parameter. It then frees the buffer before returning. This means the
caller (`state_save()`) will be working on freed buffer contents before
freeing the buffer a second time itself. Fix it by removing the
spurious call to `free()`.
This should fix a bug reported by Norbert Wiedmann in
<http://lists.infradead.org/pipermail/barebox/2017-April/029980.html>.
Cc: Norbert Wiedmann <info@n-wiedmann.de>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
As reported by Norbert, there is an identical bug in the "dt-utils"
package.
---
common/state/backend_format_dtb.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/common/state/backend_format_dtb.c b/common/state/backend_format_dtb.c
index 55fa1fc59..e88cda499 100644
--- a/common/state/backend_format_dtb.c
+++ b/common/state/backend_format_dtb.c
@@ -120,8 +120,6 @@ static int state_backend_format_dtb_pack(struct state_backend_format *format,
of_delete_node(fdtb->root);
fdtb->root = root;
- free(fdt);
-
return 0;
}
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2017-04-21 9:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 9:53 Ian Abbott [this message]
2017-04-21 12:42 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170421095325.7142-1-abbotti@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=barebox@lists.infradead.org \
--cc=info@n-wiedmann.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox