Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-05-01 Thread Mukesh Ojha
Sorry to come late on this On 4/25/2019 4:26 AM, Al Viro wrote: On Wed, Apr 24, 2019 at 07:39:03PM +0530, Mukesh Ojha wrote: This was my simple program no multithreading just to understand f_counting int main() {     int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);    

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-24 Thread Al Viro
On Wed, Apr 24, 2019 at 07:39:03PM +0530, Mukesh Ojha wrote: > This was my simple program no multithreading just to understand f_counting > > int main() > { >     int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK); >     ioctl(fd, UI_SET_EVBIT, EV_KEY); >     close(fd); >    

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-24 Thread Mukesh Ojha
On 4/24/2019 6:37 PM, Al Viro wrote: On Wed, Apr 24, 2019 at 05:40:40PM +0530, Mukesh Ojha wrote: Al, i tried to put traceprintk inside ioctl after fdget and fdput on a simple call of open  => ioctl => close in a loop, and multithreaded, presumably? on /dev/uinput.   uinput-532  

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-24 Thread Al Viro
On Wed, Apr 24, 2019 at 05:40:40PM +0530, Mukesh Ojha wrote: > > Al, > > i tried to put traceprintk inside ioctl after fdget and fdput on a simple > call of open  => ioctl => close in a loop, and multithreaded, presumably? > on /dev/uinput. > >   uinput-532   [002]     45.312044:

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-24 Thread Mukesh Ojha
On 4/23/2019 4:36 PM, Al Viro wrote: On Tue, Apr 23, 2019 at 08:49:44AM +, dmitry.torok...@gmail.com wrote: On Tue, Apr 23, 2019 at 12:51:13PM +0530, Mukesh Ojha wrote: I have taken care this case from ioctl and release point of view. Even if the release gets called first it will make

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-23 Thread Al Viro
On Tue, Apr 23, 2019 at 12:06:12PM +0100, Al Viro wrote: > On Tue, Apr 23, 2019 at 08:49:44AM +, dmitry.torok...@gmail.com wrote: > > On Tue, Apr 23, 2019 at 12:51:13PM +0530, Mukesh Ojha wrote: > > > > I have taken care this case from ioctl and release point of view. > > > > > > Even if the

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-23 Thread Al Viro
On Tue, Apr 23, 2019 at 08:49:44AM +, dmitry.torok...@gmail.com wrote: > On Tue, Apr 23, 2019 at 12:51:13PM +0530, Mukesh Ojha wrote: > > I have taken care this case from ioctl and release point of view. > > > > Even if the release gets called first it will make the > >

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-23 Thread dmitry.torok...@gmail.com
On Tue, Apr 23, 2019 at 12:51:13PM +0530, Mukesh Ojha wrote: > On 4/23/2019 8:58 AM, dmitry.torok...@gmail.com wrote: > > On Fri, Apr 19, 2019 at 02:13:48PM +0530, Mukesh Ojha wrote: > > > On 4/19/2019 12:41 PM, dmitry.torok...@gmail.com wrote: > > > > On Fri, Apr 19, 2019 at 12:17:44PM +0530,

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-22 Thread dmitry.torok...@gmail.com
On Fri, Apr 19, 2019 at 02:13:48PM +0530, Mukesh Ojha wrote: > > On 4/19/2019 12:41 PM, dmitry.torok...@gmail.com wrote: > > Hi Mukesh, > > > > On Fri, Apr 19, 2019 at 12:17:44PM +0530, Mukesh Ojha wrote: > > > For some reason my last mail did not get delivered,  sending it again. > > > > > >

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-19 Thread Mukesh Ojha
On 4/19/2019 12:41 PM, dmitry.torok...@gmail.com wrote: Hi Mukesh, On Fri, Apr 19, 2019 at 12:17:44PM +0530, Mukesh Ojha wrote: For some reason my last mail did not get delivered,  sending it again. On 4/18/2019 11:55 AM, Mukesh Ojha wrote: On 4/18/2019 7:13 AM, dmitry.torok...@gmail.com

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-19 Thread dmitry.torok...@gmail.com
Hi Mukesh, On Fri, Apr 19, 2019 at 12:17:44PM +0530, Mukesh Ojha wrote: > For some reason my last mail did not get delivered,  sending it again. > > > On 4/18/2019 11:55 AM, Mukesh Ojha wrote: > > > > > > On 4/18/2019 7:13 AM, dmitry.torok...@gmail.com wrote: > > > Hi Mukesh, > > > > > > On

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-17 Thread dmitry.torok...@gmail.com
Hi Mukesh, On Mon, Apr 15, 2019 at 03:35:51PM +0530, Mukesh Ojha wrote: > > Hi Dmitry, > > Can you please have a look at this patch ? as this seems to reproducing > quite frequently > > Thanks, > Mukesh > > On 4/10/2019 1:29 PM, Mukesh Ojha wrote: > > uinput_destroy_device() gets called from

Re: [PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-15 Thread Mukesh Ojha
Hi Dmitry, Can you please have a look at this patch ? as this seems to reproducing quite frequently Thanks, Mukesh On 4/10/2019 1:29 PM, Mukesh Ojha wrote: uinput_destroy_device() gets called from two places. In one place, uinput_ioctl_handler() where it is protected under a lock

[PATCH v2] Input: uinput: Avoid Object-Already-Free with a global lock

2019-04-10 Thread Mukesh Ojha
uinput_destroy_device() gets called from two places. In one place, uinput_ioctl_handler() where it is protected under a lock udev->mutex but there is no protection on udev device from freeing inside uinput_release(). This can result in Object-Already-Free case where uinput parent device already