Commit d8e4771f authored by Dan Carpenter's avatar Dan Carpenter Committed by Miquel Raynal
Browse files

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: 6d734f1b ("mtd: rawnand: atmel: Fix possible memory leak")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 40384c84
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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;