Re: [PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Sasha Levin
On Thu, Nov 01, 2018 at 01:27:08AM +0100, Alexandre Belloni wrote: Hello, On 31/10/2018 19:12:06-0400, Sasha Levin wrote: - m->rtc = rtc_device_register(DRIVER_NAME, - >client->dev, - _rtc_ops, THIS_MODULE); - if (IS_ERR(m->rtc)) { +

Re: [PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Sasha Levin
On Thu, Nov 01, 2018 at 01:27:08AM +0100, Alexandre Belloni wrote: Hello, On 31/10/2018 19:12:06-0400, Sasha Levin wrote: - m->rtc = rtc_device_register(DRIVER_NAME, - >client->dev, - _rtc_ops, THIS_MODULE); - if (IS_ERR(m->rtc)) { +

Re: [PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Alexandre Belloni
Hello, On 31/10/2018 19:12:06-0400, Sasha Levin wrote: > - m->rtc = rtc_device_register(DRIVER_NAME, > - >client->dev, > - _rtc_ops, THIS_MODULE); > - if (IS_ERR(m->rtc)) { > + err = rtc_register_device(m->rtc); This appeared in v4.13, this

Re: [PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Alexandre Belloni
Hello, On 31/10/2018 19:12:06-0400, Sasha Levin wrote: > - m->rtc = rtc_device_register(DRIVER_NAME, > - >client->dev, > - _rtc_ops, THIS_MODULE); > - if (IS_ERR(m->rtc)) { > + err = rtc_register_device(m->rtc); This appeared in v4.13, this

[PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Sasha Levin
From: Alexandre Belloni [ Upstream commit 9612f8f503804d2fd2f63aa6ba1e58bba4612d96 ] The IRQ work is added before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to

[PATCH AUTOSEL 3.18 22/22] mfd: menelaus: Fix possible race condition and leak

2018-10-31 Thread Sasha Levin
From: Alexandre Belloni [ Upstream commit 9612f8f503804d2fd2f63aa6ba1e58bba4612d96 ] The IRQ work is added before the struct rtc is allocated and registered, but this struct is used in the IRQ handler. This may lead to a NULL pointer dereference. Switch to