@@ -311,7 +311,7 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io,
311
311
312
312
if (static_branch_unlikely (& use_bh_wq_enabled ) && io -> in_bh ) {
313
313
data = dm_bufio_get (v -> bufio , hash_block , & buf );
314
- if (data == NULL ) {
314
+ if (IS_ERR_OR_NULL ( data ) ) {
315
315
/*
316
316
* In tasklet and the hash was not in the bufio cache.
317
317
* Return early and resume execution from a work-queue
@@ -324,8 +324,24 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io,
324
324
& buf , bio -> bi_ioprio );
325
325
}
326
326
327
- if (IS_ERR (data ))
328
- return PTR_ERR (data );
327
+ if (IS_ERR (data )) {
328
+ if (skip_unverified )
329
+ return 1 ;
330
+ r = PTR_ERR (data );
331
+ data = dm_bufio_new (v -> bufio , hash_block , & buf );
332
+ if (IS_ERR (data ))
333
+ return r ;
334
+ if (verity_fec_decode (v , io , DM_VERITY_BLOCK_TYPE_METADATA ,
335
+ hash_block , data ) == 0 ) {
336
+ aux = dm_bufio_get_aux_data (buf );
337
+ aux -> hash_verified = 1 ;
338
+ goto release_ok ;
339
+ } else {
340
+ dm_bufio_release (buf );
341
+ dm_bufio_forget (v -> bufio , hash_block );
342
+ return r ;
343
+ }
344
+ }
329
345
330
346
aux = dm_bufio_get_aux_data (buf );
331
347
@@ -366,6 +382,7 @@ static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io,
366
382
}
367
383
}
368
384
385
+ release_ok :
369
386
data += offset ;
370
387
memcpy (want_digest , data , v -> digest_size );
371
388
r = 0 ;
@@ -1761,7 +1778,7 @@ static struct target_type verity_target = {
1761
1778
.name = "verity" ,
1762
1779
/* Note: the LSMs depend on the singleton and immutable features */
1763
1780
.features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE ,
1764
- .version = {1 , 10 , 0 },
1781
+ .version = {1 , 11 , 0 },
1765
1782
.module = THIS_MODULE ,
1766
1783
.ctr = verity_ctr ,
1767
1784
.dtr = verity_dtr ,
0 commit comments