From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 029832AD3C; Sat, 12 Sep 2026 15:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227995; cv=none; b=CJZz4x+EUqHVbZaFxTfVO7OiCqgCFEUIlMW1uIu8EZK0jcFeIBZ08STZnzcmrn2NHyrObABu5FjUr6PjgYcWvsneq+VS0UVbQ0p/AF5ncuKO+YXsAmkI7h0Zxn5sxEVPDJJ6deDigMdQcTAq/+/cwLwhbFQ+7JGMzXRE0+iIKiY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789227995; c=relaxed/simple; bh=bNSGUyrQYKo/5pRUrOzut8hCHOH+mwy9W3VyebBamEk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=texDP4S5C3ObYpxS/hsbs15cwUQ7d6+RhI2RzwGE1pLbe3yVY2yVFd1UROqiOc5yoT9k6zUI8YwT1wwChZzDBxXzVMi07xYmH4etI03yFBRdJT31VsyFHmJrDgWyH0as5Wr5wHbS0ijiGd7miSXWS0dFPOTB/C5Iyzn2cfhlnk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iRjO79z+; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iRjO79z+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09E621F000FF; Sat, 12 Sep 2026 15:46:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789227993; bh=gwqHGHxpmycEhoKmj/YQVnhoSoVwg9tAWUZKC/7yG2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=iRjO79z+2O/VVrlZHkUXaZQXXmzIz+buHTYfmc8+HHLjJ4GNzgyP/7u0IIK4Z9tS0 Fze3FXQ8spC8j7SvMai+SFUandbF9+vS6V945K3PLAYWCsAgLqi+mBzpYMWE6B82AY P2Nowqj0OvbovOj73oS8t0BcRYl+yVa9TejEE9Ms= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+5ebeb3089ea6439c37be@syzkaller.appspotmail.com, Bradley Morgan , Mimi Zohar Subject: [PATCH 6.1 0296/1191] ima: Check for ERR_PTR from dentry_path() in validate_hash_algo() Date: Sat, 12 Sep 2026 08:50:24 +0200 Message-ID: <20260912065554.878383442@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065548.086904252@linuxfoundation.org> References: <20260912065548.086904252@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bradley Morgan commit 8861f6d5c0678a7c5089c7b272509fc5931b8437 upstream. dentry_path() returns ERR_PTR(-ENAMETOOLONG) when the path exceeds the buffer. validate_hash_algo() passes the result straight to integrity_audit_msg() without checking. ERR_PTR is not NULL, so integrity_audit_message() sees a valid pointer and calls strlen() on it, which faults: BUG: unable to handle page fault for address: ffffffffffffffdc RIP: 0010:strlen+0x30/0xa0 Call Trace: audit_log_untrustedstring+0x19/0x30 integrity_audit_message+0x366/0x4f0 ima_inode_setxattr+0x512/0x5f0 Check for IS_ERR() and use NULL instead, which makes the audit message skip the name= field instead of crashing. Fixes: 4f2946aa0c45 ("IMA: introduce a new policy option func=SETXATTR_CHECK") Cc: stable@vger.kernel.org Reported-by: syzbot+5ebeb3089ea6439c37be@syzkaller.appspotmail.com Link: https://lore.kernel.org/all/6a8f89e5.1d9ded08.62e62.00bf.GAE@google.com/ Signed-off-by: Bradley Morgan Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- security/integrity/ima/ima_appraise.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c @@ -740,6 +740,8 @@ static int validate_hash_algo(struct den return -EACCES; path = dentry_path(dentry, pathbuf, PATH_MAX); + if (IS_ERR(path)) + path = NULL; integrity_audit_msg(AUDIT_INTEGRITY_DATA, d_inode(dentry), path, "set_data", errmsg, -EACCES, 0);