[Devel] [PATCH RHEL7 COMMIT] rh/qede: confirm skb is allocated before using
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Dec 15 20:27:46 MSK 2022
The commit is pushed to "branch-rh7-3.10.0-1160.80.1.vz7.191.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.80.1.vz7.191.4
------>
commit 9317d611891479b480b78ea85810243732c09bc9
Author: Jamie Bainbridge <jamie.bainbridge at gmail.com>
Date: Wed Apr 6 21:19:19 2022 +1000
rh/qede: confirm skb is allocated before using
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().
mFixes: 8a8633978b842 ("qede: Add build_skb() support.")
Signed-off-by: Jamie Bainbridge <jamie.bainbridge at gmail.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
The patch is backported from RHEL7.9 kernel 3.10.0-1160.81.1.el7:
https://access.redhat.com/labs/rhcb/RHEL-7.9/kernel-3.10.0-1160.81.1.el7/patches/blob/1508-netdrv-qede-confirm-skb-is-allocated-before-using.patch
From: Jamie Bainbridge <jbainbri at redhat.com>
Date: Fri, 30 Sep 2022 15:34:57 +1000
Subject: [PATCH 1508/1510] [netdrv] qede: confirm skb is allocated
before using
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2131145
https://jira.sw.ru/browse/PSBM-144136
(cherry picked from ms commit 4e910dbe36508654a896d5735b318c0b88172570)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
drivers/net/ethernet/qlogic/qede/qede_fp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index b3ea11a1d07f..43844f8f4be3 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -731,6 +731,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);
More information about the Devel
mailing list