]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
ice: Fix memory management in ice_ethtool_fdir.c
authorJedrzej Jagielski <jedrzej.jagielski@intel.com>
Fri, 21 Jul 2023 15:58:54 +0000 (08:58 -0700)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:48 +0000 (17:20 +0200)
commit30f6fb13f5a5c538200eb1510dc9bc38264ff899
tree6b0f694b452899e602d4f5da8f0753fd4f542980
parent956233bf68d5a8a8c66ecd9bc5cd86e7aabdecd7
ice: Fix memory management in ice_ethtool_fdir.c

BugLink: https://bugs.launchpad.net/bugs/2037005
[ Upstream commit a3336056504d780590ac6d6ac94fbba829994594 ]

Fix ethtool FDIR logic to not use memory after its release.
In the ice_ethtool_fdir.c file there are 2 spots where code can
refer to pointers which may be missing.

In the ice_cfg_fdir_xtrct_seq() function seg may be freed but
even then may be still used by memcpy(&tun_seg[1], seg, sizeof(*seg)).

In the ice_add_fdir_ethtool() function struct ice_fdir_fltr *input
may first fail to be added via ice_fdir_update_list_entry() but then
may be deleted by ice_fdir_update_list_entry.

Terminate in both cases when the returned value of the previous
operation is other than 0, free memory and don't use it anymore.

Reported-by: Michal Schmidt <mschmidt@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2208423
Fixes: cac2a27cd9ab ("ice: Support IPv4 Flow Director filters")
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20230721155854.1292805-1-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c