From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] fs: tftp: Fix NULL pointer deref in file upload
Date: Wed, 15 Mar 2023 10:53:00 +0100 [thread overview]
Message-ID: <20230315095300.2914980-1-s.hauer@pengutronix.de> (raw)
With TFTP upload the window cache is unused, but still freed in
tftp_do_close(). To avoid iterating on the uninitialized list,
initialize it unconditionally and not only for the download case.
Fixes: 3f1ea0ffcf8b ("tftp: implement UDP reorder cache using lists")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/tftp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/tftp.c b/fs/tftp.c
index a63b133caa..c6edc9969f 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -384,10 +384,10 @@ static int tftp_allocate_transfer(struct file_priv *priv)
priv->fifo = NULL;
goto err;
}
- } else {
- INIT_LIST_HEAD(&priv->cache.blocks);
}
+ INIT_LIST_HEAD(&priv->cache.blocks);
+
return 0;
err:
--
2.30.2
reply other threads:[~2023-03-15 9:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230315095300.2914980-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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