Search Linux Wireless

Re: [PATCH 2/3] net/rfkill/core.c: Avoid leaving freed data in a list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2011-05-13 at 15:52 +0200, Julia Lawall wrote:
> The list_for_each_entry loop can fail, in which case the list element is
> not removed from the list rfkill_fds.  Since this list is not accessed by
> the loop, the addition of &data->list into the list is just moved after the
> loop.
> 
> The sematic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression E,E1,E2;
> identifier l;
> @@
> 
> *list_add(&E->l,E1);
> ... when != E1
>     when != list_del(&E->l)
>     when != list_del_init(&E->l)
>     when != E = E2
> *kfree(E);// </smpl>
> 
> Signed-off-by: Julia Lawall <julia@xxxxxxx>
> 
> ---
> I have only verified that rfkill_fds is not accessed by the loop by
> inspecting the code.  If this analysis is not correct, the other solution
> would be to leave the list_add where it is and delete the element from the
> list explicitly.

Looks right to me, thanks!

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux