scst, tgt_dev: Hold a reference on struct scst_device

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8034 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-03-10 04:43:31 +00:00
parent e161c14a57
commit 9380e29a27

View File

@@ -5470,6 +5470,8 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
*out_tgt_dev = tgt_dev;
percpu_ref_get(&dev->refcnt);
out:
TRACE_EXIT_RES(res);
return res;
@@ -5572,6 +5574,8 @@ static void scst_free_tgt_dev(struct scst_tgt_dev *tgt_dev)
kmem_cache_free(scst_tgtd_cachep, tgt_dev);
percpu_ref_put(&dev->refcnt);
TRACE_EXIT();
return;
}