From: Johannes Berg <johannes@sipsolutions.net>
To: Julia Lawall <julia@diku.dk>
Cc: kernel-janitors@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
"David S. Miller" <davem@davemloft.net>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] net/rfkill/core.c: Avoid leaving freed data in a list
Date: Fri, 13 May 2011 15:55:12 +0200 [thread overview]
Message-ID: <1305294912.3468.0.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1305294731-12127-2-git-send-email-julia@diku.dk>
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@diku.dk>
>
> ---
> 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
prev parent reply other threads:[~2011-05-13 13:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-13 13:52 [PATCH 2/3] net/rfkill/core.c: Avoid leaving freed data in a list Julia Lawall
2011-05-13 13:55 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305294912.3468.0.camel@jlt3.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).