[2/2,net-next] net_failover: fix error code in net_failover_create()
diff mbox series

Message ID 20180531120425.tqwhhfxqawjuvtws@kili.mountain
State Changes Requested, archived
Delegated to: David Miller
Headers show
Series
  • [1/2,net-next] net_failover: fix net_failover_compute_features()
Related show

Commit Message

Dan Carpenter May 31, 2018, 12:04 p.m. UTC
We forgot to set the error code on this path.  This function is supposed
to return error pointers, so with this bug it accidentally returns NULL
and the caller doesn't check for that.

Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Samudrala, Sridhar May 31, 2018, 5:26 p.m. UTC | #1
On 5/31/2018 5:04 AM, Dan Carpenter wrote:
> We forgot to set the error code on this path.  This function is supposed
> to return error pointers, so with this bug it accidentally returns NULL
> and the caller doesn't check for that.
>
> Fixes: cfc80d9a1163 ("net: Introduce net_failover driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>

>
> diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
> index ef50158e90a9..881f3fa13e6b 100644
> --- a/drivers/net/net_failover.c
> +++ b/drivers/net/net_failover.c
> @@ -761,8 +761,10 @@ struct failover *net_failover_create(struct net_device *standby_dev)
>   	netif_carrier_off(failover_dev);
>   
>   	failover = failover_register(failover_dev, &net_failover_ops);
> -	if (IS_ERR(failover))
> +	if (IS_ERR(failover)) {
> +		err = PTR_ERR(failover);
>   		goto err_failover_register;
> +	}
>   
>   	return failover;
>

Patch
diff mbox series

diff --git a/drivers/net/net_failover.c b/drivers/net/net_failover.c
index ef50158e90a9..881f3fa13e6b 100644
--- a/drivers/net/net_failover.c
+++ b/drivers/net/net_failover.c
@@ -761,8 +761,10 @@  struct failover *net_failover_create(struct net_device *standby_dev)
 	netif_carrier_off(failover_dev);
 
 	failover = failover_register(failover_dev, &net_failover_ops);
-	if (IS_ERR(failover))
+	if (IS_ERR(failover)) {
+		err = PTR_ERR(failover);
 		goto err_failover_register;
+	}
 
 	return failover;