Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1410947 > unrolled thread
| Started by | zhengjun.xing@intel.com |
|---|---|
| First post | 2016-06-01 10:40 +0200 |
| Last post | 2016-06-02 17:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] tracing: Add *iter check for NULL zhengjun.xing@intel.com - 2016-06-01 10:40 +0200
Re: [PATCH] tracing: Add *iter check for NULL Namhyung Kim <namhyung@gmail.com> - 2016-06-02 17:50 +0200
| From | zhengjun.xing@intel.com |
|---|---|
| Date | 2016-06-01 10:40 +0200 |
| Subject | [PATCH] tracing: Add *iter check for NULL |
| Message-ID | <rF9R0-641-31@gated-at.bofh.it> |
From: xingzhen <zhengjun.xing@intel.com>
3debb0a9ddb adding a "__used" to the variable in the
__trace_printk_fmt section. Sometimes it will cause
*iter to be NULL, then strcmp in lookup_format and
strcpy in hold_module_trace_bprintk_format will panic.
Signed-off-by: xingzhen <zhengjun.xing@intel.com>
---
kernel/trace/trace_printk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index f96f038..82ecfb5 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -55,6 +55,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
mutex_lock(&btrace_mutex);
for (iter = start; iter < end; iter++) {
+ if (!*iter)
+ goto err;
struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter);
if (tb_fmt) {
*iter = tb_fmt->fmt;
@@ -75,6 +77,7 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
*iter = fmt;
}
+err:
mutex_unlock(&btrace_mutex);
}
--
1.9.1
[toc] | [next] | [standalone]
| From | Namhyung Kim <namhyung@gmail.com> |
|---|---|
| Date | 2016-06-02 17:50 +0200 |
| Message-ID | <rFD2G-7GN-27@gated-at.bofh.it> |
| In reply to | #1410947 |
Hello,
On Wed, Jun 1, 2016 at 5:31 PM, <zhengjun.xing@intel.com> wrote:
> From: xingzhen <zhengjun.xing@intel.com>
>
> 3debb0a9ddb adding a "__used" to the variable in the
> __trace_printk_fmt section. Sometimes it will cause
> *iter to be NULL, then strcmp in lookup_format and
> strcpy in hold_module_trace_bprintk_format will panic.
>
> Signed-off-by: xingzhen <zhengjun.xing@intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> kernel/trace/trace_printk.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
> index f96f038..82ecfb5 100644
> --- a/kernel/trace/trace_printk.c
> +++ b/kernel/trace/trace_printk.c
> @@ -55,6 +55,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
>
> mutex_lock(&btrace_mutex);
> for (iter = start; iter < end; iter++) {
> + if (!*iter)
> + goto err;
> struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter);
> if (tb_fmt) {
> *iter = tb_fmt->fmt;
> @@ -75,6 +77,7 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
> *iter = fmt;
>
> }
> +err:
> mutex_unlock(&btrace_mutex);
> }
>
> --
> 1.9.1
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web