* Re: [1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg()
[not found] <201907101533443009168@zte.com.cn>
@ 2019-07-10 9:24 ` Markus Elfring
2019-07-10 15:15 ` Coccinelle: Checking of_node_put() calls with SmPL Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-07-10 9:24 UTC (permalink / raw)
To: Wen Yang, linuxppc-dev
Cc: Benjamin Herrenschmidt, Cheng Shengyu, Kumar Gala,
Michael Ellerman, Paul Mackerras, Scott Wood, Xue Zhihong,
Yi Wang, linux-kernel, kernel-janitors
> we developed a coccinelle script to detect such problems.
How do you think about to give any attribution to this development software
in your commit descriptions?
> After a period of testing, we will send it to the LMKL mailing list later.
I am also curious then on how this area will evolve further.
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Coccinelle: Checking of_node_put() calls with SmPL
[not found] <201907101533443009168@zte.com.cn>
2019-07-10 9:24 ` [1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg() Markus Elfring
@ 2019-07-10 15:15 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-07-10 15:15 UTC (permalink / raw)
To: Wen Yang, Rafael J. Wysocki, Daniel Lezcano, linux-pm, kernel-janitors
Cc: Benjamin Herrenschmidt, Cheng Shengyu, Kumar Gala,
Michael Ellerman, Paul Mackerras, Scott Wood, Xue Zhihong,
Yi Wang, linux-kernel, linuxppc-dev
> we developed a coccinelle script to detect such problems.
Would you find the implementation of the function “dt_init_idle_driver”
suspicious according to discussed source code search patterns?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/cpuidle/dt_idle_states.c?id=e9a83bd2322035ed9d7dcf35753d3f984d76c6a5#n208
https://elixir.bootlin.com/linux/v5.2/source/drivers/cpuidle/dt_idle_states.c#L208
> This script is still being improved.
Will corresponding software development challenges become more interesting?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg()
@ 2019-07-09 11:12 Wen Yang
2019-07-10 7:19 ` [1/2] " Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Wen Yang @ 2019-07-09 11:12 UTC (permalink / raw)
To: linux-kernel
Cc: xue.zhihong, wang.yi59, cheng.shengyu, Wen Yang, Scott Wood,
Kumar Gala, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman, Markus Elfring, linuxppc-dev
The immr_node variable is still being used after the of_node_put() call,
which may result in use-after-free.
Fix this issue by calling of_node_put() after the last usage.
Fixes: fd066e850351 ("powerpc/mpc8308: fix USB DR controller initialization")
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Scott Wood <oss@buserror.net>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Markus Elfring <Markus.Elfring@web.de>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
arch/powerpc/platforms/83xx/usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 3d247d7..19dcef5 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -158,11 +158,10 @@ int mpc831x_usb_cfg(void)
iounmap(immap);
- of_node_put(immr_node);
-
/* Map USB SOC space */
ret = of_address_to_resource(np, 0, &res);
if (ret) {
+ of_node_put(immr_node);
of_node_put(np);
return ret;
}
@@ -203,6 +202,7 @@ int mpc831x_usb_cfg(void)
out:
iounmap(usb_regs);
+ of_node_put(immr_node);
of_node_put(np);
return ret;
}
--
2.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg()
2019-07-09 11:12 [PATCH 1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg() Wen Yang
@ 2019-07-10 7:19 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-07-10 7:19 UTC (permalink / raw)
To: Wen Yang, linuxppc-dev
Cc: Markus.Elfring, Benjamin Herrenschmidt, Cheng Shengyu,
Kumar Gala, Michael Ellerman, Paul Mackerras, Scott Wood,
kernel-janitors, Xue Zhihong, Yi Wang, linux-kernel
> The immr_node variable is still being used after the of_node_put() call,
> which may result in use-after-free.
Was any known source code analysis tool involved to point such
a questionable implementation detail out for further software
development considerations?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-10 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <201907101533443009168@zte.com.cn>
2019-07-10 9:24 ` [1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg() Markus Elfring
2019-07-10 15:15 ` Coccinelle: Checking of_node_put() calls with SmPL Markus Elfring
2019-07-09 11:12 [PATCH 1/2] powerpc/83xx: fix use-after-free in mpc831x_usb_cfg() Wen Yang
2019-07-10 7:19 ` [1/2] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®