* [PATCH net v2 2/3] gve: Avoid freeing NULL pointer
2021-10-06 2:42 [PATCH net v2 1/3] gve: Correct available tx qpl check Jeroen de Borst
@ 2021-10-06 2:42 ` Jeroen de Borst
2021-10-06 2:42 ` [PATCH net v2 3/3] gve: Properly handle errors in gve_assign_qpl Jeroen de Borst
2021-10-06 14:10 ` [PATCH net v2 1/3] gve: Correct available tx qpl check patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Jeroen de Borst @ 2021-10-06 2:42 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, Tao Liu, Catherine Sully
From: Tao Liu <xliutaox@google.com>
Prevent possible crashes when cleaning up after unsuccessful
initializations.
Fixes: 893ce44df5658 ("gve: Add basic driver framework for Compute Engine Virtual NIC")
Signed-off-by: Tao Liu <xliutaox@google.com>
Signed-off-by: Catherine Sully <csully@google.com>
---
drivers/net/ethernet/google/gve/gve_main.c | 27 ++++++++++++++--------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 099a2bc5ae67..29c5f994f92e 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -82,6 +82,9 @@ static int gve_alloc_counter_array(struct gve_priv *priv)
static void gve_free_counter_array(struct gve_priv *priv)
{
+ if (!priv->counter_array)
+ return;
+
dma_free_coherent(&priv->pdev->dev,
priv->num_event_counters *
sizeof(*priv->counter_array),
@@ -142,6 +145,9 @@ static int gve_alloc_stats_report(struct gve_priv *priv)
static void gve_free_stats_report(struct gve_priv *priv)
{
+ if (!priv->stats_report)
+ return;
+
del_timer_sync(&priv->stats_report_timer);
dma_free_coherent(&priv->pdev->dev, priv->stats_report_len,
priv->stats_report, priv->stats_report_bus);
@@ -370,18 +376,19 @@ static void gve_free_notify_blocks(struct gve_priv *priv)
{
int i;
- if (priv->msix_vectors) {
- /* Free the irqs */
- for (i = 0; i < priv->num_ntfy_blks; i++) {
- struct gve_notify_block *block = &priv->ntfy_blocks[i];
- int msix_idx = i;
+ if (!priv->msix_vectors)
+ return;
- irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,
- NULL);
- free_irq(priv->msix_vectors[msix_idx].vector, block);
- }
- free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
+ /* Free the irqs */
+ for (i = 0; i < priv->num_ntfy_blks; i++) {
+ struct gve_notify_block *block = &priv->ntfy_blocks[i];
+ int msix_idx = i;
+
+ irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,
+ NULL);
+ free_irq(priv->msix_vectors[msix_idx].vector, block);
}
+ free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
dma_free_coherent(&priv->pdev->dev,
priv->num_ntfy_blks * sizeof(*priv->ntfy_blocks),
priv->ntfy_blocks, priv->ntfy_block_bus);
--
2.33.0.800.g4c38ced690-goog
v2: Removed empty line between Fixes and the other tags.
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net v2 1/3] gve: Correct available tx qpl check
2021-10-06 2:42 [PATCH net v2 1/3] gve: Correct available tx qpl check Jeroen de Borst
2021-10-06 2:42 ` [PATCH net v2 2/3] gve: Avoid freeing NULL pointer Jeroen de Borst
2021-10-06 2:42 ` [PATCH net v2 3/3] gve: Properly handle errors in gve_assign_qpl Jeroen de Borst
@ 2021-10-06 14:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-06 14:10 UTC (permalink / raw)
To: Jeroen de Borst; +Cc: netdev, davem, kuba, csully
Hello:
This series was applied to netdev/net.git (refs/heads/master):
On Tue, 5 Oct 2021 19:42:19 -0700 you wrote:
> From: Catherine Sullivan <csully@google.com>
>
> The qpl_map_size is rounded up to a multiple of sizeof(long), but the
> number of qpls doesn't have to be.
>
> Fixes: f5cedc84a30d2 ("gve: Add transmit and receive support")
> Signed-off-by: Catherine Sullivan <csully@google.com>
> Signed-off-by: Jeroen de Borst <jeroendb@google.com>
>
> [...]
Here is the summary with links:
- [net,v2,1/3] gve: Correct available tx qpl check
https://git.kernel.org/netdev/net/c/d03477ee10f4
- [net,v2,2/3] gve: Avoid freeing NULL pointer
https://git.kernel.org/netdev/net/c/922aa9bcac92
- [net,v2,3/3] gve: Properly handle errors in gve_assign_qpl
https://git.kernel.org/netdev/net/c/d4b111fda69a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread