From: kernel test robot <rong.a.chen@intel.com>
To: Lv Yunlong <lyl2019@mail.ustc.edu.cn>,
philipp.reisner@linbit.com, lars.ellenberg@linbit.com,
axboe@kernel.dk
Cc: kbuild-all@lists.01.org, drbd-dev@lists.linbit.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Subject: Re: [PATCH] drbd: Fix a use after free in get_initial_state
Date: Fri, 2 Apr 2021 13:09:44 +0800 [thread overview]
Message-ID: <20210402050944.GA176778@shao2-debian> (raw)
In-Reply-To: <20210401115753.3684-1-lyl2019@mail.ustc.edu.cn>
[-- Attachment #1: Type: text/plain, Size: 15507 bytes --]
Hi Lv,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on block/for-next]
[also build test WARNING on linux/master linus/master v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Lv-Yunlong/drbd-Fix-a-use-after-free-in-get_initial_state/20210402-015401
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
config: x86_64-randconfig-s021-20210401 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
# https://github.com/0day-ci/linux/commit/af3f55d6c8730c5c1ce31fda165712091584adb0
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Lv-Yunlong/drbd-Fix-a-use-after-free-in-get_initial_state/20210402-015401
git checkout af3f55d6c8730c5c1ce31fda165712091584adb0
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/block/drbd/drbd_nl.c:4957:1: sparse: sparse: unused label 'out'
drivers/block/drbd/drbd_nl.c: note: in included file:
include/linux/genl_magic_func.h:212:12: sparse: sparse: symbol 'drbd_genl_cmd_to_str' was not declared. Should it be static?
drivers/block/drbd/drbd_nl.c:454:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:454:33: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:454:33: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:691:38: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:691:38: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:691:38: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:793:40: sparse: sparse: mixing different enum types:
drivers/block/drbd/drbd_nl.c:793:40: sparse: int enum drbd_state_rv
drivers/block/drbd/drbd_nl.c:793:40: sparse: unsigned int enum drbd_ret_code
drivers/block/drbd/drbd_nl.c:795:40: sparse: sparse: mixing different enum types:
drivers/block/drbd/drbd_nl.c:795:40: sparse: int enum drbd_state_rv
drivers/block/drbd/drbd_nl.c:795:40: sparse: unsigned int enum drbd_ret_code
drivers/block/drbd/drbd_nl.c:980:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:980:18: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:980:18: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1287:41: sparse: sparse: cast to restricted __be32
drivers/block/drbd/drbd_nl.c:1347:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:1347:22: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:1347:22: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:1639:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:1639:17: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:1639:17: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:1649:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:1649:17: sparse: struct fifo_buffer [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:1649:17: sparse: struct fifo_buffer *
drivers/block/drbd/drbd_nl.c:1872:14: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:1872:14: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:1872:14: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:2130:39: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2130:39: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2130:39: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:2138:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2138:13: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2138:13: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:2320:50: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2320:50: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2320:50: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:2343:45: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2343:45: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2343:45: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:2488:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2488:9: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2488:9: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:2651:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2651:9: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2651:9: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:2803:27: sparse: sparse: mixing different enum types:
drivers/block/drbd/drbd_nl.c:2883:18: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2883:18: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2883:18: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:2923:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:2923:17: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:2923:17: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:3461:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:3461:33: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:3461:33: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:3586:28: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:3586:28: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:3586:28: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:3799:29: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:3799:29: sparse: struct disk_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:3799:29: sparse: struct disk_conf *
drivers/block/drbd/drbd_nl.c:3805:22: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:3805:22: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:3805:22: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:3995:38: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_nl.c:3995:38: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_nl.c:3995:38: sparse: struct net_conf *
drivers/block/drbd/drbd_nl.c:450:9: sparse: sparse: context imbalance in 'highest_fencing_policy' - different lock contexts for basic block
drivers/block/drbd/drbd_nl.c:2185:9: sparse: sparse: context imbalance in 'drbd_adm_attach' - different lock contexts for basic block
drivers/block/drbd/drbd_nl.c: note: in included file:
drivers/block/drbd/drbd_int.h:2141:14: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:2141:14: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:2141:14: sparse: struct net_conf *
drivers/block/drbd/drbd_int.h:780:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf *
drivers/block/drbd/drbd_int.h:780:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf *
drivers/block/drbd/drbd_int.h:780:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf *
drivers/block/drbd/drbd_int.h:780:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf *
drivers/block/drbd/drbd_int.h:780:24: sparse: sparse: incompatible types in comparison expression (different address spaces):
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf [noderef] __rcu *
drivers/block/drbd/drbd_int.h:780:24: sparse: struct net_conf *
vim +/out +4957 drivers/block/drbd/drbd_nl.c
a29728463b254c Andreas Gruenbacher 2014-07-31 4902
a29728463b254c Andreas Gruenbacher 2014-07-31 4903 static int get_initial_state(struct sk_buff *skb, struct netlink_callback *cb)
a29728463b254c Andreas Gruenbacher 2014-07-31 4904 {
a29728463b254c Andreas Gruenbacher 2014-07-31 4905 struct drbd_state_change *state_change = (struct drbd_state_change *)cb->args[0];
a29728463b254c Andreas Gruenbacher 2014-07-31 4906 unsigned int seq = cb->args[2];
a29728463b254c Andreas Gruenbacher 2014-07-31 4907 unsigned int n;
af3f55d6c8730c Lv Yunlong 2021-04-01 4908 unsigned int skb_len = skb->len;
a29728463b254c Andreas Gruenbacher 2014-07-31 4909 enum drbd_notification_type flags = 0;
a29728463b254c Andreas Gruenbacher 2014-07-31 4910
a29728463b254c Andreas Gruenbacher 2014-07-31 4911 /* There is no need for taking notification_mutex here: it doesn't
a29728463b254c Andreas Gruenbacher 2014-07-31 4912 matter if the initial state events mix with later state chage
a29728463b254c Andreas Gruenbacher 2014-07-31 4913 events; we can always tell the events apart by the NOTIFY_EXISTS
a29728463b254c Andreas Gruenbacher 2014-07-31 4914 flag. */
a29728463b254c Andreas Gruenbacher 2014-07-31 4915
a29728463b254c Andreas Gruenbacher 2014-07-31 4916 cb->args[5]--;
a29728463b254c Andreas Gruenbacher 2014-07-31 4917 if (cb->args[5] == 1) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4918 notify_initial_state_done(skb, seq);
af3f55d6c8730c Lv Yunlong 2021-04-01 4919 return skb_len;
a29728463b254c Andreas Gruenbacher 2014-07-31 4920 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4921 n = cb->args[4]++;
a29728463b254c Andreas Gruenbacher 2014-07-31 4922 if (cb->args[4] < cb->args[3])
a29728463b254c Andreas Gruenbacher 2014-07-31 4923 flags |= NOTIFY_CONTINUES;
a29728463b254c Andreas Gruenbacher 2014-07-31 4924 if (n < 1) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4925 notify_resource_state_change(skb, seq, state_change->resource,
a29728463b254c Andreas Gruenbacher 2014-07-31 4926 NOTIFY_EXISTS | flags);
a29728463b254c Andreas Gruenbacher 2014-07-31 4927 goto next;
a29728463b254c Andreas Gruenbacher 2014-07-31 4928 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4929 n--;
a29728463b254c Andreas Gruenbacher 2014-07-31 4930 if (n < state_change->n_connections) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4931 notify_connection_state_change(skb, seq, &state_change->connections[n],
a29728463b254c Andreas Gruenbacher 2014-07-31 4932 NOTIFY_EXISTS | flags);
a29728463b254c Andreas Gruenbacher 2014-07-31 4933 goto next;
a29728463b254c Andreas Gruenbacher 2014-07-31 4934 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4935 n -= state_change->n_connections;
a29728463b254c Andreas Gruenbacher 2014-07-31 4936 if (n < state_change->n_devices) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4937 notify_device_state_change(skb, seq, &state_change->devices[n],
a29728463b254c Andreas Gruenbacher 2014-07-31 4938 NOTIFY_EXISTS | flags);
a29728463b254c Andreas Gruenbacher 2014-07-31 4939 goto next;
a29728463b254c Andreas Gruenbacher 2014-07-31 4940 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4941 n -= state_change->n_devices;
a29728463b254c Andreas Gruenbacher 2014-07-31 4942 if (n < state_change->n_devices * state_change->n_connections) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4943 notify_peer_device_state_change(skb, seq, &state_change->peer_devices[n],
a29728463b254c Andreas Gruenbacher 2014-07-31 4944 NOTIFY_EXISTS | flags);
a29728463b254c Andreas Gruenbacher 2014-07-31 4945 goto next;
a29728463b254c Andreas Gruenbacher 2014-07-31 4946 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4947
a29728463b254c Andreas Gruenbacher 2014-07-31 4948 next:
a29728463b254c Andreas Gruenbacher 2014-07-31 4949 if (cb->args[4] == cb->args[3]) {
a29728463b254c Andreas Gruenbacher 2014-07-31 4950 struct drbd_state_change *next_state_change =
a29728463b254c Andreas Gruenbacher 2014-07-31 4951 list_entry(state_change->list.next,
a29728463b254c Andreas Gruenbacher 2014-07-31 4952 struct drbd_state_change, list);
a29728463b254c Andreas Gruenbacher 2014-07-31 4953 cb->args[0] = (long)next_state_change;
a29728463b254c Andreas Gruenbacher 2014-07-31 4954 cb->args[3] = notifications_for_state_change(next_state_change);
a29728463b254c Andreas Gruenbacher 2014-07-31 4955 cb->args[4] = 0;
a29728463b254c Andreas Gruenbacher 2014-07-31 4956 }
a29728463b254c Andreas Gruenbacher 2014-07-31 @4957 out:
a29728463b254c Andreas Gruenbacher 2014-07-31 4958 return skb->len;
a29728463b254c Andreas Gruenbacher 2014-07-31 4959 }
a29728463b254c Andreas Gruenbacher 2014-07-31 4960
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41710 bytes --]
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
prev parent reply other threads:[~2021-04-02 5:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 11:57 [PATCH] drbd: Fix a use after free in get_initial_state Lv Yunlong
2021-04-01 13:01 ` [Drbd-dev] " Christoph Böhmwalder
2021-04-01 15:13 ` lyl2019
2021-04-01 15:17 ` lyl2019
2021-04-02 5:09 ` kernel test robot [this message]
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=20210402050944.GA176778@shao2-debian \
--to=rong.a.chen@intel.com \
--cc=axboe@kernel.dk \
--cc=drbd-dev@lists.linbit.com \
--cc=kbuild-all@lists.01.org \
--cc=lars.ellenberg@linbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyl2019@mail.ustc.edu.cn \
--cc=philipp.reisner@linbit.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox