Skip to content

Commit

Permalink
[AX25] ax25_out: check skb for NULL in ax25_kick()
Browse files Browse the repository at this point in the history
According to some OOPS reports ax25_kick tries to clone NULL skbs
sometimes. It looks like a race with ax25_clear_queues(). Probably
there is no need to add more than a simple check for this yet.
Another report suggested there are probably also cases where ax25
->paclen == 0 can happen in ax25_output(); this wasn't confirmed
during testing but let's leave this debugging check for some time.

Reported-and-tested-by: Jann Traschewski <[email protected]>
Signed-off-by: Jarek Poplawski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jarek Poplawski authored and davem330 committed Feb 18, 2008
1 parent 9bf1d83 commit f47b725
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions net/ax25/ax25_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb)
unsigned char *p;
int frontlen, len, fragno, ka9qfrag, first = 1;

if (paclen < 16) {
WARN_ON_ONCE(1);
kfree_skb(skb);
return;
}

if ((skb->len - 1) > paclen) {
if (*skb->data == AX25_P_TEXT) {
skb_pull(skb, 1); /* skip PID */
Expand Down Expand Up @@ -251,8 +257,6 @@ void ax25_kick(ax25_cb *ax25)
if (start == end)
return;

ax25->vs = start;

/*
* Transmit data until either we're out of data to send or
* the window is full. Send a poll on the final I frame if
Expand All @@ -261,8 +265,13 @@ void ax25_kick(ax25_cb *ax25)

/*
* Dequeue the frame and copy it.
* Check for race with ax25_clear_queues().
*/
skb = skb_dequeue(&ax25->write_queue);
if (!skb)
return;

ax25->vs = start;

do {
if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) {
Expand Down

0 comments on commit f47b725

Please sign in to comment.