int ret = 0;
struct crypto_diskcipher *ci = NULL;
struct inode *inode = NULL;
- struct page *page = bio->bi_io_vec[0].bv_page;
+ struct page *page = NULL;
+ if (!bio) {
+ pr_err("%s: doesn't exist bio\n", __func__);
+ goto out;
+ }
+
+ page = bio->bi_io_vec[0].bv_page;
if (page && !PageAnon(page) && bio)
if (page->mapping)
if (page->mapping->host)
crypto_diskcipher_debug(DISKC_CHECK_ERR, 1);
}
}
+out:
crypto_diskcipher_debug(DISKC_API_GET, ret);
#endif
}
struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg);
if (!cra) {
- pr_err("%s: doesn't exist cra", __func__);
+ pr_err("%s: doesn't exist cra. base:%p", __func__, base);
return -EINVAL;
}
struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg);
if (!cra) {
- pr_err("%s: doesn't exist cra", __func__);
+ pr_err("%s: doesn't exist cra. base:%p", __func__, base);
return -EINVAL;
}
return cra->clearkey(base);
{
int ret = 0;
struct crypto_tfm *base = crypto_diskcipher_tfm(tfm);
- struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg);
+ struct diskcipher_alg *cra = NULL;
+
+ if (!base) {
+ pr_err("%s: doesn't exist cra. base:%p", __func__, base);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ cra = crypto_diskcipher_alg(base->__crt_alg);
if (!cra) {
- pr_err("%s: doesn't exist cra", __func__);
- ret = EINVAL;
+ pr_err("%s: doesn't exist cra. base:%p\n", __func__, base);
+ ret = -EINVAL;
goto out;
}
{
int ret = 0;
struct crypto_tfm *base = crypto_diskcipher_tfm(tfm);
- struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg);
+ struct diskcipher_alg *cra = NULL;
+
+ if (!base) {
+ pr_err("%s: doesn't exist base, tfm:%p\n", __func__, tfm);
+ ret = -EINVAL;
+ goto out;
+ }
+
+ cra = crypto_diskcipher_alg(base->__crt_alg);
if (!cra) {
- pr_err("%s: doesn't exist cra", __func__);
- ret = EINVAL;
+ pr_err("%s: doesn't exist cra. base:%p\n", __func__, base);
+ ret = -EINVAL;
goto out;
}
+ if (atomic_read(&tfm->status) == DISKC_ST_FREE) {
+ pr_warn("%s: tfm is free\n", __func__);
+ return -EINVAL;
+ }
+
ret = cra->clear(base, req);
if (ret)
pr_err("%s fails", __func__);
struct diskcipher_alg *cra = crypto_diskcipher_alg(base->__crt_alg);
if (!cra) {
- pr_err("%s: doesn't exist cra", __func__);
- ret = EINVAL;
+ pr_err("%s: doesn't exist cra. base:%p\n", __func__, base);
+ ret = -EINVAL;
goto out;
}