On 21 August 2014 03:47, Woodhouse, David wrote:
> On Thu, 2014-08-21 at 07:35 +0930, Rusty Russell wrote:
>>
>> Above this:
>> if (!mk->mp) {
>> num = 0;
>> attrs = NULL;
>> } else {
>> num = mk->mp->num;
>> attrs = m
On Wed, 2014-08-20 at 22:17 +, Woodhouse, David wrote:
>
> Except that in the failure case we *free* the old mk->mp and never free
> mk->mp->grp.attrs so it *is* indeed lost.
>
> A simpler version of Arjun's patch might look like this:
>
> diff --git a/kernel/params.c b/kernel/params.c
> ind
On Thu, 2014-08-21 at 07:35 +0930, Rusty Russell wrote:
>
> Above this:
> if (!mk->mp) {
> num = 0;
> attrs = NULL;
> } else {
> num = mk->mp->num;
> attrs = mk->mp->grp.attrs;
> }
>
> So, attrs is just a temp
Arjun Sreedharan writes:
> On 21 August 2014 02:19, Rusty Russell wrote:
>> Arjun Sreedharan writes:
>>> Do not leak memory when attrs is non NULL and
>>> krealloc() fails. Without temporary variable,
>>> reference to it is lost.
>>>
>>> Signed-off-by: Arjun Sreedharan
>>
>> ...
>>
>>> }
On Thu, 2014-08-21 at 06:19 +0930, Rusty Russell wrote:
> Arjun Sreedharan writes:
> > Do not leak memory when attrs is non NULL and
> > krealloc() fails. Without temporary variable,
> > reference to it is lost.
> >
> > Signed-off-by: Arjun Sreedharan
>
> ...
>
> > }
> > - /* Despite look
On 21 August 2014 02:19, Rusty Russell wrote:
> Arjun Sreedharan writes:
>> Do not leak memory when attrs is non NULL and
>> krealloc() fails. Without temporary variable,
>> reference to it is lost.
>>
>> Signed-off-by: Arjun Sreedharan
>
> ...
>
>> }
>> - /* Despite looking like the t
Arjun Sreedharan writes:
> Do not leak memory when attrs is non NULL and
> krealloc() fails. Without temporary variable,
> reference to it is lost.
>
> Signed-off-by: Arjun Sreedharan
...
> }
> - /* Despite looking like the typical realloc() bug, this is safe.
> - * We *want* the
Do not leak memory when attrs is non NULL and
krealloc() fails. Without temporary variable,
reference to it is lost.
Signed-off-by: Arjun Sreedharan
---
kernel/params.c | 16 +++-
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/kernel/params.c b/kernel/params.c
index 34
On allocation failure, it would fail to free the old attrs array which
was no longer referenced by anything (since it would free the old
module_param_attrs struct on the way out).
Comment the suspicious-looking krealloc() usage to explain why it *isn't*
actually buggy, despite looking like a class
9 matches
Mail list logo