From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: fs/pstore/zone.c:942 register_pstore_zone() warn: inconsistent returns 'cxt->pstore_zone_info_lock'.
Date: Sun, 17 Jan 2021 06:45:16 +0800 [thread overview]
Message-ID: <202101170613.F4EhBHLq-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6947 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: WeiXiong Liao <liaoweixiong@allwinnertech.com>
CC: Kees Cook <keescook@chromium.org>
Hi WeiXiong,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0da0a8a0a0e1845f495431c3d8d733d2bbf9e9e5
commit: 17639f67c1d61aba3c05e7703f75cd468f9d484f pstore/blk: Introduce backend for block devices
date: 8 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 8 months ago
config: x86_64-randconfig-m001-20210117 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/pstore/zone.c:942 register_pstore_zone() warn: inconsistent returns 'cxt->pstore_zone_info_lock'.
vim +942 fs/pstore/zone.c
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 871
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 872 /*
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 873 * the @read and @write must be applied.
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 874 * if no @read, pstore may mount failed.
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 875 * if no @write, pstore do not support to remove record file.
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 876 */
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 877 if (!info->read || !info->write) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 878 pr_err("no valid general read/write interface\n");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 879 return -EINVAL;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 880 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 881
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 882 mutex_lock(&cxt->pstore_zone_info_lock);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 883 if (cxt->pstore_zone_info) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 884 pr_warn("'%s' already loaded: ignoring '%s'\n",
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 885 cxt->pstore_zone_info->name, info->name);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 886 mutex_unlock(&cxt->pstore_zone_info_lock);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 887 return -EBUSY;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 888 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 889 cxt->pstore_zone_info = info;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 890
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 891 pr_debug("register %s with properties:\n", info->name);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 892 pr_debug("\ttotal size : %ld Bytes\n", info->total_size);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 893 pr_debug("\tkmsg size : %ld Bytes\n", info->kmsg_size);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 894
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 895 err = psz_alloc_zones(cxt);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 896 if (err) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 897 pr_err("alloc zones failed\n");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 898 goto fail_out;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 899 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 900
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 901 if (info->kmsg_size) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 902 cxt->pstore.bufsize = cxt->kpszs[0]->buffer_size -
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 903 sizeof(struct psz_kmsg_header);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 904 cxt->pstore.buf = kzalloc(cxt->pstore.bufsize, GFP_KERNEL);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 905 if (!cxt->pstore.buf) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 906 err = -ENOMEM;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 907 goto fail_free;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 908 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 909 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 910 cxt->pstore.data = cxt;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 911
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 912 pr_info("registered %s as backend for", info->name);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 913 cxt->pstore.max_reason = info->max_reason;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 914 cxt->pstore.name = info->name;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 915 if (info->kmsg_size) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 916 cxt->pstore.flags |= PSTORE_FLAGS_DMESG;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 917 pr_cont(" kmsg(%s",
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 918 kmsg_dump_reason_str(cxt->pstore.max_reason));
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 919 if (cxt->pstore_zone_info->panic_write)
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 920 pr_cont(",panic_write");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 921 pr_cont(")");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 922 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 923 pr_cont("\n");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 924
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 925 err = pstore_register(&cxt->pstore);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 926 if (err) {
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 927 pr_err("registering with pstore failed\n");
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 928 goto fail_free;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 929 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 930 mutex_unlock(&pstore_zone_cxt.pstore_zone_info_lock);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 931
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 932 return 0;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 933
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 934 fail_free:
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 935 kfree(cxt->pstore.buf);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 936 cxt->pstore.buf = NULL;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 937 cxt->pstore.bufsize = 0;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 938 psz_free_all_zones(cxt);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 939 fail_out:
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 940 pstore_zone_cxt.pstore_zone_info = NULL;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 941 mutex_unlock(&pstore_zone_cxt.pstore_zone_info_lock);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 @942 return err;
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 943 }
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 944 EXPORT_SYMBOL_GPL(register_pstore_zone);
d26c3321fe18dc74 WeiXiong Liao 2020-03-25 945
:::::: The code at line 942 was first introduced by commit
:::::: d26c3321fe18dc74517dc1f518d584aa33b0a851 pstore/zone: Introduce common layer to manage storage zones
:::::: TO: WeiXiong Liao <liaoweixiong@allwinnertech.com>
:::::: CC: Kees Cook <keescook@chromium.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32266 bytes --]
reply other threads:[~2021-01-16 22:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202101170613.F4EhBHLq-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.