From: Michael Neuling <mikey@neuling.org>
To: Al Viro <viro@ftp.linux.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] Chained CPIOs writing to the same file bug
Date: Thu, 16 Feb 2006 18:37:45 +1100 [thread overview]
Message-ID: <20060216183745.50cc2bf6.mikey@neuling.org> (raw)
You can chain CPIOs together for the initramfs, but if two CPIOs write
to the same file, we don't clear the first before writing the second.
If the first is larger than the second, we end up with a mash of the
two. Trivial patch below to fix this.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
init/initramfs.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletion(-)
Index: linux-2.6-linus/init/initramfs.c
===================================================================
--- linux-2.6-linus.orig/init/initramfs.c
+++ linux-2.6-linus/init/initramfs.c
@@ -250,7 +250,8 @@ static int __init do_name(void)
return 0;
if (S_ISREG(mode)) {
if (maybe_link() >= 0) {
- wfd = sys_open(collected, O_WRONLY|O_CREAT, mode);
+ wfd = sys_open(collected, O_WRONLY|O_CREAT|O_TRUNC,
+ mode);
if (wfd >= 0) {
sys_fchown(wfd, uid, gid);
sys_fchmod(wfd, mode);
next reply other threads:[~2006-02-16 7:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-16 7:37 Michael Neuling [this message]
[not found] ` <20060217160621.99b0ffd4.mikey@neuling.org>
2006-02-21 23:45 ` [PATCH] initramfs: multiple CPIO unpacking fix Michael Neuling
2006-02-22 2:14 ` [klibc] " Jeff Bailey
2006-02-22 2:17 ` H. Peter Anvin
2006-03-22 6:12 ` [PATCH] initramfs: " Michael Neuling
2006-03-22 7:14 ` Jeff Garzik
2006-03-22 16:05 ` [klibc] " H. Peter Anvin
2006-03-22 22:23 ` Rob Landley
2006-03-22 23:22 ` Jeff Garzik
2006-04-07 17:33 ` H. Peter Anvin
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=20060216183745.50cc2bf6.mikey@neuling.org \
--to=mikey@neuling.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/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