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 patches though: 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