fs/incfs/vfs.c:1056:1-7: preceding lock on line 981 (fwd)
PATCH 10/15 fs/incfs/vfs.c:1056:1-7: preceding lock on line 981 (fwd)
The complaint about the missing unlock is a false positive. But it looks like this code could be written in a better way by introducing more goto labels, such that the various failures go to what they actually need to clean up, rather than solving the problem with scattered ifs and NULL assignments.
thanks,
julia
---------- Forwarded message ----------
Date: Sun, 27 Sep 2020 04:57:17 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [chrome-os:chromeos-5.4 10/15] fs/incfs/vfs.c:1056:1-7: preceding lock
on line 981
CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>
tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4 head: 4f3ab6d3ed02d6fdd9046b05bcfbdd6256608083 commit: 2db8add7871ad9a3a9a0d79a35333cd57a7b3c34 [10/15] ANDROID: Initial commit of Incremental FS
:::::: branch date: 4 days ago
:::::: commit date: 5 days ago
config: arc-randconfig-c004-20200926 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
coccinelle warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
fs/incfs/vfs.c:1056:1-7: preceding lock on line 981
vim +1056 fs/incfs/vfs.c
2db8add7871ad9 Eugene Zemtsov 2019-11-18 945
2db8add7871ad9 Eugene Zemtsov 2019-11-18 946 static int init_new_file(struct mount_info *mi, struct dentry *dentry,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 947 incfs_uuid_t *uuid, u64 size, struct mem_range attr,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 948 struct incfs_file_signature_info __user *fsi)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 949 {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 950 struct path path = {};
2db8add7871ad9 Eugene Zemtsov 2019-11-18 951 struct file *new_file;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 952 int error = 0;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 953 struct backing_file_context *bfc = 0;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 954 u32 block_count;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 955 struct mem_range mem_range = {0};
2db8add7871ad9 Eugene Zemtsov 2019-11-18 956 struct signature_info *si = 0;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 957 struct mtree *hash_tree = 0;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 958
2db8add7871ad9 Eugene Zemtsov 2019-11-18 959 if (!mi || !dentry || !uuid)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 960 return -EFAULT;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 961
2db8add7871ad9 Eugene Zemtsov 2019-11-18 962 /* Resize newly created file to its true size. */
2db8add7871ad9 Eugene Zemtsov 2019-11-18 963 path = (struct path) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 964 .mnt = mi->mi_backing_dir_path.mnt,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 965 .dentry = dentry
2db8add7871ad9 Eugene Zemtsov 2019-11-18 966 };
2db8add7871ad9 Eugene Zemtsov 2019-11-18 967 new_file = dentry_open(&path, O_RDWR | O_NOATIME, mi->mi_owner);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 968
2db8add7871ad9 Eugene Zemtsov 2019-11-18 969 if (IS_ERR(new_file)) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 970 error = PTR_ERR(new_file);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 971 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 972 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 973
2db8add7871ad9 Eugene Zemtsov 2019-11-18 974 bfc = incfs_alloc_bfc(new_file);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 975 if (IS_ERR(bfc)) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 976 error = PTR_ERR(bfc);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 977 bfc = NULL;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 978 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 979 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 980
2db8add7871ad9 Eugene Zemtsov 2019-11-18 @981 mutex_lock(&bfc->bc_mutex);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 982 error = incfs_write_fh_to_backing_file(bfc, uuid, size);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 983 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 984 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 985
2db8add7871ad9 Eugene Zemtsov 2019-11-18 986 block_count = (u32)get_blocks_count_for_size(size);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 987 error = incfs_write_blockmap_to_backing_file(bfc, block_count, NULL);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 988 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 989 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 990
2db8add7871ad9 Eugene Zemtsov 2019-11-18 991 /* This fill has data, reserve space for the block map. */
2db8add7871ad9 Eugene Zemtsov 2019-11-18 992 if (block_count > 0) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 993 error = incfs_write_blockmap_to_backing_file(
2db8add7871ad9 Eugene Zemtsov 2019-11-18 994 bfc, block_count, NULL);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 995 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 996 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 997 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 998
2db8add7871ad9 Eugene Zemtsov 2019-11-18 999 if (attr.data && attr.len) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1000 error = incfs_write_file_attr_to_backing_file(bfc,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1001 attr, NULL);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1002 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1003 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1004 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1005
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1006 if (fsi) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1007 si = incfs_copy_signature_info_from_user(fsi);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1008
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1009 if (IS_ERR(si)) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1010 error = PTR_ERR(si);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1011 si = NULL;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1012 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1013 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1014
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1015 if (si->hash_alg) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1016 hash_tree = incfs_alloc_mtree(si->hash_alg, block_count,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1017 si->root_hash);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1018 if (IS_ERR(hash_tree)) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1019 error = PTR_ERR(hash_tree);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1020 hash_tree = NULL;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1021 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1022 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1023
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1024 // TODO This code seems wrong when len is zero - we
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1025 // should error out??
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1026 if (si->signature.len > 0)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1027 error = incfs_validate_pkcs7_signature(
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1028 si->signature,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1029 si->root_hash,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1030 si->additional_data);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1031 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1032 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1033
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1034 error = incfs_write_signature_to_backing_file(bfc,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1035 si->hash_alg,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1036 hash_tree->hash_tree_area_size,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1037 si->root_hash, si->additional_data,
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1038 si->signature);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1039
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1040 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1041 goto out;
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1042 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1043 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1044
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1045 out:
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1046 if (bfc) {
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1047 mutex_unlock(&bfc->bc_mutex);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1048 incfs_free_bfc(bfc);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1049 }
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1050 incfs_free_mtree(hash_tree);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1051 incfs_free_signature_info(si);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1052 kfree(mem_range.data);
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1053
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1054 if (error)
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1055 pr_debug("incfs: %s error: %d\n", __func__, error);2db8add7871ad9 Eugene Zemtsov 2019-11-18 @1056 return error;2db8add7871ad9 Eugene Zemtsov 2019-11-18 1057 }2db8add7871ad9 Eugene Zemtsov 2019-11-18 1058
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Hi Julia,
Quoted 7 lines · Julia Lawall
The complaint about the missing unlock is a false positive. But it looks like this code could be written in a better way by introducing more goto labels, such that the various failures go to what they actually need to clean up, rather than solving the problem with scattered ifs and NULL assignments.
Absolutely agree. Unfortunately, the team responsible for the integration of incfs into chromeos-5.4 only submitted the initial incfs patches, but not the dozens of cleanup patches. What we see here is the consequence. My apologies for that, but unfortunately this is not in my control. At least some of the problems will hopefully be solved when those follow-up patches are submitted. I am copying the submitter to possibly get an idea when that will be the case. Until then, all we can do is to ignore all reported incfs issues.
Thanks,
Guenter
Quoted 152 lines
thanks,
julia---------- Forwarded message ----------
Date: Sun, 27 Sep 2020 04:57:17 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [chrome-os:chromeos-5.4 10/15] fs/incfs/vfs.c:1056:1-7: preceding lockon line 981CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>tree: https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.4 head: 4f3ab6d3ed02d6fdd9046b05bcfbdd6256608083 commit: 2db8add7871ad9a3a9a0d79a35333cd57a7b3c34 [10/15] ANDROID: Initial commit of Incremental FS:::::: branch date: 4 days ago
:::::: commit date: 5 days ago
config: arc-randconfig-c004-20200926 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>Reported-by Julia Lawall <[email protected]>coccinelle warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
fs/incfs/vfs.c:1056:1-7: preceding lock on line 981
vim +1056
fs/incfs/vfs.c2db8add7871ad9 Eugene Zemtsov 2019-11-18 945 2db8add7871ad9 Eugene Zemtsov 2019-11-18 946 static int init_new_file(struct mount_info *mi, struct dentry *dentry, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 947 incfs_uuid_t *uuid, u64 size, struct mem_range attr, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 948 struct incfs_file_signature_info __user *fsi) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 949 { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 950 struct path path = {}; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 951 struct file *new_file; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 952 int error = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 953 struct backing_file_context *bfc = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 954 u32 block_count; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 955 struct mem_range mem_range = {0}; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 956 struct signature_info *si = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 957 struct mtree *hash_tree = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 958 2db8add7871ad9 Eugene Zemtsov 2019-11-18 959 if (!mi || !dentry || !uuid) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 960 return -EFAULT; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 961 2db8add7871ad9 Eugene Zemtsov 2019-11-18 962 /* Resize newly created file to its true size. */ 2db8add7871ad9 Eugene Zemtsov 2019-11-18 963 path = (struct path) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 964 .mnt = mi->mi_backing_dir_path.mnt, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 965 .dentry = dentry 2db8add7871ad9 Eugene Zemtsov 2019-11-18 966 }; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 967 new_file = dentry_open(&path, O_RDWR | O_NOATIME, mi->mi_owner); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 968 2db8add7871ad9 Eugene Zemtsov 2019-11-18 969 if (IS_ERR(new_file)) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 970 error = PTR_ERR(new_file); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 971 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 972 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 973 2db8add7871ad9 Eugene Zemtsov 2019-11-18 974 bfc = incfs_alloc_bfc(new_file); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 975 if (IS_ERR(bfc)) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 976 error = PTR_ERR(bfc); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 977 bfc = NULL; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 978 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 979 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 980 2db8add7871ad9 Eugene Zemtsov 2019-11-18 @981 mutex_lock(&bfc->bc_mutex); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 982 error = incfs_write_fh_to_backing_file(bfc, uuid, size); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 983 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 984 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 985 2db8add7871ad9 Eugene Zemtsov 2019-11-18 986 block_count = (u32)get_blocks_count_for_size(size); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 987 error = incfs_write_blockmap_to_backing_file(bfc, block_count, NULL); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 988 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 989 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 990 2db8add7871ad9 Eugene Zemtsov 2019-11-18 991 /* This fill has data, reserve space for the block map. */ 2db8add7871ad9 Eugene Zemtsov 2019-11-18 992 if (block_count > 0) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 993 error = incfs_write_blockmap_to_backing_file( 2db8add7871ad9 Eugene Zemtsov 2019-11-18 994 bfc, block_count, NULL); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 995 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 996 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 997 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 998 2db8add7871ad9 Eugene Zemtsov 2019-11-18 999 if (attr.data && attr.len) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1000 error = incfs_write_file_attr_to_backing_file(bfc, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1001 attr, NULL); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1002 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1003 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1004 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1005 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1006 if (fsi) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1007 si = incfs_copy_signature_info_from_user(fsi); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1008 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1009 if (IS_ERR(si)) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1010 error = PTR_ERR(si); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1011 si = NULL; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1012 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1013 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1014 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1015 if (si->hash_alg) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1016 hash_tree = incfs_alloc_mtree(si->hash_alg, block_count, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1017 si->root_hash); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1018 if (IS_ERR(hash_tree)) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1019 error = PTR_ERR(hash_tree); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1020 hash_tree = NULL; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1021 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1022 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1023 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1024 // TODO This code seems wrong when len is zero - we 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1025 // should error out?? 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1026 if (si->signature.len > 0) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1027 error = incfs_validate_pkcs7_signature( 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1028 si->signature, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1029 si->root_hash, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1030 si->additional_data); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1031 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1032 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1033 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1034 error = incfs_write_signature_to_backing_file(bfc, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1035 si->hash_alg, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1036 hash_tree->hash_tree_area_size, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1037 si->root_hash, si->additional_data, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1038 si->signature); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1039 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1040 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1041 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1042 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1043 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1044 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1045 out: 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1046 if (bfc) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1047 mutex_unlock(&bfc->bc_mutex); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1048 incfs_free_bfc(bfc); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1049 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1050 incfs_free_mtree(hash_tree); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1051 incfs_free_signature_info(si); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1052 kfree(mem_range.data); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1053 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1054 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1055 pr_debug("incfs: %s error: %d\n", __func__, error);
2db8add7871ad9Eugene Zemtsov 2019-11-18 @1056 return error;2db8add7871ad9Eugene Zemtsov 2019-11-18 1057 }2db8add7871ad9Eugene Zemtsov 2019-11-18 1058---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Hey all,
unfortunately submitting of the rest of the patches doesn't go that fast because of the problems with DUTs. E.g. I have already tried several times to submit this CL with no luck: https://crrev.com/c/2397767
Hope soon it will go faster
Quoted 251 lines · Guenter Roeck
Hi Julia,
Quoted 7 lines · Julia Lawall
The complaint about the missing unlock is a false positive. But it looks like this code could be written in a better way by introducing more goto labels, such that the various failures go to what they actually need to clean up, rather than solving the problem with scattered ifs and NULL assignments.
Absolutely agree. Unfortunately, the team responsible for the integration of incfs into chromeos-5.4 only submitted the initial incfs patches, but not the dozens of cleanup patches. What we see here is the consequence. My apologies for that, but unfortunately this is not in my control. At least some of the problems will hopefully be solved when those follow-up patches are submitted. I am copying the submitter to possibly get an idea when that will be the case. Until then, all we can do is to ignore all reported incfs issues.
Thanks,
GuenterQuoted 9 lines
thanks,
julia---------- Forwarded message ----------
Date: Sun, 27 Sep 2020 04:57:17 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [chrome-os:chromeos-5.4 10/15] fs/incfs/vfs.c:1056:1-7:preceding lock
Quoted 7 lines
on line 981CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>tree: https://chromium.googlesource.com/chromiumos/third_party/kernel
chromeos-5.4
Quoted 2 lines
head: 4f3ab6d3ed02d6fdd9046b05bcfbdd6256608083 commit: 2db8add7871ad9a3a9a0d79a35333cd57a7b3c34 [10/15] ANDROID:Initial commit of Incremental FS
Quoted 10 lines
:::::: branch date: 4 days ago
:::::: commit date: 5 days ago
config: arc-randconfig-c004-20200926 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>Reported-by Julia Lawall <[email protected]>Quoted 8 lines
coccinelle warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
fs/incfs/vfs.c:1056:1-7: preceding lock on line 981
vim +1056
fs/incfs/vfs.c
2db8add7871ad9Eugene Zemtsov 2019-11-18 9452db8add7871ad9Eugene Zemtsov 2019-11-18 946 static intinit_new_file(struct
mount_info*mi, struct dentry *dentry,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 947
incfs_uuid_t*uuid, u64 size, structmem_rangeattr,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 948 struct
incfs_file_signature_info__user*fsi)Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 949 {2db8add7871ad9Eugene Zemtsov 2019-11-18 950 struct path path= {};
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 951 struct file
*new_file;Quoted 2 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 952 int error = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 953 struct
backing_file_context*bfc = 0;Quoted 2 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 954 u32 block_count; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 955 struct mem_range
mem_range= {0};Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 956 struct
signature_info*si = 0;Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 957 struct mtree
*hash_tree= 0;Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 9582db8add7871ad9Eugene Zemtsov 2019-11-18 959 if (!mi ||!dentry || !uuid)
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 960 return
-EFAULT;Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 9612db8add7871ad9Eugene Zemtsov 2019-11-18 962 /* Resize newlycreated file to its true size. */
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 963 path = (structpath) {
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 964 .mnt =
mi->mi_backing_dir_path.mnt,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 965 .dentry= dentry
Quoted 2 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 966 }; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 967 new_file =
dentry_open(&path, O_RDWR | O_NOATIME, mi->mi_owner);Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 9682db8add7871ad9Eugene Zemtsov 2019-11-18 969 if(
IS_ERR(new_file)) {Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 970 error =
PTR_ERR(new_file);Quoted 4 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 971 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 972 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 973 2db8add7871ad9 Eugene Zemtsov 2019-11-18 974 bfc =
incfs_alloc_bfc(new_file);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 975 if (IS_ERR(bfc)){
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 976 error =
PTR_ERR(bfc);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 977 bfc =NULL;
Quoted 4 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 978 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 979 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 980
2db8add7871ad9Eugene Zemtsov 2019-11-18 @981
mutex_lock(&bfc->bc_mutex);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 982 error =
incfs_write_fh_to_backing_file(bfc, uuid, size);Quoted 4 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 983 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 984 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 985 2db8add7871ad9 Eugene Zemtsov 2019-11-18 986 block_count =(u32)get_blocks_count_for_size(size);
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 987 error =
incfs_write_blockmap_to_backing_file(bfc, block_count, NULL);Quoted 4 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 988 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 989 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 990 2db8add7871ad9 Eugene Zemtsov 2019-11-18 991 /* This fill hasdata, reserve space for the block map. */
Quoted 3 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 992 if (block_count
0) {2db8add7871ad9Eugene Zemtsov 2019-11-18 993 error =incfs_write_blockmap_to_backing_file(
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 994bfc,
block_count, NULL);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 995 if(error)
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 996goto out;
Quoted 3 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 997 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 998 2db8add7871ad9 Eugene Zemtsov 2019-11-18 999 if (attr.data &&attr.len) {
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1000 error =incfs_write_file_attr_to_backing_file(bfc,
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1001attr, NULL);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1002 if(error)
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1003goto out;
Quoted 4 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1004 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1005 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1006 if (fsi) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1007 si =
incfs_copy_signature_info_from_user(fsi);Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 10082db8add7871ad9Eugene Zemtsov 2019-11-18 1009 if(
IS_ERR(si)) {Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1010error =
PTR_ERR(si);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1011si = NULL;
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1012goto out;
Quoted 3 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1013 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1014 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1015 if(
si->hash_alg) {Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1016
hash_tree= incfs_alloc_mtree(si->hash_alg,block_count,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1017si->root_hash);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1018if (
IS_ERR(hash_tree)) {Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1019error = PTR_ERR(hash_tree);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1020hash_tree = NULL;Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1021goto out;Quoted 3 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1022 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1023 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1024// TODO This code seems wrong when len is zero - we
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1025// should error out??
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1026if (
si->signature.len> 0)Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1027error = incfs_validate_pkcs7_signature(Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1028si->signature,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1029si->root_hash,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1030si->additional_data);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1031if (error)
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1032goto out;Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 10332db8add7871ad9Eugene Zemtsov 2019-11-18 1034error = incfs_write_signature_to_backing_file(bfc,
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1035si->hash_alg,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1036hash_tree->hash_tree_area_size,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1037si->root_hash, si->additional_data,Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1038si->signature);Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 10392db8add7871ad9Eugene Zemtsov 2019-11-18 1040if (error)
Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1041goto out;Quoted 6 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1042 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1043 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1044 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1045 out: 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1046 if (bfc) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1047
mutex_unlock(&bfc->bc_mutex);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1048
incfs_free_bfc(bfc);Quoted 2 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 1049 }2db8add7871ad9Eugene Zemtsov 2019-11-18 1050
incfs_free_mtree(hash_tree);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1051
incfs_free_signature_info(si);Quoted 1 line
2db8add7871ad9Eugene Zemtsov 2019-11-18 1052
kfree(mem_range.data);Quoted 3 lines
2db8add7871ad9 Eugene Zemtsov 2019-11-18 1053 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1054 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1055
pr_debug("incfs: %s error: %d\n", __func__, error);Quoted 7 lines
2db8add7871ad9Eugene Zemtsov 2019-11-18 @1056 return error;2db8add7871ad9Eugene Zemtsov 2019-11-18 1057 }2db8add7871ad9Eugene Zemtsov 2019-11-18 1058---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
+Paul Lawrence <[email protected]>
Quoted 238 lines · Julia Lawall
The complaint about the missing unlock is a false positive. But it looks like this code could be written in a better way by introducing more goto labels, such that the various failures go to what they actually need to clean up, rather than solving the problem with scattered ifs and NULL assignments.
thanks,
julia---------- Forwarded message ----------
Date: Sun, 27 Sep 2020 04:57:17 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [chrome-os:chromeos-5.4 10/15] fs/incfs/vfs.c:1056:1-7: preceding lockon line 981CC: kbuild-all(a)lists.01.org
TO: cros-kernel-buildreports(a)googlegroups.com
TO: Guenter Roeck <[email protected]>tree: https://chromium.googlesource.com/chromiumos/third_party/kernel
chromeos-5.4head: 4f3ab6d3ed02d6fdd9046b05bcfbdd6256608083 commit: 2db8add7871ad9a3a9a0d79a35333cd57a7b3c34 [10/15] ANDROID: Initialcommit of Incremental FS
:::::: branch date: 4 days ago
:::::: commit date: 5 days ago
config: arc-randconfig-c004-20200926 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>Reported-by Julia Lawall <[email protected]>coccinelle warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
fs/incfs/vfs.c:1056:1-7: preceding lock on line 981
vim +1056
fs/incfs/vfs.c
2db8add7871ad9Eugene Zemtsov 2019-11-18 9452db8add7871ad9Eugene Zemtsov 2019-11-18 946 static int
init_new_file(structmount_info*mi, struct dentry *dentry,2db8add7871ad9Eugene Zemtsov 2019-11-18 947incfs_uuid_t*uuid, u64 size, structmem_rangeattr,2db8add7871ad9Eugene Zemtsov 2019-11-18 948 structincfs_file_signature_info__user*fsi)2db8add7871ad9Eugene Zemtsov 2019-11-18 949 {2db8add7871ad9Eugene Zemtsov 2019-11-18 950 struct path path =
{};2db8add7871ad9Eugene Zemtsov 2019-11-18 951 struct file*new_file;2db8add7871ad9 Eugene Zemtsov 2019-11-18 952 int error = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 953 struct backing_file_context *bfc = 0; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 954 u32 block_count; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 955 struct mem_range
mem_range= {0};2db8add7871ad9Eugene Zemtsov 2019-11-18 956 structsignature_info*si = 0;2db8add7871ad9Eugene Zemtsov 2019-11-18 957 struct mtree*hash_tree= 0;2db8add7871ad9Eugene Zemtsov 2019-11-18 9582db8add7871ad9Eugene Zemtsov 2019-11-18 959 if (!mi || !dentry|| !uuid) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 960 return
-EFAULT;2db8add7871ad9Eugene Zemtsov 2019-11-18 9612db8add7871ad9Eugene Zemtsov 2019-11-18 962 /* Resize newly
created file to its true size. */2db8add7871ad9Eugene Zemtsov 2019-11-18 963 path = (struct
path) {2db8add7871ad9Eugene Zemtsov 2019-11-18 964 .mnt =mi->mi_backing_dir_path.mnt,2db8add7871ad9Eugene Zemtsov 2019-11-18 965 .dentry =
dentry2db8add7871ad9 Eugene Zemtsov 2019-11-18 966 }; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 967 new_file =
dentry_open(&path, O_RDWR | O_NOATIME, mi->mi_owner);2db8add7871ad9Eugene Zemtsov 2019-11-18 9682db8add7871ad9Eugene Zemtsov 2019-11-18 969 if
(IS_ERR(new_file)) {2db8add7871ad9Eugene Zemtsov 2019-11-18 970 error =PTR_ERR(new_file);2db8add7871ad9 Eugene Zemtsov 2019-11-18 971 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 972 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 973 2db8add7871ad9 Eugene Zemtsov 2019-11-18 974 bfc =
incfs_alloc_bfc(new_file);2db8add7871ad9Eugene Zemtsov 2019-11-18 975 if (IS_ERR(bfc)) {2db8add7871ad9Eugene Zemtsov 2019-11-18 976 error =PTR_ERR(bfc);2db8add7871ad9 Eugene Zemtsov 2019-11-18 977 bfc = NULL; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 978 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 979 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 980
2db8add7871ad9Eugene Zemtsov 2019-11-18 @981mutex_lock(&bfc->bc_mutex);2db8add7871ad9Eugene Zemtsov 2019-11-18 982 error =incfs_write_fh_to_backing_file(bfc, uuid, size);2db8add7871ad9 Eugene Zemtsov 2019-11-18 983 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 984 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 985 2db8add7871ad9 Eugene Zemtsov 2019-11-18 986 block_count = (u32)get_blocks_count_for_size(size); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 987 error = incfs_write_blockmap_to_backing_file(bfc, block_count, NULL); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 988 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 989 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 990 2db8add7871ad9 Eugene Zemtsov 2019-11-18 991 /* This fill hasdata, reserve space for the block map. */
2db8add7871ad9Eugene Zemtsov 2019-11-18 992 if (block_count>
0) {2db8add7871ad9Eugene Zemtsov 2019-11-18 993 error =
incfs_write_blockmap_to_backing_file(2db8add7871ad9Eugene Zemtsov 2019-11-18 994
bfc,block_count, NULL);2db8add7871ad9Eugene Zemtsov 2019-11-18 995 if (error)2db8add7871ad9Eugene Zemtsov 2019-11-18 996
goto out;2db8add7871ad9 Eugene Zemtsov 2019-11-18 997 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 998 2db8add7871ad9 Eugene Zemtsov 2019-11-18 999 if (attr.data &&attr.len) {
2db8add7871ad9Eugene Zemtsov 2019-11-18 1000 error =
incfs_write_file_attr_to_backing_file(bfc,2db8add7871ad9Eugene Zemtsov 2019-11-18 1001attr, NULL); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1002 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1003 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1004 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1005 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1006 if (fsi) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1007 si =
incfs_copy_signature_info_from_user(fsi);2db8add7871ad9Eugene Zemtsov 2019-11-18 10082db8add7871ad9Eugene Zemtsov 2019-11-18 1009 if
(IS_ERR(si)) {2db8add7871ad9Eugene Zemtsov 2019-11-18 1010
error =PTR_ERR(si);2db8add7871ad9Eugene Zemtsov 2019-11-18 1011 si
= NULL;2db8add7871ad9Eugene Zemtsov 2019-11-18 1012
goto out;2db8add7871ad9 Eugene Zemtsov 2019-11-18 1013 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1014 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1015 if(
si->hash_alg) {2db8add7871ad9Eugene Zemtsov 2019-11-18 1016hash_tree= incfs_alloc_mtree(si->hash_alg,block_count,2db8add7871ad9Eugene Zemtsov 2019-11-18 1017si->root_hash); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1018 if (IS_ERR(hash_tree)) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1019 error = PTR_ERR(hash_tree); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1020 hash_tree = NULL; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1021 goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1022 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1023 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1024 //TODO This code seems wrong when len is zero - we
2db8add7871ad9Eugene Zemtsov 2019-11-18 1025 //
should error out??2db8add7871ad9Eugene Zemtsov 2019-11-18 1026 if
(si->signature.len> 0)2db8add7871ad9Eugene Zemtsov 2019-11-18 1027error = incfs_validate_pkcs7_signature( 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1028 si->signature, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1029 si->root_hash, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1030 si->additional_data); 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1031 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1032 goto out;
2db8add7871ad9Eugene Zemtsov 2019-11-18 10332db8add7871ad9Eugene Zemtsov 2019-11-18 1034 error = incfs_write_signature_to_backing_file(bfc,2db8add7871ad9Eugene Zemtsov 2019-11-18 1035si->hash_alg, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1036 hash_tree->hash_tree_area_size, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1037 si->root_hash, si->additional_data, 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1038 si->signature);
2db8add7871ad9Eugene Zemtsov 2019-11-18 10392db8add7871ad9Eugene Zemtsov 2019-11-18 1040 if
(error)2db8add7871ad9Eugene Zemtsov 2019-11-18 1041goto out; 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1042 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1043 } 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1044 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1045 out: 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1046 if (bfc) { 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1047
mutex_unlock(&bfc->bc_mutex);2db8add7871ad9Eugene Zemtsov 2019-11-18 1048incfs_free_bfc(bfc);2db8add7871ad9Eugene Zemtsov 2019-11-18 1049 }2db8add7871ad9Eugene Zemtsov 2019-11-18 1050incfs_free_mtree(hash_tree);2db8add7871ad9Eugene Zemtsov 2019-11-18 1051incfs_free_signature_info(si);2db8add7871ad9Eugene Zemtsov 2019-11-18 1052kfree(mem_range.data);2db8add7871ad9 Eugene Zemtsov 2019-11-18 1053 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1054 if (error) 2db8add7871ad9 Eugene Zemtsov 2019-11-18 1055
pr_debug("incfs: %s error: %d\n", __func__, error);2db8add7871ad9Eugene Zemtsov 2019-11-18 @1056 return error;2db8add7871ad9Eugene Zemtsov 2019-11-18 1057 }2db8add7871ad9Eugene Zemtsov 2019-11-18 1058---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org--
You received this message because you are subscribed to the Google Groups "cros-kernel-buildreports" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cros-kernel-buildreports+unsubscribe(a)googlegroups.com. To view this discussion on the web visit
https://groups.google.com/d/msgid/cros-kernel-buildreports/alpine.DEB.2.22.394.2009270957370.2839%40hadrien
.