All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
	yotamg@mellanox.com, ogerlitz@mellanox.com, j.vosburgh@gmail.com,
	vfalico@gmail.com, gospo@cumulusnetworks.com,
	dsa@cumulusnetworks.com, nikolay@cumulusnetworks.com,
	pjonnala@broadcom.com, f.fainelli@gmail.com, sfeldma@gmail.com,
	roopa@cumulusnetworks.com, andrew@lunn.ch
Subject: Re: [patch net-next v2 01/28] net: dev: Check CHANGEUPPER notifier return value
Date: Wed, 02 Dec 2015 15:20:50 -0800	[thread overview]
Message-ID: <565F7CD2.2080207@gmail.com> (raw)
In-Reply-To: <1449086871-19911-2-git-send-email-jiri@resnulli.us>

On 15-12-02 12:07 PM, Jiri Pirko wrote:
> From: Ido Schimmel <idosch@mellanox.com>
> 
> switchdev drivers reflect the newly requested topology to hardware when
> CHANGEUPPER is received, after software links were already formed.
> However, the operation can fail and user will not be notified, as the
> return value of the notifier is not checked.
> 
> Add this check and rollback software links if necessary.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>
> ---
> v1->v2:
> -new patch
> ---
>  net/core/dev.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 5df6cbc..df33f82 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5490,8 +5490,11 @@ static int __netdev_upper_dev_link(struct net_device *dev,
>  			goto rollback_lower_mesh;
>  	}
>  
> -	call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
> -				      &changeupper_info.info);
> +	ret = call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, dev,
> +					    &changeupper_info.info);
> +	if (ret)
> +		goto rollback_lower_mesh;
> +

hmm small nit (take it or leave it) but I think it would be more
correct if this was

	if (ret == NOTIFY_BAD)
		goto rollback_lower_mesh;

It seems that NOTIFY_DONE, NOTIFY_OK and NOTIFY_STOP_MASK would be
valid return codes that don't indicate an error. However seeing I
couldn't find any cases of NOTIFY_OK/NOTIFY_STOP_MASK from the
CHANGEUPPER event it doesn't matter in practice.

Thanks,
John

>  	return 0;
>  
>  rollback_lower_mesh:
> 

  parent reply	other threads:[~2015-12-02 23:21 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 20:07 [patch net-next v2 00/28] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 01/28] net: dev: Check CHANGEUPPER notifier return value Jiri Pirko
2015-12-02 20:23   ` Nikolay Aleksandrov
2015-12-02 23:20   ` John Fastabend [this message]
2015-12-03  6:37     ` Or Gerlitz
2015-12-03  8:25     ` Ido Schimmel
2015-12-02 20:07 ` [patch net-next v2 02/28] net: Add support for CHANGEUPPER notifier error injection Jiri Pirko
2015-12-02 20:23   ` Nikolay Aleksandrov
2015-12-02 20:07 ` [patch net-next v2 03/28] bonding: add 802.3ad support for 100G speeds Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 04/28] net: add netif_is_team_master helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 05/28] net: add netif_is_team_port helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 06/28] net: add netif_is_lag_master helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 07/28] net: add netif_is_lag_port helper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 08/28] net: propagate upper priv via netdev_master_upper_dev_link Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 09/28] net: add possibility to pass information about upper device via notifier Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 10/28] net: add info struct for LAG changeupper Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 11/28] team: fill-up LAG changeupper info struct and pass it along Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 12/28] bonding: " Jiri Pirko
2015-12-02 20:27   ` Nikolay Aleksandrov
2015-12-02 20:07 ` [patch net-next v2 13/28] net: introduce change lower state notifier Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 14/28] net: introduce lower state changed info structure for LAG lowers Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 15/28] team: rtnl_lock for options set Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 16/28] team: implement lower state change propagation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 17/28] bonding: allow notifications for bond_set_slave_link_state Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 18/28] bonding: implement lower state change propagation Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 19/28] bonding: set inactive flags on release Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 20/28] mlxsw: spectrum: Add set_rx_mode ndo stub Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 21/28] mlxsw: core: Add support for packets received from LAG port Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 22/28] mlxsw: pci: Implement LAG processing for received packets Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 23/28] mlxsw: reg: Add link aggregation configuration registers definitions Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 24/28] mlxsw: reg: Add definition of LAG unicast record for SFD register Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 25/28] mlxsw: reg: Add definition of LAG unicast record for SFN register Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 26/28] mlxsw: spectrum: Implement LAG port join/leave Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 27/28] mlxsw: spectrum: Implement FDB add/remove/dump for LAG Jiri Pirko
2015-12-02 20:07 ` [patch net-next v2 28/28] mlxsw: spectrum: Implement LAG tx enabled lower state change Jiri Pirko
2015-12-02 22:53 ` [patch net-next v2 00/28] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-02 23:38   ` David Miller
2015-12-03  8:21     ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=565F7CD2.2080207@gmail.com \
    --to=john.fastabend@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=eladr@mellanox.com \
    --cc=f.fainelli@gmail.com \
    --cc=gospo@cumulusnetworks.com \
    --cc=idosch@mellanox.com \
    --cc=j.vosburgh@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=ogerlitz@mellanox.com \
    --cc=pjonnala@broadcom.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=sfeldma@gmail.com \
    --cc=vfalico@gmail.com \
    --cc=yotamg@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.