All of lore.kernel.org
 help / color / mirror / Atom feed
* ghes_edac: Add a null pointer check in ghes_edac_unregister
@ 2018-05-02 11:55 Borislav Petkov
  0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2018-05-02 11:55 UTC (permalink / raw)
  To: Sughosh Ganu; +Cc: linux-edac

On Wed, May 02, 2018 at 04:51:41PM +0530, Sughosh Ganu wrote:
> Tested the said branch in my setup, and everything works as expected. Thanks.

Thanks Sughosh!

I'll add your Tested-by.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ghes_edac: Add a null pointer check in ghes_edac_unregister
@ 2018-05-02 11:21 Sughosh Ganu
  0 siblings, 0 replies; 5+ messages in thread
From: Sughosh Ganu @ 2018-05-02 11:21 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Sughosh Ganu, linux-edac

hi Borislav,

On Mon, Apr 30, 2018 at 4:29 PM, Borislav Petkov <bp@alien8.de> wrote:
> On Thu, Apr 26, 2018 at 03:46:49PM +0530, Sughosh Ganu wrote:
>> Add a null check for ghes_pvt, before dereferencing it. The pointer
>> could still be null in case the return path is taken before
>> initialising ghes_pvt in the registration function.
>>
>> ghes_edac_register function can return a 0 without initialising
>> ghes_pvt -- this is not taken as an error in ghes_probe. A subsequent
>> call to ghes_edac_unregister would result in ghes_pvt getting
>> dereferenced, resulting in a panic.
>>
>> Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
>> ---
>>
>>  drivers/edac/ghes_edac.c | 3 +++
>>  1 file changed, 3 insertions(+)
>
> Applied, thanks.
>
> So yeah, the registration of ghes_edac thing is kinda causing us
> headaches so I redid the reg path a bit. Mind running this branch on
> your setup to make sure it works as expected?
>
> https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=edac

Tested the said branch in my setup, and everything works as expected. Thanks.

-sughosh
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ghes_edac: Add a null pointer check in ghes_edac_unregister
@ 2018-04-30 12:30 Sughosh Ganu
  0 siblings, 0 replies; 5+ messages in thread
From: Sughosh Ganu @ 2018-04-30 12:30 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Sughosh Ganu, linux-edac

hi Borislav,

On Mon, Apr 30, 2018 at 4:29 PM, Borislav Petkov <bp@alien8.de> wrote:
> On Thu, Apr 26, 2018 at 03:46:49PM +0530, Sughosh Ganu wrote:
>> Add a null check for ghes_pvt, before dereferencing it. The pointer
>> could still be null in case the return path is taken before
>> initialising ghes_pvt in the registration function.
>>
>> ghes_edac_register function can return a 0 without initialising
>> ghes_pvt -- this is not taken as an error in ghes_probe. A subsequent
>> call to ghes_edac_unregister would result in ghes_pvt getting
>> dereferenced, resulting in a panic.
>>
>> Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
>> ---
>>
>>  drivers/edac/ghes_edac.c | 3 +++
>>  1 file changed, 3 insertions(+)
>
> Applied, thanks.
>
> So yeah, the registration of ghes_edac thing is kinda causing us
> headaches so I redid the reg path a bit. Mind running this branch on
> your setup to make sure it works as expected?
>
> https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=edac

Sure, will test this branch in a day or two, and will revert back. Thanks.

-sughosh
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ghes_edac: Add a null pointer check in ghes_edac_unregister
@ 2018-04-30 10:59 Borislav Petkov
  0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2018-04-30 10:59 UTC (permalink / raw)
  To: Sughosh Ganu; +Cc: linux-edac

On Thu, Apr 26, 2018 at 03:46:49PM +0530, Sughosh Ganu wrote:
> Add a null check for ghes_pvt, before dereferencing it. The pointer
> could still be null in case the return path is taken before
> initialising ghes_pvt in the registration function.
> 
> ghes_edac_register function can return a 0 without initialising
> ghes_pvt -- this is not taken as an error in ghes_probe. A subsequent
> call to ghes_edac_unregister would result in ghes_pvt getting
> dereferenced, resulting in a panic.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
> ---
>  
>  drivers/edac/ghes_edac.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

So yeah, the registration of ghes_edac thing is kinda causing us
headaches so I redid the reg path a bit. Mind running this branch on
your setup to make sure it works as expected?

https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=edac

Thx.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ghes_edac: Add a null pointer check in ghes_edac_unregister
@ 2018-04-26 10:16 Sughosh Ganu
  0 siblings, 0 replies; 5+ messages in thread
From: Sughosh Ganu @ 2018-04-26 10:16 UTC (permalink / raw)
  To: linux-edac; +Cc: Sughosh Ganu

Add a null check for ghes_pvt, before dereferencing it. The pointer
could still be null in case the return path is taken before
initialising ghes_pvt in the registration function.

ghes_edac_register function can return a 0 without initialising
ghes_pvt -- this is not taken as an error in ghes_probe. A subsequent
call to ghes_edac_unregister would result in ghes_pvt getting
dereferenced, resulting in a panic.

Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
---
 
 drivers/edac/ghes_edac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index 68b6ee1..509f036 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -519,6 +519,9 @@ void ghes_edac_unregister(struct ghes *ghes)
 {
 	struct mem_ctl_info *mci;
 
+	if (!ghes_pvt)
+		return;
+
 	mci = ghes_pvt->mci;
 	edac_mc_del_mc(mci->pdev);
 	edac_mc_free(mci);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-02 11:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 11:55 ghes_edac: Add a null pointer check in ghes_edac_unregister Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2018-05-02 11:21 Sughosh Ganu
2018-04-30 12:30 Sughosh Ganu
2018-04-30 10:59 Borislav Petkov
2018-04-26 10:16 Sughosh Ganu

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.