Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1323683 > unrolled thread
| Started by | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| First post | 2016-02-02 02:00 +0100 |
| Last post | 2016-02-03 03:20 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Stephen Boyd <sboyd@codeaurora.org> - 2016-02-02 02:00 +0100
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-02-02 03:30 +0100
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Stephen Boyd <sboyd@codeaurora.org> - 2016-02-02 03:40 +0100
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-02-02 03:50 +0100
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Stephen Boyd <sboyd@codeaurora.org> - 2016-02-02 21:50 +0100
Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Masahiro Yamada <yamada.masahiro@socionext.com> - 2016-02-03 03:20 +0100
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-02-02 02:00 +0100 |
| Subject | Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() |
| Message-ID | <qXxu2-2HC-9@gated-at.bofh.it> |
On 12/28, Masahiro Yamada wrote:
> The .git_parent is mandatory for multi-parent clocks. Move the check
s/git/get/
Same for the subject.
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index e6e10f5..4ad0a36 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1677,13 +1677,6 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
> goto out;
> }
>
> - if (!core->ops->get_parent) {
> - WARN(!core->ops->get_parent,
> - "%s: multi-parent clocks must implement .get_parent\n",
> - __func__);
> - goto out;
> - }
> -
> /*
> * Do our best to cache parent clocks in core->parents. This prevents
> * unnecessary and expensive lookups. We don't set core->parent here;
> @@ -2315,6 +2308,11 @@ static int __clk_core_init(struct clk_core *core)
> goto out;
> }
>
> + if (core->num_parents > 1 && !core->ops->get_parent) {
> + pr_err("%s: %s must implement .get_parent as it has multi parents\n",
> + __func__, core->name);
> + }
> +
This would seem to allow a case where we may deref a null
get_parent op if it isn't set and we call __clk_init_parent().
The next patch removes that case by restructuring
__clk_init_parent(), so we should just combine these two patches
together and that theoretical problem goes away.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-02-02 03:30 +0100 |
| Subject | Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() |
| Message-ID | <qXyT7-3SA-3@gated-at.bofh.it> |
| In reply to | #1323683 |
Hi Stephen,
2016-02-02 9:50 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
> On 12/28, Masahiro Yamada wrote:
>> The .git_parent is mandatory for multi-parent clocks. Move the check
>
> s/git/get/
>
> Same for the subject.
>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index e6e10f5..4ad0a36 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -1677,13 +1677,6 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
>> goto out;
>> }
>>
>> - if (!core->ops->get_parent) {
>> - WARN(!core->ops->get_parent,
>> - "%s: multi-parent clocks must implement .get_parent\n",
>> - __func__);
>> - goto out;
>> - }
>> -
>> /*
>> * Do our best to cache parent clocks in core->parents. This prevents
>> * unnecessary and expensive lookups. We don't set core->parent here;
>> @@ -2315,6 +2308,11 @@ static int __clk_core_init(struct clk_core *core)
>> goto out;
>> }
>>
>> + if (core->num_parents > 1 && !core->ops->get_parent) {
>> + pr_err("%s: %s must implement .get_parent as it has multi parents\n",
>> + __func__, core->name);
>> + }
>> +
>
> This would seem to allow a case where we may deref a null
> get_parent op if it isn't set and we call __clk_init_parent().
> The next patch removes that case by restructuring
> __clk_init_parent(), so we should just combine these two patches
> together and that theoretical problem goes away.
>
I think the case never happens.
__clk_init_parent() is a static function that is only called from
__clk_core_init().
So, the null pointer for .get_parent() has been already checked before
__clk_init_parent().
--
Best Regards
Masahiro Yamada
[toc] | [prev] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-02-02 03:40 +0100 |
| Message-ID | <qXz2P-3Wf-45@gated-at.bofh.it> |
| In reply to | #1323705 |
On 02/02, Masahiro Yamada wrote:
> 2016-02-02 9:50 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
> > On 12/28, Masahiro Yamada wrote:
> >> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> >> index e6e10f5..4ad0a36 100644
> >> --- a/drivers/clk/clk.c
> >> +++ b/drivers/clk/clk.c
> >> @@ -1677,13 +1677,6 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
> >> goto out;
> >> }
> >>
> >> - if (!core->ops->get_parent) {
> >> - WARN(!core->ops->get_parent,
> >> - "%s: multi-parent clocks must implement .get_parent\n",
> >> - __func__);
> >> - goto out;
> >> - }
> >> -
> >> /*
> >> * Do our best to cache parent clocks in core->parents. This prevents
> >> * unnecessary and expensive lookups. We don't set core->parent here;
> >> @@ -2315,6 +2308,11 @@ static int __clk_core_init(struct clk_core *core)
> >> goto out;
> >> }
> >>
> >> + if (core->num_parents > 1 && !core->ops->get_parent) {
> >> + pr_err("%s: %s must implement .get_parent as it has multi parents\n",
> >> + __func__, core->name);
> >> + }
> >> +
> >
> > This would seem to allow a case where we may deref a null
> > get_parent op if it isn't set and we call __clk_init_parent().
> > The next patch removes that case by restructuring
> > __clk_init_parent(), so we should just combine these two patches
> > together and that theoretical problem goes away.
> >
>
> I think the case never happens.
>
> __clk_init_parent() is a static function that is only called from
> __clk_core_init().
> So, the null pointer for .get_parent() has been already checked before
> __clk_init_parent().
>
Right, this patch moves the check to __clk_core_init(), and it
will print an error and then keep going (because we lost the goto
out part). Once we keep going in __clk_core_init() we'll call
__clk_init_parent() and NULL pointer deref.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-02-02 03:50 +0100 |
| Subject | Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() |
| Message-ID | <qXzct-3ZH-1@gated-at.bofh.it> |
| In reply to | #1323729 |
2016-02-02 11:39 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
> On 02/02, Masahiro Yamada wrote:
>> 2016-02-02 9:50 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>:
>> > On 12/28, Masahiro Yamada wrote:
>> >> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> >> index e6e10f5..4ad0a36 100644
>> >> --- a/drivers/clk/clk.c
>> >> +++ b/drivers/clk/clk.c
>> >> @@ -1677,13 +1677,6 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
>> >> goto out;
>> >> }
>> >>
>> >> - if (!core->ops->get_parent) {
>> >> - WARN(!core->ops->get_parent,
>> >> - "%s: multi-parent clocks must implement .get_parent\n",
>> >> - __func__);
>> >> - goto out;
>> >> - }
>> >> -
>> >> /*
>> >> * Do our best to cache parent clocks in core->parents. This prevents
>> >> * unnecessary and expensive lookups. We don't set core->parent here;
>> >> @@ -2315,6 +2308,11 @@ static int __clk_core_init(struct clk_core *core)
>> >> goto out;
>> >> }
>> >>
>> >> + if (core->num_parents > 1 && !core->ops->get_parent) {
>> >> + pr_err("%s: %s must implement .get_parent as it has multi parents\n",
>> >> + __func__, core->name);
>> >> + }
>> >> +
>> >
>> > This would seem to allow a case where we may deref a null
>> > get_parent op if it isn't set and we call __clk_init_parent().
>> > The next patch removes that case by restructuring
>> > __clk_init_parent(), so we should just combine these two patches
>> > together and that theoretical problem goes away.
>> >
>>
>> I think the case never happens.
>>
>> __clk_init_parent() is a static function that is only called from
>> __clk_core_init().
>> So, the null pointer for .get_parent() has been already checked before
>> __clk_init_parent().
>>
>
> Right, this patch moves the check to __clk_core_init(), and it
> will print an error and then keep going (because we lost the goto
> out part). Once we keep going in __clk_core_init() we'll call
> __clk_init_parent() and NULL pointer deref.
>
Ah, I missed that.
We need
ret = -EINVAL;
goto out;
here, I think.
Shall I send the v3 for 08/16?
Or, if it is too late, shall I send a fix-up patch?
--
Best Regards
Masahiro Yamada
[toc] | [prev] | [next] | [standalone]
| From | Stephen Boyd <sboyd@codeaurora.org> |
|---|---|
| Date | 2016-02-02 21:50 +0100 |
| Message-ID | <qXQ3E-93-13@gated-at.bofh.it> |
| In reply to | #1323743 |
On 02/02, Masahiro Yamada wrote: > 2016-02-02 11:39 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>: > > > > Right, this patch moves the check to __clk_core_init(), and it > > will print an error and then keep going (because we lost the goto > > out part). Once we keep going in __clk_core_init() we'll call > > __clk_init_parent() and NULL pointer deref. > > > > Ah, I missed that. > > We need > > ret = -EINVAL; > goto out; > > here, I think. > > Shall I send the v3 for 08/16? > > Or, if it is too late, shall I send a fix-up patch? > I'll split the patch out again and squash in those two lines. Nothing more to do. Thanks. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
[toc] | [prev] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2016-02-03 03:20 +0100 |
| Subject | Re: [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() |
| Message-ID | <qXVd0-45u-3@gated-at.bofh.it> |
| In reply to | #1324617 |
Hi Stephen, 2016-02-03 5:43 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>: > On 02/02, Masahiro Yamada wrote: >> 2016-02-02 11:39 GMT+09:00 Stephen Boyd <sboyd@codeaurora.org>: >> > >> > Right, this patch moves the check to __clk_core_init(), and it >> > will print an error and then keep going (because we lost the goto >> > out part). Once we keep going in __clk_core_init() we'll call >> > __clk_init_parent() and NULL pointer deref. >> > >> >> Ah, I missed that. >> >> We need >> >> ret = -EINVAL; >> goto out; >> >> here, I think. >> >> Shall I send the v3 for 08/16? >> >> Or, if it is too late, shall I send a fix-up patch? >> > > I'll split the patch out again and squash in those two lines. > Nothing more to do. Thanks. Thank you very much for taking care of all of them! -- Best Regards Masahiro Yamada
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web