diff options
author | David S. Miller <davem@davemloft.net> | 2019-03-27 17:37:58 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-03-27 17:37:58 -0700 |
commit | 356d71e00d278d865f8c7f68adebd6ce4698a7e2 (patch) | |
tree | 8cb2dabf7440b56c6dee76b4253210c6b603b98e /drivers/target | |
parent | df453700e8d81b1bdafdf684365ee2b9431fb702 (diff) | |
parent | 1a9df9e29c2afecf6e3089442d429b377279ca3c (diff) | |
download | lwn-356d71e00d278d865f8c7f68adebd6ce4698a7e2.tar.gz lwn-356d71e00d278d865f8c7f68adebd6ce4698a7e2.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_user.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 845b32eaff36..481d371c4b01 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -1660,7 +1660,7 @@ static void tcmu_dev_kref_release(struct kref *kref) WARN_ON(!all_expired); tcmu_blocks_release(&udev->data_blocks, 0, udev->dbi_max + 1); - kfree(udev->data_bitmap); + bitmap_free(udev->data_bitmap); mutex_unlock(&udev->cmdr_lock); call_rcu(&dev->rcu_head, tcmu_dev_call_rcu); @@ -1791,11 +1791,12 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev, ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0, TCMU_MCGRP_CONFIG, GFP_KERNEL); - /* We don't care if no one is listening */ - if (ret == -ESRCH) - ret = 0; - if (!ret) - ret = tcmu_wait_genl_cmd_reply(udev); + + /* Wait during an add as the listener may not be up yet */ + if (ret == 0 || + (ret == -ESRCH && cmd == TCMU_CMD_ADDED_DEVICE)) + return tcmu_wait_genl_cmd_reply(udev); + return ret; } @@ -1867,9 +1868,7 @@ static int tcmu_configure_device(struct se_device *dev) info = &udev->uio_info; mutex_lock(&udev->cmdr_lock); - udev->data_bitmap = kcalloc(BITS_TO_LONGS(udev->max_blocks), - sizeof(unsigned long), - GFP_KERNEL); + udev->data_bitmap = bitmap_zalloc(udev->max_blocks, GFP_KERNEL); mutex_unlock(&udev->cmdr_lock); if (!udev->data_bitmap) { ret = -ENOMEM; @@ -1956,7 +1955,7 @@ err_register: vfree(udev->mb_addr); udev->mb_addr = NULL; err_vzalloc: - kfree(udev->data_bitmap); + bitmap_free(udev->data_bitmap); udev->data_bitmap = NULL; err_bitmap_alloc: kfree(info->name); |