Skip to content

Commit dd45c87

Browse files
Dan Carpentergregkh
authored andcommitted
mtd: rawnand: fix double free in atmel_pmecc_create_user()
commit d8e4771 upstream. 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: 6d734f1 ("mtd: rawnand: atmel: Fix possible memory leak") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e658f1c commit dd45c87

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/mtd/nand/raw/atmel/pmecc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,8 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc,
380380
user->delta = user->dmu + req->ecc.strength + 1;
381381

382382
gf_tables = atmel_pmecc_get_gf_tables(req);
383-
if (IS_ERR(gf_tables)) {
384-
kfree(user);
383+
if (IS_ERR(gf_tables))
385384
return ERR_CAST(gf_tables);
386-
}
387385

388386
user->gf_tables = gf_tables;
389387

0 commit comments

Comments
 (0)