Message ID | 20240711073238.44399-3-kovalev@altlinux.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | bfs: fix null-ptr-deref and possible warning in bfs_move_block() func | expand |
diff --git a/fs/bfs/file.c b/fs/bfs/file.c index e99dc8ace2027..9599b41cbe91b 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -44,8 +44,13 @@ static int bfs_move_block(unsigned long from, unsigned long to, ret = -EIO; goto out_err_new; } + if (!buffer_uptodate(new)) { + ret = -EIO; + goto out_err; + } memcpy(new->b_data, bh->b_data, bh->b_size); mark_buffer_dirty(new); +out_err: brelse(new); out_err_new: bforget(bh);