CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Erel Geron <erelx.geron(a)intel.com>
CC: Johannes Berg <johannes.berg(a)intel.com>
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: deacdb3e3979979016fcd0ffd518c320a62ad166
commit: 5d44fe7c9808c56e136e59147bd932f5491520f1 mac80211_hwsim: add frame transmission
support over virtio
date: 4 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 4 months ago
config: h8300-randconfig-m031-20200731 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/net/wireless/mac80211_hwsim.c:4079 hwsim_virtio_rx_work() error: double unlocked
'hwsim_virtio_lock' (orig line 4058)
drivers/net/wireless/mac80211_hwsim.c:4163 hwsim_virtio_probe() error: double unlocked
'hwsim_virtio_lock' (orig line 4151)
#
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout 5d44fe7c9808c56e136e59147bd932f5491520f1
vim +/hwsim_virtio_lock +4079 drivers/net/wireless/mac80211_hwsim.c
5d44fe7c9808c56 Erel Geron 2020-03-05 4041
5d44fe7c9808c56 Erel Geron 2020-03-05 4042 static void hwsim_virtio_rx_work(struct
work_struct *work)
5d44fe7c9808c56 Erel Geron 2020-03-05 4043 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4044 struct virtqueue *vq;
5d44fe7c9808c56 Erel Geron 2020-03-05 4045 unsigned int len;
5d44fe7c9808c56 Erel Geron 2020-03-05 4046 struct sk_buff *skb;
5d44fe7c9808c56 Erel Geron 2020-03-05 4047 struct scatterlist sg[1];
5d44fe7c9808c56 Erel Geron 2020-03-05 4048 int err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4049 unsigned long flags;
5d44fe7c9808c56 Erel Geron 2020-03-05 4050
5d44fe7c9808c56 Erel Geron 2020-03-05 4051 spin_lock_irqsave(&hwsim_virtio_lock,
flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4052 if (!hwsim_virtio_enabled)
5d44fe7c9808c56 Erel Geron 2020-03-05 4053 goto out_unlock;
5d44fe7c9808c56 Erel Geron 2020-03-05 4054
5d44fe7c9808c56 Erel Geron 2020-03-05 4055 skb =
virtqueue_get_buf(hwsim_vqs[HWSIM_VQ_RX], &len);
5d44fe7c9808c56 Erel Geron 2020-03-05 4056 if (!skb)
5d44fe7c9808c56 Erel Geron 2020-03-05 4057 goto out_unlock;
5d44fe7c9808c56 Erel Geron 2020-03-05 @4058
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4059
5d44fe7c9808c56 Erel Geron 2020-03-05 4060 skb->data = skb->head;
5d44fe7c9808c56 Erel Geron 2020-03-05 4061 skb_set_tail_pointer(skb, len);
5d44fe7c9808c56 Erel Geron 2020-03-05 4062 hwsim_virtio_handle_cmd(skb);
5d44fe7c9808c56 Erel Geron 2020-03-05 4063
5d44fe7c9808c56 Erel Geron 2020-03-05 4064 spin_lock_irqsave(&hwsim_virtio_lock,
flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4065 if (!hwsim_virtio_enabled) {
5d44fe7c9808c56 Erel Geron 2020-03-05 4066 nlmsg_free(skb);
5d44fe7c9808c56 Erel Geron 2020-03-05 4067 goto out_unlock;
5d44fe7c9808c56 Erel Geron 2020-03-05 4068 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4069 vq = hwsim_vqs[HWSIM_VQ_RX];
5d44fe7c9808c56 Erel Geron 2020-03-05 4070 sg_init_one(sg, skb->head,
skb_end_offset(skb));
5d44fe7c9808c56 Erel Geron 2020-03-05 4071 err = virtqueue_add_inbuf(vq, sg, 1, skb,
GFP_KERNEL);
5d44fe7c9808c56 Erel Geron 2020-03-05 4072 if (WARN(err, "virtqueue_add_inbuf
returned %d\n", err))
5d44fe7c9808c56 Erel Geron 2020-03-05 4073 nlmsg_free(skb);
5d44fe7c9808c56 Erel Geron 2020-03-05 4074 else
5d44fe7c9808c56 Erel Geron 2020-03-05 4075 virtqueue_kick(vq);
5d44fe7c9808c56 Erel Geron 2020-03-05 4076 schedule_work(&hwsim_virtio_rx);
5d44fe7c9808c56 Erel Geron 2020-03-05 4077
5d44fe7c9808c56 Erel Geron 2020-03-05 4078 out_unlock:
5d44fe7c9808c56 Erel Geron 2020-03-05 @4079
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4080 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4081
5d44fe7c9808c56 Erel Geron 2020-03-05 4082 static void hwsim_virtio_rx_done(struct
virtqueue *vq)
5d44fe7c9808c56 Erel Geron 2020-03-05 4083 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4084 schedule_work(&hwsim_virtio_rx);
5d44fe7c9808c56 Erel Geron 2020-03-05 4085 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4086
5d44fe7c9808c56 Erel Geron 2020-03-05 4087 static int init_vqs(struct virtio_device
*vdev)
5d44fe7c9808c56 Erel Geron 2020-03-05 4088 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4089 vq_callback_t *callbacks[HWSIM_NUM_VQS] = {
5d44fe7c9808c56 Erel Geron 2020-03-05 4090 [HWSIM_VQ_TX] = hwsim_virtio_tx_done,
5d44fe7c9808c56 Erel Geron 2020-03-05 4091 [HWSIM_VQ_RX] = hwsim_virtio_rx_done,
5d44fe7c9808c56 Erel Geron 2020-03-05 4092 };
5d44fe7c9808c56 Erel Geron 2020-03-05 4093 const char *names[HWSIM_NUM_VQS] = {
5d44fe7c9808c56 Erel Geron 2020-03-05 4094 [HWSIM_VQ_TX] = "tx",
5d44fe7c9808c56 Erel Geron 2020-03-05 4095 [HWSIM_VQ_RX] = "rx",
5d44fe7c9808c56 Erel Geron 2020-03-05 4096 };
5d44fe7c9808c56 Erel Geron 2020-03-05 4097
5d44fe7c9808c56 Erel Geron 2020-03-05 4098 return virtio_find_vqs(vdev, HWSIM_NUM_VQS,
5d44fe7c9808c56 Erel Geron 2020-03-05 4099 hwsim_vqs, callbacks, names,
NULL);
5d44fe7c9808c56 Erel Geron 2020-03-05 4100 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4101
5d44fe7c9808c56 Erel Geron 2020-03-05 4102 static int fill_vq(struct virtqueue *vq)
5d44fe7c9808c56 Erel Geron 2020-03-05 4103 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4104 int i, err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4105 struct sk_buff *skb;
5d44fe7c9808c56 Erel Geron 2020-03-05 4106 struct scatterlist sg[1];
5d44fe7c9808c56 Erel Geron 2020-03-05 4107
5d44fe7c9808c56 Erel Geron 2020-03-05 4108 for (i = 0; i <
virtqueue_get_vring_size(vq); i++) {
5d44fe7c9808c56 Erel Geron 2020-03-05 4109 skb = genlmsg_new(GENLMSG_DEFAULT_SIZE,
GFP_KERNEL);
5d44fe7c9808c56 Erel Geron 2020-03-05 4110 if (!skb)
5d44fe7c9808c56 Erel Geron 2020-03-05 4111 return -ENOMEM;
5d44fe7c9808c56 Erel Geron 2020-03-05 4112
5d44fe7c9808c56 Erel Geron 2020-03-05 4113 sg_init_one(sg, skb->head,
skb_end_offset(skb));
5d44fe7c9808c56 Erel Geron 2020-03-05 4114 err = virtqueue_add_inbuf(vq, sg, 1, skb,
GFP_KERNEL);
5d44fe7c9808c56 Erel Geron 2020-03-05 4115 if (err) {
5d44fe7c9808c56 Erel Geron 2020-03-05 4116 nlmsg_free(skb);
5d44fe7c9808c56 Erel Geron 2020-03-05 4117 return err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4118 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4119 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4120 virtqueue_kick(vq);
5d44fe7c9808c56 Erel Geron 2020-03-05 4121 return 0;
5d44fe7c9808c56 Erel Geron 2020-03-05 4122 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4123
5d44fe7c9808c56 Erel Geron 2020-03-05 4124 static void remove_vqs(struct virtio_device
*vdev)
5d44fe7c9808c56 Erel Geron 2020-03-05 4125 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4126 int i;
5d44fe7c9808c56 Erel Geron 2020-03-05 4127
5d44fe7c9808c56 Erel Geron 2020-03-05 4128 vdev->config->reset(vdev);
5d44fe7c9808c56 Erel Geron 2020-03-05 4129
5d44fe7c9808c56 Erel Geron 2020-03-05 4130 for (i = 0; i < ARRAY_SIZE(hwsim_vqs);
i++) {
5d44fe7c9808c56 Erel Geron 2020-03-05 4131 struct virtqueue *vq = hwsim_vqs[i];
5d44fe7c9808c56 Erel Geron 2020-03-05 4132 struct sk_buff *skb;
5d44fe7c9808c56 Erel Geron 2020-03-05 4133
5d44fe7c9808c56 Erel Geron 2020-03-05 4134 while ((skb =
virtqueue_detach_unused_buf(vq)))
5d44fe7c9808c56 Erel Geron 2020-03-05 4135 nlmsg_free(skb);
5d44fe7c9808c56 Erel Geron 2020-03-05 4136 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4137
5d44fe7c9808c56 Erel Geron 2020-03-05 4138 vdev->config->del_vqs(vdev);
5d44fe7c9808c56 Erel Geron 2020-03-05 4139 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4140
5d44fe7c9808c56 Erel Geron 2020-03-05 4141 static int hwsim_virtio_probe(struct
virtio_device *vdev)
5d44fe7c9808c56 Erel Geron 2020-03-05 4142 {
5d44fe7c9808c56 Erel Geron 2020-03-05 4143 int err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4144 unsigned long flags;
5d44fe7c9808c56 Erel Geron 2020-03-05 4145
5d44fe7c9808c56 Erel Geron 2020-03-05 4146 spin_lock_irqsave(&hwsim_virtio_lock,
flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4147 if (hwsim_virtio_enabled) {
5d44fe7c9808c56 Erel Geron 2020-03-05 4148
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4149 return -EEXIST;
5d44fe7c9808c56 Erel Geron 2020-03-05 4150 }
5d44fe7c9808c56 Erel Geron 2020-03-05 @4151
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4152
5d44fe7c9808c56 Erel Geron 2020-03-05 4153 err = init_vqs(vdev);
5d44fe7c9808c56 Erel Geron 2020-03-05 4154 if (err)
5d44fe7c9808c56 Erel Geron 2020-03-05 4155 return err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4156
5d44fe7c9808c56 Erel Geron 2020-03-05 4157 err = fill_vq(hwsim_vqs[HWSIM_VQ_RX]);
5d44fe7c9808c56 Erel Geron 2020-03-05 4158 if (err)
5d44fe7c9808c56 Erel Geron 2020-03-05 4159 goto out_remove;
5d44fe7c9808c56 Erel Geron 2020-03-05 4160
5d44fe7c9808c56 Erel Geron 2020-03-05 4161 spin_lock_irqsave(&hwsim_virtio_lock,
flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4162 hwsim_virtio_enabled = true;
5d44fe7c9808c56 Erel Geron 2020-03-05 @4163
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
5d44fe7c9808c56 Erel Geron 2020-03-05 4164
5d44fe7c9808c56 Erel Geron 2020-03-05 4165 schedule_work(&hwsim_virtio_rx);
5d44fe7c9808c56 Erel Geron 2020-03-05 4166 return 0;
5d44fe7c9808c56 Erel Geron 2020-03-05 4167
5d44fe7c9808c56 Erel Geron 2020-03-05 4168 out_remove:
5d44fe7c9808c56 Erel Geron 2020-03-05 4169 remove_vqs(vdev);
5d44fe7c9808c56 Erel Geron 2020-03-05 4170 return err;
5d44fe7c9808c56 Erel Geron 2020-03-05 4171 }
5d44fe7c9808c56 Erel Geron 2020-03-05 4172
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org