From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7A74C35C181; Fri, 9 Jan 2026 12:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767962327; cv=none; b=TsoAJbNlCVu8EGzNXWeUVb+YyRvWmgfRhFOgRoioLbAp9MMZdecourOBXJ8nNrf2W8RPO7rZNpaqdIAXQBXLGxeZtalasggGqMZyzXpBeTZfCZGB21xQ+7sdKDXZY9MIpxDhA0RfVsxaT+7/9atbxJ+BNzm6TMsP7mmlhMAQtpQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767962327; c=relaxed/simple; bh=TWQnA+KUqUksZivTzei0fJ1cLr+pZGgRGTtLbxErFsk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dUsYNOjYUnTBxVr3w7hd+TBQIs+XBnSKvTh2Quc6ezgKjk9OB/CmLVe0Asdz+lPaeRKgKONLTxfK5/Xcju739Q+0/IvKXfUTHs1kaZ9GC2a7xdJr3Y4GiKpj0LZWKsvY20MVf+afMFgJE5npp+lwr6R8qWEqPYT9BjUTPUoJTAw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SCNqckX5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="SCNqckX5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0554AC4CEF1; Fri, 9 Jan 2026 12:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1767962327; bh=TWQnA+KUqUksZivTzei0fJ1cLr+pZGgRGTtLbxErFsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SCNqckX5F6QFzG+bEnbyvaHodxZnBYN/GA0JnzzX2ZvKase+38vQ+y7tdcDyGlJ9y voosGz6UKH45zqYttZhEnXOlhliEJvZGzKAXoNREGf0GxPdazZff/2knIAPTeoYRku f3U/juVpTPv7oRmV7yKfsC3Gml/xR8tz79YMcDBY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable@kernel.org, Karina Yankevich , Sergey Shtylyov , Baokun Li , Theodore Tso Subject: [PATCH 6.1 327/634] ext4: xattr: fix null pointer deref in ext4_raw_inode() Date: Fri, 9 Jan 2026 12:40:05 +0100 Message-ID: <20260109112129.832644160@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260109112117.407257400@linuxfoundation.org> References: <20260109112117.407257400@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org 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: Karina Yankevich commit b97cb7d6a051aa6ebd57906df0e26e9e36c26d14 upstream. If ext4_get_inode_loc() fails (e.g. if it returns -EFSCORRUPTED), iloc.bh will remain set to NULL. Since ext4_xattr_inode_dec_ref_all() lacks error checking, this will lead to a null pointer dereference in ext4_raw_inode(), called right after ext4_get_inode_loc(). Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: c8e008b60492 ("ext4: ignore xattrs past end") Cc: stable@kernel.org Signed-off-by: Karina Yankevich Reviewed-by: Sergey Shtylyov Reviewed-by: Baokun Li Message-ID: <20251022093253.3546296-1-k.yankevich@omp.ru> Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/xattr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1138,7 +1138,11 @@ ext4_xattr_inode_dec_ref_all(handle_t *h if (block_csum) end = (void *)bh->b_data + bh->b_size; else { - ext4_get_inode_loc(parent, &iloc); + err = ext4_get_inode_loc(parent, &iloc); + if (err) { + EXT4_ERROR_INODE(parent, "parent inode loc (error %d)", err); + return; + } end = (void *)ext4_raw_inode(&iloc) + EXT4_SB(parent->i_sb)->s_inode_size; }