lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250911135858.1203-1-chenyufeng@iie.ac.cn>
Date: Thu, 11 Sep 2025 21:58:58 +0800
From: Chen Yufeng <chenyufeng@....ac.cn>
To: kuba@...nel.org
Cc: horms@...nel.org,
	chenyufeng@....ac.cn,
	netdev@...r.kernel.org
Subject: [PATCH v2] net: ipv4: Potential null pointer dereference in cipso_v4_parsetag_enum

While parsing CIPSO enumerated tags, secattr->flags is set to 
NETLBL_SECATTR_MLS_CAT even if secattr->attr.mls.cat is NULL.
If subsequent code attempts to access secattr->attr.mls.cat, 
it may lead to a null pointer dereference, causing a system crash.

To address this issue, we add a check to ensure that before setting
the NETLBL_SECATTR_MLS_CAT flag, secattr->attr.mls.cat is not NULL.

fixed code:
```
if (secattr->attr.mls.cat)
    secattr->flags |= NETLBL_SECATTR_MLS_CAT;
```

This patch is similar to commit eead1c2ea250 ("netlabel: cope with NULL 
catmap").

Fixes: 4b8feff251da ("netlabel: fix the horribly broken catmap functions")
Fixes: ceba1832b1b2 ("calipso: Set the calipso socket label to match the secattr.")

Signed-off-by: Chen Yufeng <chenyufeng@....ac.cn>
---
Changes in v2:
- Add the Fixes tags

 net/ipv4/cipso_ipv4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 740af8541d2f..2190333d78cb 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -1339,8 +1339,8 @@ static int cipso_v4_parsetag_enum(const struct cipso_v4_doi *doi_def,
 			netlbl_catmap_free(secattr->attr.mls.cat);
 			return ret_val;
 		}
-
-		secattr->flags |= NETLBL_SECATTR_MLS_CAT;
+		if (secattr->attr.mls.cat)
+			secattr->flags |= NETLBL_SECATTR_MLS_CAT;
 	}
 
 	return 0;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ