More cases to use ieee80211_skb_copy_noderef

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3262 0192ed92-7a03-0410-a25b-9323aeb14dbd
This commit is contained in:
mentor 2008-01-26 17:46:36 +00:00
parent 776a840f28
commit 0b74c2ebe0
3 changed files with 14 additions and 29 deletions

View File

@ -3123,8 +3123,7 @@ ath_hardstart(struct sk_buff *skb, struct net_device *dev)
requeue = 1; requeue = 1;
goto hardstart_fail; goto hardstart_fail;
} }
/* If the clone works, bump the reference count for our copy. */ ieee80211_skb_copy_noderef(skb_orig, skb);
SKB_CB(skb)->ni = ieee80211_ref_node(SKB_CB(skb_orig)->ni);
ieee80211_dev_kfree_skb(&skb_orig); ieee80211_dev_kfree_skb(&skb_orig);
} else { } else {
if (SKB_CB(skb)->ni != NULL) if (SKB_CB(skb)->ni != NULL)
@ -6006,10 +6005,7 @@ ath_skb_removepad(struct sk_buff *skb, unsigned int copy_skb)
tskb = skb_copy(skb, GFP_ATOMIC); tskb = skb_copy(skb, GFP_ATOMIC);
if (tskb == NULL) if (tskb == NULL)
return NULL; return NULL;
/* Reference any node from the source skb. */ ieee80211_skb_copy_noderef(skb, tskb);
if (SKB_CB(skb)->ni != NULL)
SKB_CB(tskb)->ni = ieee80211_ref_node(
SKB_CB(skb)->ni);
} }
memmove(tskb->data + padbytes, tskb->data, headersize); memmove(tskb->data + padbytes, tskb->data, headersize);
skb_pull(tskb, padbytes); skb_pull(tskb, padbytes);

View File

@ -387,10 +387,8 @@ ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb,
/* XXX stat+msg */ /* XXX stat+msg */
continue; continue;
} }
/* We duplicate the reference after skb_copy */ ieee80211_skb_copy_noderef(skb, skb1);
if (SKB_CB(skb)->ni != NULL) {
SKB_CB(skb1)->ni = ieee80211_ref_node(SKB_CB(skb)->ni);
}
if (vap->iv_monitor_txf_len && tx) { if (vap->iv_monitor_txf_len && tx) {
/* truncate transmit feedback packets */ /* truncate transmit feedback packets */
skb_trim(skb1, vap->iv_monitor_txf_len); skb_trim(skb1, vap->iv_monitor_txf_len);

View File

@ -631,11 +631,6 @@ ieee80211_skbhdr_adjust(struct ieee80211vap *vap, int hdrsize,
if (skb_headroom(skb) < need_headroom) { if (skb_headroom(skb) < need_headroom) {
struct sk_buff *tmp = skb; struct sk_buff *tmp = skb;
skb = skb_realloc_headroom(skb, need_headroom); skb = skb_realloc_headroom(skb, need_headroom);
/* Increment reference count after copy */
if (NULL != skb && SKB_CB(tmp)->ni != NULL) {
SKB_CB(skb)->ni = ieee80211_ref_node(SKB_CB(tmp)->ni);
}
ieee80211_dev_kfree_skb(&tmp);
if (skb == NULL) { if (skb == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
"%s: cannot expand storage (head1)\n", "%s: cannot expand storage (head1)\n",
@ -643,10 +638,11 @@ ieee80211_skbhdr_adjust(struct ieee80211vap *vap, int hdrsize,
vap->iv_stats.is_tx_nobuf++; vap->iv_stats.is_tx_nobuf++;
ieee80211_dev_kfree_skb(&skb2); ieee80211_dev_kfree_skb(&skb2);
return NULL; return NULL;
} } else
ieee80211_skb_copy_noderef(tmp, skb);
ieee80211_dev_kfree_skb(&tmp);
/* NB: cb[] area was copied, but not next ptr. must do that /* NB: cb[] area was copied, but not next ptr. must do that
* prior to return on success. * prior to return on success. */
*/
} }
/* second skb with header and tail adjustments possible */ /* second skb with header and tail adjustments possible */
@ -668,11 +664,6 @@ ieee80211_skbhdr_adjust(struct ieee80211vap *vap, int hdrsize,
struct sk_buff *tmp = skb2; struct sk_buff *tmp = skb2;
skb2 = skb_realloc_headroom(skb2, inter_headroom); skb2 = skb_realloc_headroom(skb2, inter_headroom);
/* Increment reference count after copy */
if (NULL != skb2 && SKB_CB(tmp)->ni != NULL) {
SKB_CB(skb2)->ni = ieee80211_ref_node(SKB_CB(tmp)->ni);
}
ieee80211_dev_kfree_skb(&tmp);
if (skb2 == NULL) { if (skb2 == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
"%s: cannot expand storage (head2)\n", "%s: cannot expand storage (head2)\n",
@ -681,7 +672,9 @@ ieee80211_skbhdr_adjust(struct ieee80211vap *vap, int hdrsize,
/* this shouldn't happen, but don't send first ff either */ /* this shouldn't happen, but don't send first ff either */
ieee80211_dev_kfree_skb(&skb); ieee80211_dev_kfree_skb(&skb);
skb = NULL; skb = NULL;
} } else
ieee80211_skb_copy_noderef(tmp, skb);
ieee80211_dev_kfree_skb(&tmp);
} }
if (skb) { if (skb) {
skb->next = skb2; skb->next = skb2;
@ -708,15 +701,13 @@ ieee80211_skbhdr_adjust(struct ieee80211vap *vap, int hdrsize,
struct sk_buff *tmp = skb; struct sk_buff *tmp = skb;
skb = skb_realloc_headroom(skb, need_headroom); skb = skb_realloc_headroom(skb, need_headroom);
/* Increment reference count after copy */ /* Increment reference count after copy */
if (NULL != skb && SKB_CB(tmp)->ni != NULL) {
SKB_CB(skb)->ni = ieee80211_ref_node(SKB_CB(tmp)->ni);
}
ieee80211_dev_kfree_skb(&tmp);
if (skb == NULL) { if (skb == NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT, IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
"%s: cannot expand storage (head)\n", __func__); "%s: cannot expand storage (head)\n", __func__);
vap->iv_stats.is_tx_nobuf++; vap->iv_stats.is_tx_nobuf++;
} } else
ieee80211_skb_copy_noderef(tmp, skb);
ieee80211_dev_kfree_skb(&tmp);
} }
return skb; return skb;