]> git.baikalelectronics.ru Git - kernel.git/commit
ice: Avoid crash from unnecessary IDA free
authorDave Ertman <david.m.ertman@intel.com>
Mon, 4 Oct 2021 12:15:25 +0000 (05:15 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Thu, 14 Oct 2021 17:14:45 +0000 (10:14 -0700)
commit40f41fb8e696ecb80c63254975210595c6d29d4b
tree71a7e1dbd0203207f5e49754e3bdc2680c41d249
parent524cd03f7305ce7401b3c49d8806f039b3cc9f7c
ice: Avoid crash from unnecessary IDA free

In the remove path, there is an attempt to free the aux_idx IDA whether
it was allocated or not.  This can potentially cause a crash when
unloading the driver on systems that do not initialize support for RDMA.
But, this free cannot be gated by the status bit for RDMA, since it is
allocated if the driver detects support for RDMA at probe time, but the
driver can enter into a state where RDMA is not supported after the IDA
has been allocated at probe time and this would lead to a memory leak.

Initialize aux_idx to an invalid value and check for a valid value when
unloading to determine if an IDA free is necessary.

Fixes: 66b2745a3246c ("ice: Initialize RDMA support")
Reported-by: Jun Miao <jun.miao@windriver.com>
Signed-off-by: Dave Ertman <david.m.ertman@intel.com>
Tested-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_main.c