* unregister_input_polled_device() leads to null pointer deref
@ 2016-03-28 13:32 Okash Khawaja
2016-03-28 13:55 ` Carlo Caione
0 siblings, 1 reply; 3+ messages in thread
From: Okash Khawaja @ 2016-03-28 13:32 UTC (permalink / raw)
To: kernelnewbies
Hi,
I'm writing a i2c device driver. In probe(), among other things I call:
polled_input = input_allocate_polled_device();
input_register_polled_device(polled_input);
Then inside remove(), I extract the instance of input_polled_dev and
call
input_unregister_polled_device(polled_input);
This results in kernel error:
"Unable to handle kernel NULL pointer dereference at virtual address
00000474".
It turns out that the input_dev pointer inside input_polled_dev is null
which leads to this error. But why is input_dev pointer null? It is not
null inside probe() function and I don't release it anywhere.
This is code: http://pastebin.com/JJdepyEG and here is link to the output,
along with my log statements: http://pastebin.com/badwSvyy.
Thanks,
Okash
^ permalink raw reply [flat|nested] 3+ messages in thread
* unregister_input_polled_device() leads to null pointer deref
2016-03-28 13:32 unregister_input_polled_device() leads to null pointer deref Okash Khawaja
@ 2016-03-28 13:55 ` Carlo Caione
2016-03-28 14:13 ` Okash Khawaja
0 siblings, 1 reply; 3+ messages in thread
From: Carlo Caione @ 2016-03-28 13:55 UTC (permalink / raw)
To: kernelnewbies
On Mon, Mar 28, 2016 at 3:32 PM, Okash Khawaja <okash.khawaja@gmail.com> wrote:
> Hi,
>
> I'm writing a i2c device driver. In probe(), among other things I call:
>
> polled_input = input_allocate_polled_device();
> input_register_polled_device(polled_input);
>
> Then inside remove(), I extract the instance of input_polled_dev and
> call
>
> input_unregister_polled_device(polled_input);
>
> This results in kernel error:
>
> "Unable to handle kernel NULL pointer dereference at virtual address
> 00000474".
>
> It turns out that the input_dev pointer inside input_polled_dev is null
> which leads to this error. But why is input_dev pointer null? It is not
> null inside probe() function and I don't release it anywhere.
>
> This is code: http://pastebin.com/JJdepyEG and here is link to the output,
> along with my log statements: http://pastebin.com/badwSvyy.
>
input_free_polled_device(polled_input) is always called in your probe function.
--
Carlo Caione
^ permalink raw reply [flat|nested] 3+ messages in thread
* unregister_input_polled_device() leads to null pointer deref
2016-03-28 13:55 ` Carlo Caione
@ 2016-03-28 14:13 ` Okash Khawaja
0 siblings, 0 replies; 3+ messages in thread
From: Okash Khawaja @ 2016-03-28 14:13 UTC (permalink / raw)
To: kernelnewbies
> On 28 Mar 2016, at 14:55, Carlo Caione <carlo@caione.org> wrote:
>
>> On Mon, Mar 28, 2016 at 3:32 PM, Okash Khawaja <okash.khawaja@gmail.com> wrote:
>> Hi,
>>
>> I'm writing a i2c device driver. In probe(), among other things I call:
>>
>> polled_input = input_allocate_polled_device();
>> input_register_polled_device(polled_input);
>>
>> Then inside remove(), I extract the instance of input_polled_dev and
>> call
>>
>> input_unregister_polled_device(polled_input);
>>
>> This results in kernel error:
>>
>> "Unable to handle kernel NULL pointer dereference at virtual address
>> 00000474".
>>
>> It turns out that the input_dev pointer inside input_polled_dev is null
>> which leads to this error. But why is input_dev pointer null? It is not
>> null inside probe() function and I don't release it anywhere.
>>
>> This is code: http://pastebin.com/JJdepyEG and here is link to the output,
>> along with my log statements: http://pastebin.com/badwSvyy.
>
> input_free_polled_device(polled_input) is always called in your probe function.
Of course! Thanks very much
>
>
> --
> Carlo Caione
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-28 14:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-28 13:32 unregister_input_polled_device() leads to null pointer deref Okash Khawaja
2016-03-28 13:55 ` Carlo Caione
2016-03-28 14:13 ` Okash Khawaja
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.