Commit f3d531b9 authored by Tilman Schmidt's avatar Tilman Schmidt Committed by David S. Miller

isdn/gigaset: correct bas_gigaset rx buffer handling

In transparent data reception, avoid a NULL pointer dereference
in case an skbuff cannot be allocated, remove an inappropriate
call to the HDLC flush routine, and correct the accounting of
received bytes for continued buffers.
Signed-off-by: default avatarTilman Schmidt <tilman@imap.cc>
CC: stable <stable@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c8701a08
...@@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count, ...@@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count,
if (unlikely(bcs->ignore)) { if (unlikely(bcs->ignore)) {
bcs->ignore--; bcs->ignore--;
hdlc_flush(bcs);
return; return;
} }
skb = bcs->rx_skb; skb = bcs->rx_skb;
if (skb == NULL) if (skb == NULL) {
skb = gigaset_new_rx_skb(bcs); skb = gigaset_new_rx_skb(bcs);
bcs->hw.bas->goodbytes += skb->len; if (skb == NULL)
return;
}
dobytes = bcs->rx_bufsize - skb->len; dobytes = bcs->rx_bufsize - skb->len;
while (count > 0) { while (count > 0) {
dst = skb_put(skb, count < dobytes ? count : dobytes); dst = skb_put(skb, count < dobytes ? count : dobytes);
...@@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count, ...@@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count,
if (dobytes == 0) { if (dobytes == 0) {
dump_bytes(DEBUG_STREAM_DUMP, dump_bytes(DEBUG_STREAM_DUMP,
"rcv data", skb->data, skb->len); "rcv data", skb->data, skb->len);
bcs->hw.bas->goodbytes += skb->len;
gigaset_skb_rcvd(bcs, skb); gigaset_skb_rcvd(bcs, skb);
skb = gigaset_new_rx_skb(bcs); skb = gigaset_new_rx_skb(bcs);
if (skb == NULL) if (skb == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment