reiser4: fix filesystem init error path.
PATCH 1/3 reiser4: fix filesystem init error path.
--- fs/reiser4/super_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/reiser4/super_ops.c +1 -1
@@ -623,9 +623,9 @@ static int fill_super(struct super_block *super, void *data, int silent)reiser4_done_txnmgr (&sbinfo->tmgr); failed_init_read_super: failed_init_super_data: + failed_init_csum_tfm:reiser4_done_fs_info (super); failed_init_sinfo: - failed_init_csum_tfm:reiser4_exit_context (&ctx);return result; }
Signature · 1 line
2.5.1
PATCH 2/3 reiser4: fix reiser4_init_csum_tfm() error path; return real (negative) error code.
---
This is responsible for the oops on mount reported by Jose (also experienced by me). The problem is that IS_ERR() works only for negative error codes, so somewhere in the VFS an error path is incorrectly not taken.
fs/reiser4/checksum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/reiser4/checksum.c +7 -5
@@ -4,11 +4,13 @@int reiser4_init_csum_tfm (struct crypto_shash **tfm) { - *tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); -if (IS_ERR (*tfm)) { - *tfm =NULL ; -return 1 ; - } +struct crypto_shash *new_tfm; + + new_tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); +if (IS_ERR (new_tfm)) +return PTR_ERR (new_tfm); + + *tfm = new_tfm;return 0 ; }
Signature · 1 line
2.5.1
Re: [PATCH 2/3] reiser4: fix reiser4_init_csum_tfm() error path; return real (negative) error code.
OK.
Thanks!
Quoted 33 lines · Ivan Shapovalov
Signed-off-by Ivan Shapovalov <[email protected]>---
This is responsible for the oops on mount reported by Jose (also experienced by me). The problem is that
IS_ERR()works only for negative error codes, so somewhere in the VFS an error path is incorrectly not taken.fs/reiser4/checksum.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)fs/reiser4/checksum.c +7
-5@@ -4,11 +4,13 @@int reiser4_init_csum_tfm (struct crypto_shash **tfm) { - *tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); -if (IS_ERR (*tfm)) { - *tfm =NULL ; -return 1 ; - } +struct crypto_shash *new_tfm; + + new_tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); +if (IS_ERR (new_tfm)) +return PTR_ERR (new_tfm); + + *tfm = new_tfm;return 0 ; }
PATCH 3/3 reiser4: report an error on checksum engine load failure.
In reply to Ivan ShapovalovIt is apparently not possible to specify explicit module dependencies. For well-formed setups this is not a problem because crypto_alloc_shash() uses request_module() internally, but if one needs reiser4, say, in initramfs, then the checksum module must be added manually.
--- fs/reiser4/checksum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/reiser4/checksum.c +3 -1
@@ -7,8 +7,10 @@ int reiser4_init_csum_tfm(struct crypto_shash **tfm)struct crypto_shash *new_tfm; new_tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); -if (IS_ERR (new_tfm)) +if (IS_ERR (new_tfm)) { +warning ("intelfx-81" ,"Could not load crc32c driver" );return PTR_ERR (new_tfm); + } *tfm = new_tfm;return 0 ;
Signature · 1 line
2.5.1
Re: [PATCH 3/3] reiser4: report an error on checksum engine load failure.
OK
Quoted 27 lines · Ivan Shapovalov
It is apparently not possible to specify explicit module dependencies. For well-formed setups this is not a problem because
crypto_alloc_shash()usesrequest_module()internally, but if one needs reiser4, say, in initramfs, then the checksum module must be added manually.Signed-off-by Ivan Shapovalov <[email protected]>--- fs/reiser4/checksum.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)fs/reiser4/checksum.c +3
-1@@ -7,8 +7,10 @@ int reiser4_init_csum_tfm(struct crypto_shash **tfm)struct crypto_shash *new_tfm; new_tfm =crypto_alloc_shash ("crc32c" ,0 ,0 ); -if (IS_ERR (new_tfm)) +if (IS_ERR (new_tfm)) { +warning ("intelfx-81" ,"Could not load crc32c driver" );return PTR_ERR (new_tfm); + } *tfm = new_tfm;return 0 ;
OK
Quoted 20 lines · Ivan Shapovalov
Signed-off-by Ivan Shapovalov <[email protected]>--- fs/reiser4/super_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/reiser4/super_ops.c +1
-1@@ -623,9 +623,9 @@ static int fill_super(struct super_block *super, void *data, int silent)reiser4_done_txnmgr (&sbinfo->tmgr); failed_init_read_super: failed_init_super_data: + failed_init_csum_tfm:reiser4_done_fs_info (super); failed_init_sinfo: - failed_init_csum_tfm:reiser4_exit_context (&ctx);return result; }