All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] sfc: fix dereference of table before it is null checked
@ 2020-05-12 17:13 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-05-12 17:13 UTC (permalink / raw)
  To: Solarflare linux maintainers, Edward Cree, Martin Habets,
	David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently pointer table is being dereferenced on a null check of
table->must_restore_filters before it is being null checked, leading
to a potential null pointer dereference issue.  Fix this by null
checking table before dereferencing it when checking for a null
table->must_restore_filters.

Addresses-Coverity: ("Dereference before null check")
Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/sfc/mcdi_filters.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 88de95a8c08c..455a62814fb9 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -1369,10 +1369,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx)
 
 	WARN_ON(!rwsem_is_locked(&efx->filter_sem));
 
-	if (!table->must_restore_filters)
-		return;
-
-	if (!table)
+	if (!table || !table->must_restore_filters)
 		return;
 
 	down_write(&table->lock);
-- 
2.25.1


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

* [PATCH][next] sfc: fix dereference of table before it is null checked
@ 2020-05-12 17:13 ` Colin King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin King @ 2020-05-12 17:13 UTC (permalink / raw)
  To: Solarflare linux maintainers, Edward Cree, Martin Habets,
	David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently pointer table is being dereferenced on a null check of
table->must_restore_filters before it is being null checked, leading
to a potential null pointer dereference issue.  Fix this by null
checking table before dereferencing it when checking for a null
table->must_restore_filters.

Addresses-Coverity: ("Dereference before null check")
Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/sfc/mcdi_filters.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/sfc/mcdi_filters.c b/drivers/net/ethernet/sfc/mcdi_filters.c
index 88de95a8c08c..455a62814fb9 100644
--- a/drivers/net/ethernet/sfc/mcdi_filters.c
+++ b/drivers/net/ethernet/sfc/mcdi_filters.c
@@ -1369,10 +1369,7 @@ void efx_mcdi_filter_table_restore(struct efx_nic *efx)
 
 	WARN_ON(!rwsem_is_locked(&efx->filter_sem));
 
-	if (!table->must_restore_filters)
-		return;
-
-	if (!table)
+	if (!table || !table->must_restore_filters)
 		return;
 
 	down_write(&table->lock);
-- 
2.25.1

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

* Re: [PATCH][next] sfc: fix dereference of table before it is null checked
  2020-05-12 17:13 ` Colin King
@ 2020-05-13  9:39   ` Edward Cree
  -1 siblings, 0 replies; 6+ messages in thread
From: Edward Cree @ 2020-05-13  9:39 UTC (permalink / raw)
  To: Colin King, Solarflare linux maintainers, Martin Habets,
	David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

On 12/05/2020 18:13, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently pointer table is being dereferenced on a null check of
> table->must_restore_filters before it is being null checked, leading
> to a potential null pointer dereference issue.  Fix this by null
> checking table before dereferencing it when checking for a null
> table->must_restore_filters.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Edward Cree <ecree@solarflare.com>

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

* Re: [PATCH][next] sfc: fix dereference of table before it is null checked
@ 2020-05-13  9:39   ` Edward Cree
  0 siblings, 0 replies; 6+ messages in thread
From: Edward Cree @ 2020-05-13  9:39 UTC (permalink / raw)
  To: Colin King, Solarflare linux maintainers, Martin Habets,
	David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

On 12/05/2020 18:13, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently pointer table is being dereferenced on a null check of
> table->must_restore_filters before it is being null checked, leading
> to a potential null pointer dereference issue.  Fix this by null
> checking table before dereferencing it when checking for a null
> table->must_restore_filters.
>
> Addresses-Coverity: ("Dereference before null check")
> Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Edward Cree <ecree@solarflare.com>

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

* Re: [PATCH][next] sfc: fix dereference of table before it is null checked
  2020-05-12 17:13 ` Colin King
@ 2020-05-13 22:20   ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-13 22:20 UTC (permalink / raw)
  To: colin.king
  Cc: linux-net-drivers, ecree, mhabets, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Tue, 12 May 2020 18:13:55 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently pointer table is being dereferenced on a null check of
> table->must_restore_filters before it is being null checked, leading
> to a potential null pointer dereference issue.  Fix this by null
> checking table before dereferencing it when checking for a null
> table->must_restore_filters.
> 
> Addresses-Coverity: ("Dereference before null check")
> Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.

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

* Re: [PATCH][next] sfc: fix dereference of table before it is null checked
@ 2020-05-13 22:20   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-05-13 22:20 UTC (permalink / raw)
  To: colin.king
  Cc: linux-net-drivers, ecree, mhabets, netdev, kernel-janitors, linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Tue, 12 May 2020 18:13:55 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently pointer table is being dereferenced on a null check of
> table->must_restore_filters before it is being null checked, leading
> to a potential null pointer dereference issue.  Fix this by null
> checking table before dereferencing it when checking for a null
> table->must_restore_filters.
> 
> Addresses-Coverity: ("Dereference before null check")
> Fixes: e4fe938cff04 ("sfc: move 'must restore' flags out of ef10-specific nic_data")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thanks.

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

end of thread, other threads:[~2020-05-13 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 17:13 [PATCH][next] sfc: fix dereference of table before it is null checked Colin King
2020-05-12 17:13 ` Colin King
2020-05-13  9:39 ` Edward Cree
2020-05-13  9:39   ` Edward Cree
2020-05-13 22:20 ` David Miller
2020-05-13 22:20   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.