2017-12-16 19:47:38

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] isdn: avm: Handle return value of skb_dequeue()

skb_dequeue() will return NULL for an empty list or a pointer
to the head element.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/isdn/hardware/avm/b1dma.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c
index 9538a9e..10df578 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -375,6 +375,8 @@ static void b1dma_dispatch_tx(avmcard *card)
void *p;

skb = skb_dequeue(&dma->send_queue);
+ if (!skb)
+ return;

len = CAPIMSG_LEN(skb->data);

--
2.7.4


2017-12-19 16:05:04

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] isdn: avm: Handle return value of skb_dequeue()

From: Arvind Yadav <[email protected]>
Date: Sun, 17 Dec 2017 01:17:23 +0530

> skb_dequeue() will return NULL for an empty list or a pointer
> to the head element.
>
> Signed-off-by: Arvind Yadav <[email protected]>

There is no code path where this is possible.

The two call sites:

1) Explicitly add an SKB to the queue

OR

2) Explcitily guard the call with an skb_queue_empty() check

Therefore the stated condition is not possible.