mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
mm: fix dereferencing possible ERR_PTR
commit4eb5bbde3c
upstream. Smatch checker complains that 'secretmem_mnt' dereferencing possible ERR_PTR(). Let the function return if 'secretmem_mnt' is ERR_PTR, to avoid deferencing it. Link: https://lkml.kernel.org/r/20220904074647.GA64291@cloud-MacBookPro Fixes:1507f51255
("mm: introduce memfd_secret system call to create "secret" memory areas") Signed-off-by: Binyi Han <dantengknight@gmail.com> Reviewed-by: Andrew Morton <akpm@linux-foudation.org> Cc: Mike Rapoport <rppt@kernel.org> Cc: Ammar Faizi <ammarfaizi2@gnuweeb.org> Cc: Hagen Paul Pfeifer <hagen@jauu.net> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d75ce11562
commit
e858f7ac73
1 changed files with 1 additions and 1 deletions
|
@ -283,7 +283,7 @@ static int secretmem_init(void)
|
||||||
|
|
||||||
secretmem_mnt = kern_mount(&secretmem_fs);
|
secretmem_mnt = kern_mount(&secretmem_fs);
|
||||||
if (IS_ERR(secretmem_mnt))
|
if (IS_ERR(secretmem_mnt))
|
||||||
ret = PTR_ERR(secretmem_mnt);
|
return PTR_ERR(secretmem_mnt);
|
||||||
|
|
||||||
/* prevent secretmem mappings from ever getting PROT_EXEC */
|
/* prevent secretmem mappings from ever getting PROT_EXEC */
|
||||||
secretmem_mnt->mnt_flags |= MNT_NOEXEC;
|
secretmem_mnt->mnt_flags |= MNT_NOEXEC;
|
||||||
|
|
Loading…
Reference in a new issue