From: Emil Goode <emilgoode@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 18:31:55 +0000 [thread overview]
Message-ID: <20140526183155.GA1312@lianli> (raw)
In-Reply-To: <20140526165105.GD3693@n2100.arm.linux.org.uk>
Hello Russell,
On Mon, May 26, 2014 at 05:51:05PM +0100, Russell King - ARM Linux wrote:
> On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> > @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
> > strcpy(pa->name, name);
> > pa->pdev.name = pa->name;
> > pa->pdev.id = id;
> > + pa->pdev.dev.dma_mask = &pa->dma_mask;
>
> There is code in the kernel which, rightly or wrongly, checks whether
> dev->dma_mask is NULL to determine whether the device can do any kind
> of DMA. The above results in devices allocated via this interface
> always having this member set, which is a change of core kernel behaviour.
>
> How sure are you that this will not break anything?
Thank you for pointing this out, considering the number of calls made to
platform_device_alloc it would be easy to miss an occurrance of this problem.
I would say that the risk heavily outweighs the gain and it's better to
not apply this series.
Best regards,
Emil Goode
WARNING: multiple messages have this Message-ID (diff)
From: emilgoode@gmail.com (Emil Goode)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 20:31:55 +0200 [thread overview]
Message-ID: <20140526183155.GA1312@lianli> (raw)
In-Reply-To: <20140526165105.GD3693@n2100.arm.linux.org.uk>
Hello Russell,
On Mon, May 26, 2014 at 05:51:05PM +0100, Russell King - ARM Linux wrote:
> On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> > @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
> > strcpy(pa->name, name);
> > pa->pdev.name = pa->name;
> > pa->pdev.id = id;
> > + pa->pdev.dev.dma_mask = &pa->dma_mask;
>
> There is code in the kernel which, rightly or wrongly, checks whether
> dev->dma_mask is NULL to determine whether the device can do any kind
> of DMA. The above results in devices allocated via this interface
> always having this member set, which is a change of core kernel behaviour.
>
> How sure are you that this will not break anything?
Thank you for pointing this out, considering the number of calls made to
platform_device_alloc it would be easy to miss an occurrance of this problem.
I would say that the risk heavily outweighs the gain and it's better to
not apply this series.
Best regards,
Emil Goode
WARNING: multiple messages have this Message-ID (diff)
From: Emil Goode <emilgoode@gmail.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Yann Droneaud" <ydroneaud@opteya.com>,
"Shawn Guo" <shawn.guo@freescale.com>,
"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
"Sascha Hauer" <kernel@pengutronix.de>,
"Olof Johansson" <olof@lixom.net>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask
Date: Mon, 26 May 2014 20:31:55 +0200 [thread overview]
Message-ID: <20140526183155.GA1312@lianli> (raw)
In-Reply-To: <20140526165105.GD3693@n2100.arm.linux.org.uk>
Hello Russell,
On Mon, May 26, 2014 at 05:51:05PM +0100, Russell King - ARM Linux wrote:
> On Mon, May 26, 2014 at 06:41:21PM +0200, Emil Goode wrote:
> > @@ -211,6 +215,7 @@ struct platform_device *platform_device_alloc(const char *name, int id)
> > strcpy(pa->name, name);
> > pa->pdev.name = pa->name;
> > pa->pdev.id = id;
> > + pa->pdev.dev.dma_mask = &pa->dma_mask;
>
> There is code in the kernel which, rightly or wrongly, checks whether
> dev->dma_mask is NULL to determine whether the device can do any kind
> of DMA. The above results in devices allocated via this interface
> always having this member set, which is a change of core kernel behaviour.
>
> How sure are you that this will not break anything?
Thank you for pointing this out, considering the number of calls made to
platform_device_alloc it would be easy to miss an occurrance of this problem.
I would say that the risk heavily outweighs the gain and it's better to
not apply this series.
Best regards,
Emil Goode
next prev parent reply other threads:[~2014-05-26 18:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 16:41 [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` [PATCH 2/3] driver core/platform: make .name of struct platform_object a C99 flexible array Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` [PATCH 3/3] ARM: imx: don't allocate memory for .dma_mask of struct device Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:41 ` Emil Goode
2014-05-26 16:51 ` [PATCH 1/3] driver core/platform: don't leak memory allocated for dma_mask Russell King - ARM Linux
2014-05-26 16:51 ` Russell King - ARM Linux
2014-05-26 16:51 ` Russell King - ARM Linux
2014-05-26 18:31 ` Emil Goode [this message]
2014-05-26 18:31 ` Emil Goode
2014-05-26 18:31 ` Emil Goode
2014-05-26 18:14 ` Uwe Kleine-König
2014-05-26 18:14 ` Uwe Kleine-König
2014-05-26 18:14 ` Uwe Kleine-König
2014-05-26 19:14 ` Yann Droneaud
2014-05-26 19:14 ` Yann Droneaud
2014-05-26 19:14 ` Yann Droneaud
2014-05-26 19:30 ` Dan Carpenter
2014-05-26 19:30 ` Dan Carpenter
2014-05-26 19:30 ` Dan Carpenter
2014-05-26 19:40 ` Emil Goode
2014-05-26 19:40 ` Emil Goode
2014-05-26 19:40 ` Emil Goode
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=20140526183155.GA1312@lianli \
--to=emilgoode@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.