ovl: fix null pointer dereference on ofs allocation failure.
Subsystems (2)
PATCH 1/1 ovl: fix null pointer dereference on ofs allocation failure.
From: Colin Ian King <[email protected]>
The current error exit path when ofs fails to allocate jumps to clean-up code that calls ovl_free_fs resulting in a null pointer dereference on the null ovl pointer. Fix this by simply returning with the -ENOMEM status in err.
Detected by CoverityScan, CID#1461284 ("Dereference after null check")
--- fs/overlayfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/super.c +1 -1
@@ -1154,7 +1154,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) err = -ENOMEM ; ofs =kzalloc (sizeof (struct ovl_fs ),GFP_KERNEL );if (!ofs) - goto out_err; +return err; ofs->creator_cred = cred =prepare_creds ();if (!cred)
Signature · 1 line
2.14.1
Quoted 8 lines · Colin King
From: Colin Ian King <[email protected]>
The current error exit path when ofs fails to allocate jumps to clean-up code that calls
ovl_free_fsresulting in a null pointer dereference on the null ovl pointer. Fix this by simply returning with the-ENOMEMstatus in err.Detected by CoverityScan, CID#1461284 ("Dereference after null check")
Thanks, fixed.
Miklos