gtp: Fix possible null pointer dereference

Closes: Coverity CID#242771
Change-Id: I412082cc5fa93818d321210c34a2d22c038cb985
This commit is contained in:
Pau Espin 2021-12-17 13:45:34 +01:00
parent 5869201039
commit 272f296cd3
1 changed files with 9 additions and 3 deletions

View File

@ -79,12 +79,18 @@ static int hnb_gtp_cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len
struct hnb *hnb;
int rc;
if (!conn || !conn->ue->conn_ps.active) {
LOGUE(conn->ue, DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u but UE conn_ps is not active!\n",
packet, len);
if (!conn) {
LOGP(DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u with no conn!\n",
packet, len);
return -EINVAL;
}
ue = conn->ue;
if (!ue->conn_ps.active) {
LOGUE(ue, DGTP, LOGL_NOTICE, "Tx GTP-CONN_DATA.ind data=%p len=%u but UE conn_ps is not active!\n",
packet, len);
return -EINVAL;
}
hnb = ue->hnb;
LOGUE(ue, DGTP, LOGL_DEBUG, "Tx GTP-CONN_DATA.ind data=%p len=%u\n", packet, len);