tipc: ensure all name sequences are properly protected with its lock
authorYing Xue <ying.xue@windriver.com>
Tue, 2 Dec 2014 07:00:26 +0000 (15:00 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Dec 2014 01:39:56 +0000 (20:39 -0500)
commitfb9962f3cefeba8c5addc96dceb8bc360062ab50
tree9a42f3c86666854a6b1221b89d4971dc9584055a
parent38622f41956f92a06f5b5e42e50746851110d970
tipc: ensure all name sequences are properly protected with its lock

TIPC internally created a name table which is used to store name
sequences. Now there is a read-write lock - tipc_nametbl_lock to
protect the table, and each name sequence saved in the table is
protected with its private lock. When a name sequence is inserted
or removed to or from the table, its members might need to change.
Therefore, in normal case, the two locks must be held while TIPC
operates the table. However, there are still several places where
we only hold tipc_nametbl_lock without proprerly obtaining name
sequence lock, which might cause the corruption of name sequence.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Reviewed-by: Erik Hugne <erik.hugne@ericsson.com>
Reviewed-by: Jon Maloy <jon.maloy@ericsson.com>
Tested-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/name_table.c