summaryrefslogtreecommitdiff
path: root/net/ax25/ax25_out.c
diff options
context:
space:
mode:
authorVasily Averin <vvs@virtuozzo.com>2021-08-02 11:52:47 +0300
committerDavid S. Miller <davem@davemloft.net>2021-08-03 13:21:39 +0300
commit53744a4a72afe11779e0c69bbe0fff7dcd83e3ce (patch)
treebdbc1d7b5b49d037af81a55475a33cba5433130c /net/ax25/ax25_out.c
parent14ee70ca89e62d5888ba1bb3d8a519f233739fe8 (diff)
downloadlinux-53744a4a72afe11779e0c69bbe0fff7dcd83e3ce.tar.xz
ax25: use skb_expand_head
Use skb_expand_head() in ax25_transmit_buffer and ax25_rt_build_path. Unlike skb_realloc_headroom, new helper does not allocate a new skb if possible. Signed-off-by: Vasily Averin <vvs@virtuozzo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ax25/ax25_out.c')
-rw-r--r--net/ax25/ax25_out.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index f53751ba81b3..22f2f66c6e0a 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -325,7 +325,6 @@ void ax25_kick(ax25_cb *ax25)
void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type)
{
- struct sk_buff *skbn;
unsigned char *ptr;
int headroom;
@@ -336,18 +335,12 @@ void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type)
headroom = ax25_addr_size(ax25->digipeat);
- if (skb_headroom(skb) < headroom) {
- if ((skbn = skb_realloc_headroom(skb, headroom)) == NULL) {
+ if (unlikely(skb_headroom(skb) < headroom)) {
+ skb = skb_expand_head(skb, headroom);
+ if (!skb) {
printk(KERN_CRIT "AX.25: ax25_transmit_buffer - out of memory\n");
- kfree_skb(skb);
return;
}
-
- if (skb->sk != NULL)
- skb_set_owner_w(skbn, skb->sk);
-
- consume_skb(skb);
- skb = skbn;
}
ptr = skb_push(skb, headroom);