Richard Alpe | 5 Feb 16:29 2016
Picon

[PATCH tipc-discussion v1] tipc: refactor node xmit and fix memory leaks

Refactor tipc_node_xmit() to fail fast and fail early. This commit
fixes several potential memory leaks in unexpected error paths.

-- tipc discussion --
Two thinks struck me when looking at this.

1. We claim to consume buffer chains in a lot of functions, but the
error path is often neglected.

2. Listing the potential return values in the function header is a
bad idea. There is often a discrepancy between the listed and actual
return values. In the case of tail calls for example, someone has
updated the called function to return a new value, but "forgotten" to
backtrack all callers and updating there headers.

Reported-by: Dmitry Vyukov <dvyukov <at> google.com>
Signed-off-by: Richard Alpe <richard.alpe <at> ericsson.com>
---
 net/tipc/link.c |  8 ++++++--
 net/tipc/node.c | 52 +++++++++++++++++++++++++++++++---------------------
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 0c2944f..d700be4 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
 <at>  <at>  -904,8 +904,10  <at>  <at>  int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
 		if (unlikely(l->backlog[i].len >= l->backlog[i].limit))
 			return link_schedule_user(l, list);
 	}
(Continue reading)

Parthasarathy Bhuvaragan | 2 Feb 10:52 2016
Picon

[PATCH net-next v2 00/10] tipc: cleanups, fixes & improvements for topology server

This series contains topology server cleanups, fixes and improvements.

Cleanups in #1-#4:
We remove duplicate data structures and aligin the rest of the code accordingly.

Fixes in #5-#8:
The bugs occur either during configuration or while running on SMP targets,
which are race conditions that pop up under different situations.

Improvements in #9-#10:
Updates to decrease timer usage and improve readability.

v2: Updated commit message in patch 6 based on feedback from
    Sergei Shtylyov sergei.shtylyov <at> cogentembedded.com

Parthasarathy Bhuvaragan (10):
  tipc: remove incorrect check for subscription timeout value
  tipc: remove filter and timeout elements from struct tipc_subscription
  tipc: remove struct tipc_name_seq from struct tipc_subscription
  tipc: introduce tipc_subscrb_subscribe() routine
  tipc: fix connection abort during subscription cancellation
  tipc: fix connection abort when receiving invalid cancel request
  tipc: hold subscriber->lock for tipc_nametbl_subscribe()
  tipc: protect tipc_subscrb_get() with subscriber spin lock
  tipc: donot create timers if subscription timeout = TIPC_WAIT_FOREVER
  tipc: use alloc_ordered_workqueue() instead of WQ_UNBOUND w/
    max_active = 1

 net/tipc/name_table.c |  14 ++++--
 net/tipc/server.c     |   4 +-
(Continue reading)

Richard Alpe | 1 Feb 08:19 2016
Picon

[PATCH net-next v1 1/2] tipc: fix link attribute propagation bug

Changing certain link attributes (link tolerance and link priority)
from the TIPC management tool is supposed to automatically take
effect at both endpoints of the affected link.

Currently the media address is not instantiated for the link and is
used uninstantiated when crafting protocol messages designated for the
peer endpoint. This means that changing a link property currently
results in the property being changed on the local machine but the
protocol message designated for the peer gets lost. Resulting in
property discrepancy between the endpoints.

In this patch we resolve this by using the media address from the
link entry and using the bearer transmit function to send it. Hence,
we can now eliminate the redundant function tipc_link_prot_xmit() and
the redundant field tipc_link::media_addr.

Fixes: 2af5ae372a4b (tipc: clean up unused code and structures)
Reviewed-by: Jon Maloy <jon.maloy <at> ericsson.com>
Reported-by: Jason Hu <huzhijiang <at> gmail.com>
Signed-off-by: Richard Alpe <richard.alpe <at> ericsson.com>
---
 net/tipc/link.c | 31 ++++++-------------------------
 net/tipc/link.h |  6 ++++--
 net/tipc/node.c |  9 ++++++---
 3 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 0c2944f..f156353 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
(Continue reading)

Jon Maloy | 1 Feb 02:12 2016
Picon

[PATCH net 1/1] tipc: fix premature addition to node lookup table

In commit 5266698661401a ("tipc: let broadcast packet reception
use new link receive function") we introduced a new per-node
broadcast reception link instance. This link is created at the
moment the node itself is created. Unfortunately, the allocation
is done after the node instance has already been added to the node
lookup hash table. This creates a potential race condition, where
arriving broadcast packets are able to find and access the node
before it has been fully initialized, and before the above mentioned
link has been created. The result is occasional crashes in the function
tipc_bcast_rcv(), which is trying to access the not-yet existing link.

We fix this by deferring the addition of the node instance until after
it has been fully initialized in the function tipc_node_create().

Signed-off-by: Jon Maloy <jon.maloy <at> ericsson.com>
---
 net/tipc/node.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/tipc/node.c b/net/tipc/node.c
index fa97d96..9d7a16f 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
 <at>  <at>  -346,12 +346,6  <at>  <at>  struct tipc_node *tipc_node_create(struct net *net, u32 addr, u16 capabilities)
 	skb_queue_head_init(&n->bc_entry.inputq2);
 	for (i = 0; i < MAX_BEARERS; i++)
 		spin_lock_init(&n->links[i].lock);
-	hlist_add_head_rcu(&n->hash, &tn->node_htable[tipc_hashfn(addr)]);
-	list_for_each_entry_rcu(temp_node, &tn->node_list, list) {
-		if (n->addr < temp_node->addr)
(Continue reading)

Parthasarathy Bhuvaragan | 26 Jan 15:01 2016
Picon

[PATCH net] tipc: fix connection abort during subscription cancel

In 'commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing
to events")', we terminate the connection if the subscription
creation fails.
In the same commit, the subscription creation result was based on
the value of subscription pointer (set in the function) instead of
the return code.

Unfortunately, the same function tipc_subscrp_create() handles
subscription cancel request. For a subscription cancellation request,
the subscription pointer cannot be set. Thus if a subscriber has
several subscriptions and cancels any of them, the connection is
terminated.

In this commit, we terminate the connection based on the return value
of tipc_subscrp_create().
Fixes: commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing to events")

Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan <at> ericsson.com>
---
 net/tipc/subscr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 350cca33ee0a..72bb7cdc85aa 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
 <at>  <at>  -293,11 +293,11  <at>  <at>  static void tipc_subscrb_rcv_cb(struct net *net, int conid,
 	struct tipc_subscription *sub = NULL;
 	struct tipc_net *tn = net_generic(net, tipc_net_id);

(Continue reading)

GUNA | 20 Jan 16:17 2016
Picon

TIPC utilities v2.0.2 compatibility with latest Linux Kernel 4.4

Hello,

Currently, system is running with Fedora Core 16 with 3.4.2-1 kernel and
using TIPC utilities v2.0.2.  The version of “tipc-config” was compiled
against 3.4.2-1 kernel.

If I upgrade the kernel to either 4.4, could I still use the same
“tipc_config” ?

If not, where the user space tipc.h and tipc_config.h files are located to
create new tipc-config based on new Kernel 4.4 ?

Thank you,

Guna B
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
tipc-discussion mailing list
tipc-discussion <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tipc-discussion
Richard Alpe | 20 Jan 13:13 2016
Picon

[PATCH net-next v2 1/2] tipc: fix link attribute propagation bug

Changing certain link attributes (link tolerance and link priority)
from the TIPC management tool is supposed to automatically take
effect at both endpoints of the affected link.

Currently the media address is not instantiated for the link and is
used uninstantiated when crafting protocol messages designated for the
peer endpoint. This means that changing a link property currently
results in the property being changed on the local machine but the
protocol message designated for the peer gets lost. Resulting in
property discrepancy between the endpoints.

In this patch we resolve this by using the media address from the
link entry and using the bearer transmit function to send it. Hence,
we can now eliminate the redundant function tipc_link_prot_xmit() and
the redundant field tipc_link::media_addr.

Fixes: 2af5ae372a4b (tipc: clean up unused code and structures)
Reported-by: Jason Hu <huzhijiang <at> gmail.com>
Signed-off-by: Richard Alpe <richard.alpe <at> ericsson.com>
---
 net/tipc/link.c | 31 ++++++-------------------------
 net/tipc/link.h |  6 ++++--
 net/tipc/node.c |  9 ++++++---
 3 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 0c2944f..f156353 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
 <at>  <at>  -123,7 +123,6  <at>  <at>  struct tipc_stats {
(Continue reading)

Jon Maloy | 19 Jan 01:08 2016
Picon

[PATCH net-next 1/1] tipc: restore inheritance of link attribute changes

Changing certain link attributes (link tolerance and link priority) from
the TIPC management tool is supposed to automatically take effect at
both endpoints of the affected link.

This feature has been broken since commit 2af5ae372a4b ("tipc: clean up
unused code and structures") because of an uninitialzed media address
in struct tipc_link, and needs to be restored.

We now ensure that a link STATE message containing the relevant
attribute is generated and sent to the remote endpoint when one of
the mentioned attributes are changed. The corresponding attribute
is updated at the receiving end whenever such a message is received.

We apply the same technique as we do with all other packet sending;
we let the link code generate the message, but we let the node send it.
Hence, we can now eliminate the redundant function tipc_link_prot_xmit()
and the redundant field tipc_link::media_addr.

Signed-off-by: Jon Maloy <jon.maloy <at> ericsson.com>
---
 net/tipc/link.c | 37 ++++++++++++-------------------------
 net/tipc/link.h |  6 ++++--
 net/tipc/node.c |  9 ++++++---
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
index 0c2944f..db9ab74 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
 <at>  <at>  -123,7 +123,6  <at>  <at>  struct tipc_stats {
(Continue reading)

Parthasarathy Bhuvaragan | 15 Jan 13:30 2016
Picon

[PATCH 00/10] tipc: cleanups, fixes & improvements for topology server

This series contains topology server cleanups, fixes and improvements.

Cleanups in #1-#4:
We remove duplicate data structures and aligin the rest of the code accordingly.

Fixes in #5-#8:
The bugs occur either during configuration or while running on SMP targets,
which are race conditions that pop up under different situations.

Improvements in #9-#10:
Updates to decrease timer usage and improve readability.

Parthasarathy Bhuvaragan (10):
  tipc: remove incorrect check for subscription timeout value
  tipc: remove filter and timeout elements from struct tipc_subscription
  tipc: remove struct tipc_name_seq from struct tipc_subscription
  tipc: introduce tipc_subscrb_subscribe() routine
  tipc: fix connection abort during subscription cancellation
  tipc: fix connection abort when receiving invalid cancel request
  tipc: hold subscriber->lock for tipc_nametbl_subscribe()
  tipc: protect tipc_subscrb_get() with subscriber spin lock
  tipc: donot create timers if subscription timeout = TIPC_WAIT_FOREVER
  tipc: use alloc_ordered_workqueue() instead of WQ_UNBOUND w/
    max_active = 1

 net/tipc/name_table.c |  14 ++++--
 net/tipc/server.c     |   4 +-
 net/tipc/subscr.c     | 131 ++++++++++++++++++++++++++++++--------------------
 net/tipc/subscr.h     |  11 ++---
 4 files changed, 96 insertions(+), 64 deletions(-)
(Continue reading)

Richard Alpe | 12 Jan 15:08 2016
Picon

[PATCH net-next v2] tipc: add peer removal functionality

Add TIPC_NL_PEER_REMOVE netlink command. This command can remove
an offline peer node from the internal data structures.

This will be supported by the tipc user space tool in iproute2.

Signed-off-by: Richard Alpe <richard.alpe <at> ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy <at> ericsson.com>
Acked-by: Ying Xue <ying.xue <at> windriver.com>
---
 include/uapi/linux/tipc_netlink.h |  1 +
 net/tipc/net.c                    |  4 +--
 net/tipc/net.h                    |  2 ++
 net/tipc/netlink.c                |  5 ++++
 net/tipc/node.c                   | 60 +++++++++++++++++++++++++++++++++++----
 net/tipc/node.h                   |  3 +-
 6 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/include/uapi/linux/tipc_netlink.h b/include/uapi/linux/tipc_netlink.h
index d4c8f14..25eb645 100644
--- a/include/uapi/linux/tipc_netlink.h
+++ b/include/uapi/linux/tipc_netlink.h
 <at>  <at>  -56,6 +56,7  <at>  <at>  enum {
 	TIPC_NL_NET_GET,
 	TIPC_NL_NET_SET,
 	TIPC_NL_NAME_TABLE_GET,
+	TIPC_NL_PEER_REMOVE,

 	__TIPC_NL_CMD_MAX,
 	TIPC_NL_CMD_MAX = __TIPC_NL_CMD_MAX - 1
diff --git a/net/tipc/net.c b/net/tipc/net.c
(Continue reading)

Richard Alpe | 12 Jan 14:30 2016
Picon

[PATCH v1] tipc: fix setting of link properties

Currently the media address is not instantiated for the link and is
used uninstantiated when crafting protocol messages designated for the
peer endpoint. This means that changing a link property currently
results in the property being changed on the local machine but the
protocol message designated for the peer gets lost. Resulting in
property discrepancy between the endpoints.

In this patch we fix this by using the media address from the link
entry.

tipc-discussion
---------------
Jon: Why do we still have media_addr left in the link struct? I was
thinking about instantiating link->media_addr to point to
&link_entry->maddr, but I guess you wanted this separation to actually
be there to distinguish between node and link?

Janson: If you want "Reported-by: Janson..." in the commit you will
have to tell me your last name. And thanks again for reporting :)
---------------

Fixes: 2af5ae372a4b (tipc: clean up unused code and structures)
Signed-off-by: Richard Alpe <richard.alpe <at> ericsson.com>
---
 net/tipc/link.c | 19 +++++++++++--------
 net/tipc/link.h |  6 ++++--
 net/tipc/node.c | 13 ++++++-------
 3 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/net/tipc/link.c b/net/tipc/link.c
(Continue reading)


Gmane