Message ID | 20240822161219.459054-2-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 57ae5ee6deec12..23773e62994024 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c @@ -39,6 +39,10 @@ static int bfs_move_block(unsigned long from, unsigned long to, if (!bh) return -EIO; new = sb_getblk(sb, to); + if (!new) { + brelse(bh); + return -EIO; + } memcpy(new->b_data, bh->b_data, bh->b_size); mark_buffer_dirty(new); bforget(bh);