[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231018145244.591454-1-artem.chernyshev@red-soft.ru>
Date: Wed, 18 Oct 2023 17:52:44 +0300
From: Artem Chernyshev <artem.chernyshev@...-soft.ru>
To: Louis Peens <louis.peens@...igine.com>
Cc: Artem Chernyshev <artem.chernyshev@...-soft.ru>,
Jakub Kicinski <kuba@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
bpf@...r.kernel.org,
oss-drivers@...igine.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: [PATCH] nfp: bpf: offload: Check prog before dereference
In nfp_net_bpf_offload() it is possible to dereference a
NULL pointer.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Artem Chernyshev <artem.chernyshev@...-soft.ru>
---
drivers/net/ethernet/netronome/nfp/bpf/offload.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/bpf/offload.c b/drivers/net/ethernet/netronome/nfp/bpf/offload.c
index 9d97cd281f18..925862f7b7d6 100644
--- a/drivers/net/ethernet/netronome/nfp/bpf/offload.c
+++ b/drivers/net/ethernet/netronome/nfp/bpf/offload.c
@@ -598,8 +598,7 @@ int nfp_net_bpf_offload(struct nfp_net *nn, struct bpf_prog *prog,
if (old_prog && !prog)
return nfp_net_bpf_stop(nn);
- err = nfp_net_bpf_load(nn, prog, extack);
- if (err)
+ if (prog && (err = nfp_net_bpf_load(nn, prog, extack)))
return err;
if (!old_prog)
--
2.37.3
Powered by blists - more mailing lists