summaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorReshetova, Elena <elena.reshetova@intel.com>2017-06-30 06:07:55 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-01 10:39:07 -0400
commit9f23743017d11c103b38d2fa1f64674baeca41cd (patch)
tree272ef703abacf82daa5059b911f2a52159734294 /net/atm
parent1cc9a98b59ba92fece1277f76aa43e05f34936a6 (diff)
net: convert neighbour.refcnt from atomic_t to refcount_t
refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations. Signed-off-by: Elena Reshetova <elena.reshetova@intel.com> Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: David Windsor <dwindsor@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/clip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c
index a7e4018370b4..47c36f449df0 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -137,11 +137,11 @@ static int neigh_check_cb(struct neighbour *n)
137 if (entry->vccs || time_before(jiffies, entry->expires)) 137 if (entry->vccs || time_before(jiffies, entry->expires))
138 return 0; 138 return 0;
139 139
140 if (atomic_read(&n->refcnt) > 1) { 140 if (refcount_read(&n->refcnt) > 1) {
141 struct sk_buff *skb; 141 struct sk_buff *skb;
142 142
143 pr_debug("destruction postponed with ref %d\n", 143 pr_debug("destruction postponed with ref %d\n",
144 atomic_read(&n->refcnt)); 144 refcount_read(&n->refcnt));
145 145
146 while ((skb = skb_dequeue(&n->arp_queue)) != NULL) 146 while ((skb = skb_dequeue(&n->arp_queue)) != NULL)
147 dev_kfree_skb(skb); 147 dev_kfree_skb(skb);
@@ -767,7 +767,7 @@ static void atmarp_info(struct seq_file *seq, struct neighbour *n,
767 seq_printf(seq, "(resolving)\n"); 767 seq_printf(seq, "(resolving)\n");
768 else 768 else
769 seq_printf(seq, "(expired, ref %d)\n", 769 seq_printf(seq, "(expired, ref %d)\n",
770 atomic_read(&entry->neigh->refcnt)); 770 refcount_read(&entry->neigh->refcnt));
771 } else if (!svc) { 771 } else if (!svc) {
772 seq_printf(seq, "%d.%d.%d\n", 772 seq_printf(seq, "%d.%d.%d\n",
773 clip_vcc->vcc->dev->number, 773 clip_vcc->vcc->dev->number,