diff options
author | Vlad Yasevich | 2013-04-02 16:10:07 -0500 |
---|---|---|
committer | Greg Kroah-Hartman | 2013-05-01 11:46:16 -0500 |
commit | 54c3688854c2a11f6960579d15a74d1dd7b10706 (patch) | |
tree | 4aef8d88096f48f1b07e3b5eb7e73a65df2ead07 /net | |
parent | b30430f11d0da68f0ea9a7aa168df2690da4608c (diff) | |
download | kernel-video-54c3688854c2a11f6960579d15a74d1dd7b10706.tar.gz kernel-video-54c3688854c2a11f6960579d15a74d1dd7b10706.tar.xz kernel-video-54c3688854c2a11f6960579d15a74d1dd7b10706.zip |
net: count hw_addr syncs so that unsync works properly.
[ Upstream commit 4543fbefe6e06a9e40d9f2b28d688393a299f079 ]
A few drivers use dev_uc_sync/unsync to synchronize the
address lists from master down to slave/lower devices. In
some cases (bond/team) a single address list is synched down
to multiple devices. At the time of unsync, we have a leak
in these lower devices, because "synced" is treated as a
boolean and the address will not be unsynced for anything after
the first device/call.
Treat "synced" as a count (same as refcount) and allow all
unsync calls to work.
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev_addr_lists.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index b079c7bbc15..7841d87b86f 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -38,7 +38,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list, | |||
38 | ha->type = addr_type; | 38 | ha->type = addr_type; |
39 | ha->refcount = 1; | 39 | ha->refcount = 1; |
40 | ha->global_use = global; | 40 | ha->global_use = global; |
41 | ha->synced = false; | 41 | ha->synced = 0; |
42 | list_add_tail_rcu(&ha->list, &list->list); | 42 | list_add_tail_rcu(&ha->list, &list->list); |
43 | list->count++; | 43 | list->count++; |
44 | 44 | ||
@@ -166,7 +166,7 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list, | |||
166 | addr_len, ha->type); | 166 | addr_len, ha->type); |
167 | if (err) | 167 | if (err) |
168 | break; | 168 | break; |
169 | ha->synced = true; | 169 | ha->synced++; |
170 | ha->refcount++; | 170 | ha->refcount++; |
171 | } else if (ha->refcount == 1) { | 171 | } else if (ha->refcount == 1) { |
172 | __hw_addr_del(to_list, ha->addr, addr_len, ha->type); | 172 | __hw_addr_del(to_list, ha->addr, addr_len, ha->type); |
@@ -187,7 +187,7 @@ void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, | |||
187 | if (ha->synced) { | 187 | if (ha->synced) { |
188 | __hw_addr_del(to_list, ha->addr, | 188 | __hw_addr_del(to_list, ha->addr, |
189 | addr_len, ha->type); | 189 | addr_len, ha->type); |
190 | ha->synced = false; | 190 | ha->synced--; |
191 | __hw_addr_del(from_list, ha->addr, | 191 | __hw_addr_del(from_list, ha->addr, |
192 | addr_len, ha->type); | 192 | addr_len, ha->type); |
193 | } | 193 | } |