gfs2: free page leak on gfs2_write_log_header error path
Andreas Gruenbacher
maintainerPATCH 1/1 gfs2: free page leak on gfs2_write_log_header error path
When gfs2_get_extent() fails, gfs2_write_log_header() needs to free the page it has just allocated.
--- fs/gfs2/log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/gfs2/log.c +3 -1
@@ -877,8 +877,10 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd, extlen =1 ; ret =gfs2_get_extent (jd->jd_inode, lblock, &dblock, &extlen); -if (gfs2_assert_withdraw (sdp, ret ==0 )) +if (gfs2_assert_withdraw (sdp, ret ==0 )) { +mempool_free (page, gfs2_page_pool);return ; + } } lh->lh_addr =cpu_to_be64 (dblock); lh->lh_jinode =cpu_to_be64 (GFS2_I (jd->jd_inode)->i_no_addr);
Signature · 1 line
2.56.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] gfs2: missing Fixes: trailer for page leak in gfs2_write_log_header() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] gfs2: missing Fixes: trailer for page leak in gfs2_write_log_header()
--
commit daec8ff403c20a1a32badf6f30c628a4eef91de4
Author: Andreas Gruenbacher <[email protected]>
Quoted 6 lines
gfs2: free page leak on
gfs2_write_log_headererror pathWhen
gfs2_get_extent()fails,gfs2_write_log_header()needs to free the page it has just allocated.Signed-off-by Andreas Gruenbacher <[email protected]>
[Severity: Low]
This fixes a page leak on the early return in gfs2_write_log_header() introduced by 7c70b896951c ("gfs2: clean_journal improperly set sd_log_flush_head"). Should this include a Fixes: tag?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1