diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-10-23 10:40:56 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-12-05 11:06:43 +0100 |
commit | d8e4771f99c0400a1873235704b28bb803c83d17 (patch) | |
tree | e98606cf711382d8d995e3aae39472e433ec9852 | |
parent | Linux 6.13-rc1 (diff) | |
download | linux-d8e4771f99c0400a1873235704b28bb803c83d17.tar.xz linux-d8e4771f99c0400a1873235704b28bb803c83d17.zip |
mtd: rawnand: fix double free in atmel_pmecc_create_user()
The "user" pointer was converted from being allocated with kzalloc() to
being allocated by devm_kzalloc(). Calling kfree(user) will lead to a
double free.
Fixes: 6d734f1bfc33 ("mtd: rawnand: atmel: Fix possible memory leak")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r-- | drivers/mtd/nand/raw/atmel/pmecc.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/nand/raw/atmel/pmecc.c b/drivers/mtd/nand/raw/atmel/pmecc.c index a22aab4ed4e8..3c7dee1be21d 100644 --- a/drivers/mtd/nand/raw/atmel/pmecc.c +++ b/drivers/mtd/nand/raw/atmel/pmecc.c @@ -380,10 +380,8 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc, user->delta = user->dmu + req->ecc.strength + 1; gf_tables = atmel_pmecc_get_gf_tables(req); - if (IS_ERR(gf_tables)) { - kfree(user); + if (IS_ERR(gf_tables)) return ERR_CAST(gf_tables); - } user->gf_tables = gf_tables; |