Skip to content
/ linux Public

Commit 1452f87

Browse files
Andreas GruenbacherSasha Levin
authored andcommitted
gfs2: Add metapath_dibh helper
[ Upstream commit 92099f0 ] Add a metapath_dibh() helper for extracting the inode's buffer head from a metapath. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Stable-dep-of: faddeb8 ("gfs2: Fix use-after-free in iomap inline data write path") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2a4fb67 commit 1452f87

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/gfs2/bmap.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ static void gfs2_metapath_ra(struct gfs2_glock *gl, __be64 *start, __be64 *end)
317317
}
318318
}
319319

320+
static inline struct buffer_head *
321+
metapath_dibh(struct metapath *mp)
322+
{
323+
return mp->mp_bh[0];
324+
}
325+
320326
static int __fillup_metapath(struct gfs2_inode *ip, struct metapath *mp,
321327
unsigned int x, unsigned int h)
322328
{
@@ -660,7 +666,7 @@ static int __gfs2_iomap_alloc(struct inode *inode, struct iomap *iomap,
660666
{
661667
struct gfs2_inode *ip = GFS2_I(inode);
662668
struct gfs2_sbd *sdp = GFS2_SB(inode);
663-
struct buffer_head *dibh = mp->mp_bh[0];
669+
struct buffer_head *dibh = metapath_dibh(mp);
664670
u64 bn;
665671
unsigned n, i, blks, alloced = 0, iblks = 0, branch_start = 0;
666672
size_t dblks = iomap->length >> inode->i_blkbits;

0 commit comments

Comments
 (0)