diff options
author | Andrey Markovytch <andreym@codeaurora.org> | 2015-11-15 15:00:35 +0200 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:24:09 -0700 |
commit | 5c84da193d13761baf6d6f6f9189142959db1c5a (patch) | |
tree | 05ea25570c0322ed052b4fbb9242713cc47c4230 /security/pfe | |
parent | f707680de8e70550be74c26e1d5b609143aba9b7 (diff) |
pfk: fixed bug that caused eCryptfs ignore some of its files
Our logic that distinguished eCryptfs files from non eCryptfs ones
checked bi_vcnt field in bio to make sure it has valid bio vecs.
Apparently this field is not updated in some cases by block layer
and in general can't be trusted outside of code that own bio.
There is another field that need to be used for this purpose - bi_size
Change-Id: Ibf225543618373699a0d5adc3295daf9ded6169a
Signed-off-by: Andrey Markovytch <andreym@codeaurora.org>
Diffstat (limited to 'security/pfe')
-rw-r--r-- | security/pfe/pfk.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/security/pfe/pfk.c b/security/pfe/pfk.c index 277b75eb2469..f56e490a0ae8 100644 --- a/security/pfe/pfk.c +++ b/security/pfe/pfk.c @@ -143,8 +143,8 @@ static int pfk_get_page_index(const struct bio *bio, pgoff_t *page_index) if (!bio || !page_index) return -EPERM; - /* check bio vec count > 0 before using the bio->bi_io_vec[] array */ - if (!bio->bi_vcnt) + /* check bio bi_size > 0 before using the bio->bi_io_vec[] array */ + if (!(bio->bi_iter).bi_size) return -EINVAL; if (!bio->bi_io_vec) return -EINVAL; @@ -173,8 +173,8 @@ static struct inode *pfk_bio_get_inode(const struct bio *bio) { if (!bio) return NULL; - /* check bio vec count > 0 before using the bio->bi_io_vec[] array */ - if (!bio->bi_vcnt) + /* check bio bi_size > 0 before using the bio->bi_io_vec[] array */ + if (!(bio->bi_iter).bi_size) return NULL; if (!bio->bi_io_vec) return NULL; |