]> git.baikalelectronics.ru Git - kernel.git/commit
gfs2: Fix iomap buffer head reference counting bug
authorAndreas Gruenbacher <agruenba@redhat.com>
Sun, 11 Nov 2018 11:15:21 +0000 (11:15 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 16 Nov 2018 17:35:09 +0000 (11:35 -0600)
commit6a9dc2a1e6b4651ab630664efd3084798f606775
tree469f981b657c1bc9ed005d96c97b8fb86b2fcb25
parente747ae283ecbdae61aa325488f46102cf46c820e
gfs2: Fix iomap buffer head reference counting bug

GFS2 passes the inode buffer head (dibh) from gfs2_iomap_begin to
gfs2_iomap_end in iomap->private.  It sets that private pointer in
gfs2_iomap_get.  Users of gfs2_iomap_get other than gfs2_iomap_begin
would have to release iomap->private, but this isn't done correctly,
leading to a leak of buffer head references.

To fix this, move the code for setting iomap->private from
gfs2_iomap_get to gfs2_iomap_begin.

Fixes: ff673b97c3 ("gfs2: iomap buffered write support")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/gfs2/bmap.c