batman-adv: Convert batadv_hard_iface to kref
batman-adv uses a self-written reference implementation which is just based on atomic_t. This is less obvious when reading the code than kref and therefore increases the change that the reference counting will be missed. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch> Signed-off-by: Antonio Quartulli <a@unstable.cc>
This commit is contained in:

کامیت شده توسط
Antonio Quartulli

والد
77ae32e898
کامیت
7a659d5694
@@ -367,7 +367,7 @@ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
|
||||
goto out;
|
||||
|
||||
if (if_outgoing != BATADV_IF_DEFAULT &&
|
||||
!atomic_inc_not_zero(&if_outgoing->refcount)) {
|
||||
!kref_get_unless_zero(&if_outgoing->refcount)) {
|
||||
kfree(orig_ifinfo);
|
||||
orig_ifinfo = NULL;
|
||||
goto out;
|
||||
@@ -447,7 +447,7 @@ batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh,
|
||||
if (!neigh_ifinfo)
|
||||
goto out;
|
||||
|
||||
if (if_outgoing && !atomic_inc_not_zero(&if_outgoing->refcount)) {
|
||||
if (if_outgoing && !kref_get_unless_zero(&if_outgoing->refcount)) {
|
||||
kfree(neigh_ifinfo);
|
||||
neigh_ifinfo = NULL;
|
||||
goto out;
|
||||
@@ -524,7 +524,7 @@ batadv_hardif_neigh_create(struct batadv_hard_iface *hard_iface,
|
||||
if (hardif_neigh)
|
||||
goto out;
|
||||
|
||||
if (!atomic_inc_not_zero(&hard_iface->refcount))
|
||||
if (!kref_get_unless_zero(&hard_iface->refcount))
|
||||
goto out;
|
||||
|
||||
hardif_neigh = kzalloc(sizeof(*hardif_neigh), GFP_ATOMIC);
|
||||
@@ -635,7 +635,7 @@ batadv_neigh_node_new(struct batadv_orig_node *orig_node,
|
||||
if (!neigh_node)
|
||||
goto out;
|
||||
|
||||
if (!atomic_inc_not_zero(&hard_iface->refcount)) {
|
||||
if (!kref_get_unless_zero(&hard_iface->refcount)) {
|
||||
kfree(neigh_node);
|
||||
neigh_node = NULL;
|
||||
goto out;
|
||||
|
مرجع در شماره جدید
Block a user