All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
To: Simon Horman <simon.horman@netronome.com>,
	Scott Feldman <sfeldma@gmail.com>, Jiri Pirko <jiri@resnulli.us>,
	David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v3 net-next 3/4] rocker: do not make neighbour entry changes when preparing transactions
Date: Wed, 20 May 2015 15:15:23 +0900	[thread overview]
Message-ID: <555C267B.9070807@lab.ntt.co.jp> (raw)
In-Reply-To: <1432100902-10187-4-git-send-email-simon.horman@netronome.com>

On 2015/05/20 14:48, Simon Horman wrote:
> rocker_port_ipv4_nh() and in turn rocker_port_ipv4_neigh() may be
> be called with trans == SWITCHDEV_TRANS_PREPARE and then
> trans == SWITCHDEV_TRANS_COMMIT from switchdev_port_obj_set() via
> fib_table_insert().
> 
> The first time that rocker_port_ipv4_nh() is called, with
> trans == SWITCHDEV_TRANS_PREPARE, _rocker_neigh_add() adds a new entry to
> the neigh table.
> 
> And the second time  rocker_port_ipv4_nh() is called, with
> trans == SWITCHDEV_TRANS_COMMIT, that entry is found. This causes
> rocker_port_ipv4_nh() to believe it is not adding an entry and thus it
> frees "entry", which is still present in rocker driver's neigh table.
> 
> This problem does not appear to affect deletion as my analysis is that
> deletion is always performed with trans == SWITCHDEV_TRANS_NONE.
> 
> For completeness _rocker_neigh_{add,del,prepare} are updated not to
> manipulate fib table entries if trans == SWITCHDEV_TRANS_PREPARE.
> 
> Fixes: c4f20321d968 ("rocker: support prepare-commit transaction model")
> Reported-by: oshiaki Makita <makita.toshiaki@lab.ntt.co.jp>

'T' is missing from my first name

> Acked-by: Scott Feldman <sfeldma@gmail.com>
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> 
...
>  static void _rocker_neigh_add(struct rocker *rocker,
> +			      enum switchdev_trans trans,
>  			      struct rocker_neigh_tbl_entry *entry)
>  {
> +	if (trans == SWITCHDEV_TRANS_PREPARE)
> +		return;
>  	entry->index = rocker->neigh_tbl_next_index++;

Isn't index needed here? It looks to be used in later function call and
logging.
How about setting index like this?

	entry->index = rocker->neigh_tbl_next_index;
	if (trans == PREPARE)
		return;
	rocker->neigh_tbl_next_index++;
	...

Thanks,
Toshiaki Makita

  parent reply	other threads:[~2015-05-20  6:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-20  5:48 [PATCH v3 net-next 0/4] rocker: transaction fixes Simon Horman
2015-05-20  5:48 ` [PATCH v3 net-next 1/4] rocker: do not delete fdb entries in rocker_port_fdb_flush() when preparing transactions Simon Horman
2015-05-20  6:01   ` Jiri Pirko
2015-05-20  5:48 ` [PATCH v3 net-next 2/4] rocker: do not modify fdb table in rocker_port_fdb() " Simon Horman
2015-05-20  6:01   ` Jiri Pirko
2015-05-20  5:48 ` [PATCH v3 net-next 3/4] rocker: do not make neighbour entry changes " Simon Horman
2015-05-20  6:01   ` Jiri Pirko
2015-05-20  6:15   ` Toshiaki Makita [this message]
2015-05-20  7:48     ` Simon Horman
2015-05-20  8:36       ` Toshiaki Makita
2015-05-20  8:46         ` Simon Horman
2015-05-20 11:17           ` Jiri Pirko
2015-05-20 12:57             ` Simon Horman
2015-05-20 17:37               ` Scott Feldman
2015-05-20 22:32                 ` Simon Horman
2015-05-20 23:59                   ` Scott Feldman
2015-05-20  5:48 ` [PATCH v3 net-next 4/4] rocker: make rocker_port_internal_vlan_id_{get,put}() non-transactional Simon Horman
2015-05-20  6:02   ` 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=555C267B.9070807@lab.ntt.co.jp \
    --to=makita.toshiaki@lab.ntt.co.jp \
    --cc=davem@davemloft.net \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=sfeldma@gmail.com \
    --cc=simon.horman@netronome.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.