linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: keyboard - imx_sc: Correct SCU message structure to avoid stack corruption
@ 2019-11-14 11:21 Anson Huang
  2019-11-15 19:34 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Anson Huang @ 2019-11-14 11:21 UTC (permalink / raw)
  To: dmitry.torokhov, shawnguo, s.hauer, kernel, festevam, robh,
	linux-input, linux-arm-kernel, linux-kernel
  Cc: Linux-imx

The SCU message's data field used for receiving response data
from SCU should be 32-bit width, as SCU will send back 32-bit
width data, correct it to avoid kernel panic of stack protection
when CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG is enabled.

[    1.950768] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
[    1.980607] Workqueue: events imx_sc_check_for_events
[    1.985657] Call trace:
[    1.988104]  dump_backtrace+0x0/0x140
[    1.991768]  show_stack+0x14/0x20
[    1.995090]  dump_stack+0xb4/0xf8
[    1.998407]  panic+0x158/0x324
[    2.001463]  print_tainted+0x0/0xa8
[    2.004950]  imx_sc_check_for_events+0x18c/0x190
[    2.009569]  process_one_work+0x198/0x320
[    2.013579]  worker_thread+0x48/0x420
[    2.017252]  kthread+0xf0/0x120
[    2.020394]  ret_from_fork+0x10/0x18
[    2.023977] SMP: stopping secondary CPUs
[    2.027901] Kernel Offset: disabled
[    2.031391] CPU features: 0x0002,2100600c
[    2.035401] Memory Limit: none

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/input/keyboard/imx_sc_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
index dd57daa..5379952 100644
--- a/drivers/input/keyboard/imx_sc_key.c
+++ b/drivers/input/keyboard/imx_sc_key.c
@@ -35,7 +35,7 @@ struct imx_key_drv_data {
 
 struct imx_sc_msg_key {
 	struct imx_sc_rpc_msg hdr;
-	u8 state;
+	u32 state;
 };
 
 static int imx_sc_key_notify(struct notifier_block *nb,
-- 
2.7.4


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

* Re: [PATCH] Input: keyboard - imx_sc: Correct SCU message structure to avoid stack corruption
  2019-11-14 11:21 [PATCH] Input: keyboard - imx_sc: Correct SCU message structure to avoid stack corruption Anson Huang
@ 2019-11-15 19:34 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2019-11-15 19:34 UTC (permalink / raw)
  To: Anson Huang
  Cc: shawnguo, s.hauer, kernel, festevam, robh, linux-input,
	linux-arm-kernel, linux-kernel, Linux-imx

On Thu, Nov 14, 2019 at 07:21:39PM +0800, Anson Huang wrote:
> The SCU message's data field used for receiving response data
> from SCU should be 32-bit width, as SCU will send back 32-bit
> width data, correct it to avoid kernel panic of stack protection
> when CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG is enabled.
> 
> [    1.950768] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
> [    1.980607] Workqueue: events imx_sc_check_for_events
> [    1.985657] Call trace:
> [    1.988104]  dump_backtrace+0x0/0x140
> [    1.991768]  show_stack+0x14/0x20
> [    1.995090]  dump_stack+0xb4/0xf8
> [    1.998407]  panic+0x158/0x324
> [    2.001463]  print_tainted+0x0/0xa8
> [    2.004950]  imx_sc_check_for_events+0x18c/0x190
> [    2.009569]  process_one_work+0x198/0x320
> [    2.013579]  worker_thread+0x48/0x420
> [    2.017252]  kthread+0xf0/0x120
> [    2.020394]  ret_from_fork+0x10/0x18
> [    2.023977] SMP: stopping secondary CPUs
> [    2.027901] Kernel Offset: disabled
> [    2.031391] CPU features: 0x0002,2100600c
> [    2.035401] Memory Limit: none
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied, thank you.

> ---
>  drivers/input/keyboard/imx_sc_key.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index dd57daa..5379952 100644
> --- a/drivers/input/keyboard/imx_sc_key.c
> +++ b/drivers/input/keyboard/imx_sc_key.c
> @@ -35,7 +35,7 @@ struct imx_key_drv_data {
>  
>  struct imx_sc_msg_key {
>  	struct imx_sc_rpc_msg hdr;
> -	u8 state;
> +	u32 state;
>  };
>  
>  static int imx_sc_key_notify(struct notifier_block *nb,
> -- 
> 2.7.4
> 

-- 
Dmitry

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

end of thread, other threads:[~2019-11-15 19:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 11:21 [PATCH] Input: keyboard - imx_sc: Correct SCU message structure to avoid stack corruption Anson Huang
2019-11-15 19:34 ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).