]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/staging/lustre/lustre/lov/lov_io.c
staging/lustre/lov: don't crash accessing LOV object with FID{0, 0}
[karo-tx-linux.git] / drivers / staging / lustre / lustre / lov / lov_io.c
index f1f6db3f664a06952f73992f23c0bc62ce335aa3..80c2ef6d0fb5d92fd8568166782994d98c36dd22 100644 (file)
@@ -148,6 +148,9 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
        LASSERT(sub->sub_env == NULL);
        LASSERT(sub->sub_stripe < lio->lis_stripe_count);
 
+       if (unlikely(lov_r0(lov)->lo_sub[stripe] == NULL))
+               return -EIO;
+
        result = 0;
        sub->sub_io_initialized = 0;
        sub->sub_borrowed = 0;
@@ -391,6 +394,15 @@ static int lov_io_iter_init(const struct lu_env *env,
                                           endpos, &start, &end))
                        continue;
 
+               if (unlikely(lov_r0(lio->lis_object)->lo_sub[stripe] == NULL)) {
+                       if (ios->cis_io->ci_type == CIT_READ ||
+                           ios->cis_io->ci_type == CIT_WRITE ||
+                           ios->cis_io->ci_type == CIT_FAULT)
+                               return -EIO;
+
+                       continue;
+               }
+
                end = lov_offset_mod(end, +1);
                sub = lov_sub_get(env, lio, stripe);
                if (!IS_ERR(sub)) {