Commit 5f2bfe2f authored by Lukasz Pawelczyk's avatar Lukasz Pawelczyk Committed by Casey Schaufler
Browse files

Smack: fix a NULL dereference in wrong smack_import_entry() usage



'commit e774ad68 ("smack: pass error code through pointers")'
made this function return proper error codes instead of NULL. Reflect that.

This is a fix for a NULL dereference introduced in
'commit 21abb1ec ("Smack: IPv6 host labeling")'

echo "$SOME_IPV6_ADDR \"test" > /smack/ipv6host
  (this should return EINVAL, it doesn't)
cat /smack/ipv6host
  (derefences 0x000a)

Signed-off-by: default avatarLukasz Pawelczyk <l.pawelczyk@samsung.com>
Acked-by: default avatarCasey Schaufler <casey@schaufler-ca.com>
parent 049e6dde
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1501,8 +1501,8 @@ static ssize_t smk_write_net6addr(struct file *file, const char __user *buf,
	 */
	 */
	if (smack[0] != '-') {
	if (smack[0] != '-') {
		skp = smk_import_entry(smack, 0);
		skp = smk_import_entry(smack, 0);
		if (skp == NULL) {
		if (IS_ERR(skp)) {
			rc = -EINVAL;
			rc = PTR_ERR(skp);
			goto free_out;
			goto free_out;
		}
		}
	} else {
	} else {