Skip to content

Commit 573ddcd

Browse files
author
Kent Overstreet
committed
bcachefs: fix uaf in bch2_dio_write_done()
Reported-by: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
1 parent c986dd7 commit 573ddcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/bcachefs/fs-io-direct.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static noinline void bch2_dio_write_flush(struct dio_write *dio)
369369

370370
static __always_inline long bch2_dio_write_done(struct dio_write *dio)
371371
{
372+
struct bch_fs *c = dio->op.c;
372373
struct kiocb *req = dio->req;
373374
struct bch_inode_info *inode = dio->inode;
374375
bool sync = dio->sync;
@@ -387,7 +388,7 @@ static __always_inline long bch2_dio_write_done(struct dio_write *dio)
387388
ret = dio->op.error ?: ((long) dio->written << 9);
388389
bio_put(&dio->op.wbio.bio);
389390

390-
bch2_write_ref_put(dio->op.c, BCH_WRITE_REF_dio_write);
391+
bch2_write_ref_put(c, BCH_WRITE_REF_dio_write);
391392

392393
/* inode->i_dio_count is our ref on inode and thus bch_fs */
393394
inode_dio_end(&inode->v);

0 commit comments

Comments
 (0)