mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-23 13:41:27 +00:00
Made sure that srpt_release() doesn't oops if srpt_add_one() fails after
having registered the target and before the srpt_post_recv() loop started. Reported-by: Frank Zago <fzago@systemfabricworks.com>. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2963 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3510,6 +3510,10 @@ static void srpt_add_one(struct ib_device *device)
|
||||
if (!sdev)
|
||||
goto err;
|
||||
|
||||
sdev->device = device;
|
||||
INIT_LIST_HEAD(&sdev->rch_list);
|
||||
spin_lock_init(&sdev->spinlock);
|
||||
|
||||
sdev->scst_tgt = scst_register_target(&srpt_template, NULL);
|
||||
if (!sdev->scst_tgt) {
|
||||
PRINT_ERROR("SCST registration failed for %s.",
|
||||
@@ -3519,8 +3523,6 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
scst_tgt_set_tgt_priv(sdev->scst_tgt, sdev);
|
||||
|
||||
sdev->device = device;
|
||||
|
||||
sdev->dev.class = &srpt_class;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
|
||||
sdev->dev.dev = device->dma_device;
|
||||
@@ -3602,9 +3604,6 @@ static void srpt_add_one(struct ib_device *device)
|
||||
if (!sdev->ioctx_ring)
|
||||
goto err_event;
|
||||
|
||||
INIT_LIST_HEAD(&sdev->rch_list);
|
||||
spin_lock_init(&sdev->spinlock);
|
||||
|
||||
for (i = 0; i < sdev->srq_size; ++i)
|
||||
srpt_post_recv(sdev, sdev->ioctx_ring[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user