* [LINUX PATCH] ubifs: Fix wrong memory allocation
@ 2020-01-09 6:52 Naga Sureshkumar Relli
2020-01-09 6:54 ` Naga Sureshkumar Relli
0 siblings, 1 reply; 2+ messages in thread
From: Naga Sureshkumar Relli @ 2020-01-09 6:52 UTC (permalink / raw)
To: nagasure; +Cc: stable
From: Sascha Hauer <s.hauer@pengutronix.de>
In create_default_filesystem() when we allocate the idx node we must use
the idx_node_size we calculated just one line before, not tmp, which
contains completely other data.
Fixes: c4de6d7e4319 ("ubifs: Refactor create_default_filesystem()")
Cc: stable@vger.kernel.org # v4.20+
Reported-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
Tested-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/ubifs/sb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index a551eb3e9b89..6681c18e52b8 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -161,7 +161,7 @@ static int create_default_filesystem(struct ubifs_info *c)
sup = kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERNEL);
mst = kzalloc(c->mst_node_alsz, GFP_KERNEL);
idx_node_size = ubifs_idx_node_sz(c, 1);
- idx = kzalloc(ALIGN(tmp, c->min_io_size), GFP_KERNEL);
+ idx = kzalloc(ALIGN(idx_node_size, c->min_io_size), GFP_KERNEL);
ino = kzalloc(ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size), GFP_KERNEL);
cs = kzalloc(ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size), GFP_KERNEL);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [LINUX PATCH] ubifs: Fix wrong memory allocation
2020-01-09 6:52 [LINUX PATCH] ubifs: Fix wrong memory allocation Naga Sureshkumar Relli
@ 2020-01-09 6:54 ` Naga Sureshkumar Relli
0 siblings, 0 replies; 2+ messages in thread
From: Naga Sureshkumar Relli @ 2020-01-09 6:54 UTC (permalink / raw)
To: Naga Sureshkumar Relli; +Cc: stable
Hi,
Please ignore this.
Thanks,
Naga Sureshkumar Relli
> -----Original Message-----
> From: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
> Sent: Thursday, January 9, 2020 12:23 PM
> To: Naga Sureshkumar Relli <nagasure@xilinx.com>
> Cc: stable@vger.kernel.org
> Subject: [LINUX PATCH] ubifs: Fix wrong memory allocation
>
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> In create_default_filesystem() when we allocate the idx node we must use the idx_node_size we
> calculated just one line before, not tmp, which contains completely other data.
>
> Fixes: c4de6d7e4319 ("ubifs: Refactor create_default_filesystem()")
> Cc: stable@vger.kernel.org # v4.20+
> Reported-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
> Tested-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> fs/ubifs/sb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index a551eb3e9b89..6681c18e52b8 100644
> --- a/fs/ubifs/sb.c
> +++ b/fs/ubifs/sb.c
> @@ -161,7 +161,7 @@ static int create_default_filesystem(struct ubifs_info *c)
> sup = kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERNEL);
> mst = kzalloc(c->mst_node_alsz, GFP_KERNEL);
> idx_node_size = ubifs_idx_node_sz(c, 1);
> - idx = kzalloc(ALIGN(tmp, c->min_io_size), GFP_KERNEL);
> + idx = kzalloc(ALIGN(idx_node_size, c->min_io_size), GFP_KERNEL);
> ino = kzalloc(ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size), GFP_KERNEL);
> cs = kzalloc(ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size), GFP_KERNEL);
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-09 6:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 6:52 [LINUX PATCH] ubifs: Fix wrong memory allocation Naga Sureshkumar Relli
2020-01-09 6:54 ` Naga Sureshkumar Relli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).