* [PATCH v3] sh_eth: check platform data pointer
@ 2013-10-30 20:30 Sergei Shtylyov
2013-10-31 6:05 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2013-10-30 20:30 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh
Check the platform data pointer before dereferencing it and error out of the
probe() method if it's NULL.
This has additional effect of preventing kernel oops with outdated platform data
containing zero PHY address instead (such as on SolutionEngine7710).
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
This patch is against David Miller's 'net-next.git' repo.
Changes in version 3:
- refreshed the patch.
Changes in version 2:
- refreshed the patch.
drivers/net/ethernet/renesas/sh_eth.c | 6 ++++++
1 file changed, 6 insertions(+)
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -2663,6 +2663,12 @@ static int sh_eth_drv_probe(struct platf
pm_runtime_enable(&pdev->dev);
pm_runtime_resume(&pdev->dev);
+ if (!pd) {
+ dev_err(&pdev->dev, "no platform data\n");
+ ret = -EINVAL;
+ goto out_release;
+ }
+
/* get PHY ID */
mdp->phy_id = pd->phy;
mdp->phy_interface = pd->phy_interface;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] sh_eth: check platform data pointer
2013-10-30 20:30 [PATCH v3] sh_eth: check platform data pointer Sergei Shtylyov
@ 2013-10-31 6:05 ` Simon Horman
2013-11-04 20:49 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2013-10-31 6:05 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: netdev, nobuhiro.iwamatsu.yj, linux-sh, 'David Miller'
[ Cc Dave Miller ]
On Wed, Oct 30, 2013 at 11:30:19PM +0300, Sergei Shtylyov wrote:
> Check the platform data pointer before dereferencing it and error out of the
> probe() method if it's NULL.
>
> This has additional effect of preventing kernel oops with outdated platform data
> containing zero PHY address instead (such as on SolutionEngine7710).
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Dave, is it too late to for this to be considered for net-next?
>
> ---
> This patch is against David Miller's 'net-next.git' repo.
>
> Changes in version 3:
> - refreshed the patch.
>
> Changes in version 2:
> - refreshed the patch.
>
> drivers/net/ethernet/renesas/sh_eth.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
> ===================================================================
> --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
> +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
> @@ -2663,6 +2663,12 @@ static int sh_eth_drv_probe(struct platf
> pm_runtime_enable(&pdev->dev);
> pm_runtime_resume(&pdev->dev);
>
> + if (!pd) {
> + dev_err(&pdev->dev, "no platform data\n");
> + ret = -EINVAL;
> + goto out_release;
> + }
> +
> /* get PHY ID */
> mdp->phy_id = pd->phy;
> mdp->phy_interface = pd->phy_interface;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] sh_eth: check platform data pointer
2013-10-31 6:05 ` Simon Horman
@ 2013-11-04 20:49 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-11-04 20:49 UTC (permalink / raw)
To: horms; +Cc: sergei.shtylyov, netdev, nobuhiro.iwamatsu.yj, linux-sh
From: Simon Horman <horms@verge.net.au>
Date: Thu, 31 Oct 2013 15:05:27 +0900
> [ Cc Dave Miller ]
>
> On Wed, Oct 30, 2013 at 11:30:19PM +0300, Sergei Shtylyov wrote:
>> Check the platform data pointer before dereferencing it and error out of the
>> probe() method if it's NULL.
>>
>> This has additional effect of preventing kernel oops with outdated platform data
>> containing zero PHY address instead (such as on SolutionEngine7710).
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> Acked-by: Simon Horman <horms+renesas@verge.net.au>
>
> Dave, is it too late to for this to be considered for net-next?
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-04 20:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-30 20:30 [PATCH v3] sh_eth: check platform data pointer Sergei Shtylyov
2013-10-31 6:05 ` Simon Horman
2013-11-04 20:49 ` David Miller
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).