[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200818115857.000078e5@intel.com>
Date: Tue, 18 Aug 2020 11:58:57 -0700
From: Jesse Brandeburg <jesse.brandeburg@...el.com>
To: Edward Cree <ecree@...arflare.com>
Cc: <linux-net-drivers@...arflare.com>, <davem@...emloft.net>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH net 3/4] sfc: null out channel->rps_flow_id after
freeing it
Edward Cree wrote:
> If an ef100_net_open() fails, ef100_net_stop() may be called without
> channel->rps_flow_id having been written; thus it may hold the address
> freed by a previous ef100_net_stop()'s call to efx_remove_filters().
> This then causes a double-free when efx_remove_filters() is called
> again, leading to a panic.
> To prevent this, after freeing it, overwrite it with NULL.
>
> Fixes: a9dc3d5612ce ("sfc_ef100: RX filter table management and related gubbins")
> Signed-off-by: Edward Cree <ecree@...arflare.com>
> ---
> drivers/net/ethernet/sfc/rx_common.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c
> index ef9bca92b0b7..5e29284c89c9 100644
> --- a/drivers/net/ethernet/sfc/rx_common.c
> +++ b/drivers/net/ethernet/sfc/rx_common.c
> @@ -849,6 +849,7 @@ void efx_remove_filters(struct efx_nic *efx)
> efx_for_each_channel(channel, efx) {
> cancel_delayed_work_sync(&channel->filter_work);
> kfree(channel->rps_flow_id);
> + channel->rps_flow_id = NULL;
> }
> #endif
> down_write(&efx->filter_sem);
>
Powered by blists - more mailing lists