Skip to content

Commit 275bb0f

Browse files
Dan Carpentersmb49
authored andcommitted
fs/ntfs3: Fix an NULL dereference bug
BugLink: https://bugs.launchpad.net/bugs/2059991 [ Upstream commit b2dd7b9 ] The issue here is when this is called from ntfs_load_attr_list(). The "size" comes from le32_to_cpu(attr->res.data_size) so it can't overflow on a 64bit systems but on 32bit systems the "+ 1023" can overflow and the result is zero. This means that the kmalloc will succeed by returning the ZERO_SIZE_PTR and then the memcpy() will crash with an Oops on the next line. Fixes: be71b5c ("fs/ntfs3: Add attrib operations") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Portia Stephens <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 99a9270 commit 275bb0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ntfs3/ntfs_fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ bool al_delete_le(struct ntfs_inode *ni, enum ATTR_TYPE type, CLST vcn,
473473
int al_update(struct ntfs_inode *ni, int sync);
474474
static inline size_t al_aligned(size_t size)
475475
{
476-
return (size + 1023) & ~(size_t)1023;
476+
return size_add(size, 1023) & ~(size_t)1023;
477477
}
478478

479479
/* Globals from bitfunc.c */

0 commit comments

Comments
 (0)