Re: [PATCH 3/4] block: handle nogenerate/noverify properly in fs-integrity
Anuj gupta <[email protected]>
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <CACzX3AvuR0r59nEo6Uef6OHw9Z=8AxdYboRsE4bcswO1x2umJA@mail.gmail.com> |
> void fs_bio_integrity_generate(struct bio *bio)
> {
> - if (fs_bio_integrity_alloc(bio))
> + fs_bio_integrity_alloc(bio);
> + if (bio_integrity(bio)->bip_flags & BIP_CHECK_FLAGS)
This causes a NULL pointer dereference when write_generate is disabled
on a offload capable device. fs_bio_integrity_alloc() returns without
allocating bio->bi_integrity, but it is still dereferenced here.
Maybe check bio_integrity(bio) before accessing bip_flags?