netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Yanok <yanok@emcraft.com>
To: sfr@canb.auug.org.au, greg@kroah.com, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org, mkl@pengutronix.de,
	davem@davemloft.net, netdev@vger.kernel.org
Cc: Ilya Yanok <yanok@emcraft.com>
Subject: [PATCH] dnet: fix wrong use of platform_set_drvdata()
Date: Mon, 21 Feb 2011 21:20:30 +0100	[thread overview]
Message-ID: <1298319630-18159-1-git-send-email-yanok@emcraft.com> (raw)
In-Reply-To: <4D62C897.5020707@emcraft.com>

platform_set_drvdata() was used with argument of incorrect type and
could cause memory corruption. Moreover, because of not setting drvdata
in the correct place not all resources were freed upon module unload.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 drivers/net/dnet.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 9d8a20b..8318ea0 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -337,8 +337,6 @@ static int dnet_mii_init(struct dnet *bp)
 	for (i = 0; i < PHY_MAX_ADDR; i++)
 		bp->mii_bus->irq[i] = PHY_POLL;
 
-	platform_set_drvdata(bp->dev, bp->mii_bus);
-
 	if (mdiobus_register(bp->mii_bus)) {
 		err = -ENXIO;
 		goto err_out_free_mdio_irq;
@@ -863,6 +861,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
 	bp = netdev_priv(dev);
 	bp->dev = dev;
 
+	platform_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	spin_lock_init(&bp->lock);
-- 
1.7.4

  reply	other threads:[~2011-02-21 20:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-21  6:02 linux-next: build warning after merge of the driver-core tree Stephen Rothwell
2011-02-21  6:32 ` Greg KH
2011-02-21 20:18 ` Ilya Yanok
2011-02-21 20:20   ` Ilya Yanok [this message]
2011-02-28 20:22     ` [PATCH] dnet: fix wrong use of platform_set_drvdata() David Miller

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=1298319630-18159-1-git-send-email-yanok@emcraft.com \
    --to=yanok@emcraft.com \
    --cc=davem@davemloft.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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).