* [PATCH] net: pktgen: fix null ptr deref in skb allocation
@ 2016-01-11 5:38 John Fastabend
2016-01-11 22:40 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: John Fastabend @ 2016-01-11 5:38 UTC (permalink / raw)
To: netdev; +Cc: bogdan.hamciuc, davem
Fix possible null pointer dereference that may occur when calling
skb_reserve() on a null skb.
Fixes: 879c7220e82 ("net: pktgen: Observe needed_headroom of the device")
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/core/pktgen.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index de8d5cc..4da4d51 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2787,7 +2787,9 @@ static struct sk_buff *pktgen_alloc_skb(struct net_device *dev,
} else {
skb = __netdev_alloc_skb(dev, size, GFP_NOWAIT);
}
- skb_reserve(skb, LL_RESERVED_SPACE(dev));
+
+ if (likely(skb))
+ skb_reserve(skb, LL_RESERVED_SPACE(dev));
return skb;
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: pktgen: fix null ptr deref in skb allocation
2016-01-11 5:38 [PATCH] net: pktgen: fix null ptr deref in skb allocation John Fastabend
@ 2016-01-11 22:40 ` David Miller
2016-01-12 17:32 ` John Fastabend
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-01-11 22:40 UTC (permalink / raw)
To: john.fastabend; +Cc: netdev, bogdan.hamciuc
From: John Fastabend <john.fastabend@gmail.com>
Date: Sun, 10 Jan 2016 21:38:44 -0800
> Fix possible null pointer dereference that may occur when calling
> skb_reserve() on a null skb.
>
> Fixes: 879c7220e82 ("net: pktgen: Observe needed_headroom of the device")
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
I don't know how I missed that during review :-/
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: pktgen: fix null ptr deref in skb allocation
2016-01-11 22:40 ` David Miller
@ 2016-01-12 17:32 ` John Fastabend
0 siblings, 0 replies; 3+ messages in thread
From: John Fastabend @ 2016-01-12 17:32 UTC (permalink / raw)
To: David Miller; +Cc: netdev, bogdan.hamciuc
On 16-01-11 02:40 PM, David Miller wrote:
> From: John Fastabend <john.fastabend@gmail.com>
> Date: Sun, 10 Jan 2016 21:38:44 -0800
>
>> Fix possible null pointer dereference that may occur when calling
>> skb_reserve() on a null skb.
>>
>> Fixes: 879c7220e82 ("net: pktgen: Observe needed_headroom of the device")
>> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>
> I don't know how I missed that during review :-/
Well once you get pktgen running fast enough to get allocation
failures the occasional system halts are pretty hard to miss :)
>
> Applied and queued up for -stable, thanks!
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-12 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 5:38 [PATCH] net: pktgen: fix null ptr deref in skb allocation John Fastabend
2016-01-11 22:40 ` David Miller
2016-01-12 17:32 ` John Fastabend
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).