[PATCH] tcmu:add reference count of dev in tcmu_open function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Wenji Tang <tang.wenji@xxxxxxxxxx>

In the tcmu_open function does not increase the reference count of dev, but in the tcmu_release function to decrease its reference count. When the user oepn/close device many times, the corresponding dev device is illegally released

Signed-off-by: Wenji Tang <tang.wenji@xxxxxxxxxx>
---
 drivers/target/target_core_user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index beb5f09..376a290 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1142,6 +1142,8 @@ static int tcmu_open(struct uio_info *info, struct inode *inode)
 	udev->inode = inode;
 
 	pr_debug("open\n");
+	
+	kref_get(&udev->kref);
 
 	return 0;
 }
-- 
2.8.1.windows.1


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux