netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] mlxsw: spectrum_router: fix a use after free
@ 2016-07-07  8:20 Dan Carpenter
  2016-07-07  8:39 ` Jiri Pirko
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-07  8:20 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: Ido Schimmel, netdev, kernel-janitors

mlxsw_sp_fib_entry_destroy() frees "fib_entry" but we dereference it on
the next line.

Fixes: 61c503f976b5 ('mlxsw: spectrum_router: Implement fib4 add/del switchdev obj ops')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index e084ea5..adb481a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -1652,8 +1652,8 @@ static void mlxsw_sp_router_fib4_add_info_destroy(void const *data)
 	struct mlxsw_sp_fib_entry *fib_entry = info->fib_entry;
 	struct mlxsw_sp *mlxsw_sp = info->mlxsw_sp;
 
-	mlxsw_sp_fib_entry_destroy(fib_entry);
 	mlxsw_sp_vr_put(mlxsw_sp, fib_entry->vr);
+	mlxsw_sp_fib_entry_destroy(fib_entry);
 	kfree(info);
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-07  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-07  8:20 [patch -next] mlxsw: spectrum_router: fix a use after free Dan Carpenter
2016-07-07  8:39 ` Jiri Pirko

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).