mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-20 17:41:09 +00:00
qede: confirm skb is allocated before using
[ Upstream commit4e910dbe36
] qede_build_skb() assumes build_skb() always works and goes straight to skb_reserve(). However, build_skb() can fail under memory pressure. This results in a kernel panic because the skb to reserve is NULL. Add a check in case build_skb() failed to allocate and return NULL. The NULL return is handled correctly in callers to qede_build_skb(). Fixes:8a8633978b
("qede: Add build_skb() support.") Signed-off-by: Jamie Bainbridge <jamie.bainbridge@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fb45e80b21
commit
c9bdce2359
1 changed files with 3 additions and 0 deletions
|
@ -747,6 +747,9 @@ qede_build_skb(struct qede_rx_queue *rxq,
|
|||
buf = page_address(bd->data) + bd->page_offset;
|
||||
skb = build_skb(buf, rxq->rx_buf_seg_size);
|
||||
|
||||
if (unlikely(!skb))
|
||||
return NULL;
|
||||
|
||||
skb_reserve(skb, pad);
|
||||
skb_put(skb, len);
|
||||
|
||||
|
|
Loading…
Reference in a new issue