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

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

 



On 06/22/2017 12:39 PM, Mike Christie wrote:
> On 06/22/2017 01:21 AM, tang.wenji@xxxxxxxxxx wrote:
>> 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);
>>  
> 
> Patch looks correct. I am removing the tcmu based refcounting in these

I take that back.

We would need to implement a uio close function and do a matching
kref_put in there right?

> patches though:
> 

My patchset removed the refcounting because it assumed userspace used it
like how tcmu-runner did.

Are you using a different app that will open the uio device multiple
times? Will it have multiple users opening it at the same time?

> https://www.spinics.net/lists/target-devel/msg15657.html
> 
> For refcounting on the uio side and to fix a leak in the uio code, I am
> working on doing uio refcounting similar to these patches began to do:
> 
> https://marc.info/?t=142686341100003&r=1&w=2
> --
> 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
> 

--
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