[net-next] ibmvnic: Potential NULL dereference in clean_one_tx_pool()
diff mbox series

Message ID 20180323113615.GA28518@mwanda
State Accepted, archived
Delegated to: David Miller
Headers show
Series
  • [net-next] ibmvnic: Potential NULL dereference in clean_one_tx_pool()
Related show

Commit Message

Dan Carpenter March 23, 2018, 11:36 a.m. UTC
There is an && vs || typo here, which potentially leads to a NULL
dereference.

Fixes: e9e1e97884b7 ("ibmvnic: Update TX pool cleaning routine")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Thomas Falcon March 23, 2018, 3:06 p.m. UTC | #1
On 03/23/2018 06:36 AM, Dan Carpenter wrote:
> There is an && vs || typo here, which potentially leads to a NULL
> dereference.

Thanks for catching that!

>
> Fixes: e9e1e97884b7 ("ibmvnic: Update TX pool cleaning routine")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5632c030811b..0389a7a52152 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -1135,7 +1135,7 @@ static void clean_one_tx_pool(struct ibmvnic_adapter *adapter,
>  	u64 tx_entries;
>  	int i;
>
> -	if (!tx_pool && !tx_pool->tx_buff)
> +	if (!tx_pool || !tx_pool->tx_buff)
>  		return;
>
>  	tx_entries = tx_pool->num_buffers;
>
David Miller March 26, 2018, 1:14 a.m. UTC | #2
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Fri, 23 Mar 2018 14:36:15 +0300

> There is an && vs || typo here, which potentially leads to a NULL
> dereference.
> 
> Fixes: e9e1e97884b7 ("ibmvnic: Update TX pool cleaning routine")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks Dan.

Patch
diff mbox series

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 5632c030811b..0389a7a52152 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1135,7 +1135,7 @@  static void clean_one_tx_pool(struct ibmvnic_adapter *adapter,
 	u64 tx_entries;
 	int i;
 
-	if (!tx_pool && !tx_pool->tx_buff)
+	if (!tx_pool || !tx_pool->tx_buff)
 		return;
 
 	tx_entries = tx_pool->num_buffers;