From: Jingoo Han <jg1.han@samsung.com>
To: 'Wei Yongjun' <weiyj.lk@gmail.com>,
'Jonas Jensen' <jonas.jensen@gmail.com>
Cc: davem@davemloft.net, grant.likely@linaro.org,
rob.herring@calxeda.com, yongjun_wei@trendmicro.com.cn,
netdev@vger.kernel.org, 'Jingoo Han' <jg1.han@samsung.com>,
'Sachin Kamat' <sachin.kamat@linaro.org>
Subject: Re: [PATCH] moxa: drop free_irq of devm_request_irq allocated irq
Date: Thu, 26 Sep 2013 09:47:26 +0900 [thread overview]
Message-ID: <000001ceba51$f8b45c10$ea1d1430$%han@samsung.com> (raw)
In-Reply-To: <CAPgLHd8YRP7kL_jNHi3J9jFn86f=Fv-AWWUY_aRGZQOgVTNPgg@mail.gmail.com>
On Wednesday, September 25, 2013 4:33 PM, Wei Yongjun wrote:
>
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> irq allocated with devm_request_irq should not be freed using
> free_irq, because doing so causes a dangling pointer, and a
> subsequent double free.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> drivers/net/ethernet/moxa/moxart_ether.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c
> index 83c2091..9a7fcb5 100644
> --- a/drivers/net/ethernet/moxa/moxart_ether.c
> +++ b/drivers/net/ethernet/moxa/moxart_ether.c
> @@ -531,7 +531,6 @@ static int moxart_remove(struct platform_device *pdev)
> struct net_device *ndev = platform_get_drvdata(pdev);
>
> unregister_netdev(ndev);
> - free_irq(ndev->irq, ndev);
> moxart_mac_free_memory(ndev);
> free_netdev(ndev);
CC'ed Sachin Kamat,
In this case, the free_irq() will be called, after calling
free_netdev(). 'ndev' is freed by free_netdev(). Then, 'ndev->irq'
is used by free_irq(). Is it right?
In my humble opinion, it seems to make the problem.
Best regards,
Jingoo Han
next prev parent reply other threads:[~2013-09-26 0:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 7:33 [PATCH] moxa: drop free_irq of devm_request_irq allocated irq Wei Yongjun
2013-09-26 0:47 ` Jingoo Han [this message]
2013-09-26 2:12 ` Wei Yongjun
2013-09-26 2:36 ` Jingoo Han
2013-09-26 14:02 ` Ben Hutchings
2013-09-30 18:55 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2013-09-26 3:23 Wei Yongjun
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='000001ceba51$f8b45c10$ea1d1430$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=davem@davemloft.net \
--cc=grant.likely@linaro.org \
--cc=jonas.jensen@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=sachin.kamat@linaro.org \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/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).