Message ID | 20240710191118.40431-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 cb41ca2a2854e4..da91af8f41e097 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -45,8 +45,13 @@ static int bfs_move_block(unsigned long from, unsigned long to, err = -EIO; goto out_err_new; } + if (!buffer_uptodate(new)) { + err = -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);