netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Patrick McHardy <kaber@trash.net>
Subject: [ETHERNET 01/02]: Validate new address in eth_mac_addr
Date: Tue, 19 Jun 2007 15:08:43 +0200 (MEST)	[thread overview]
Message-ID: <20070619130826.26769.24481.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070619130825.26769.23059.sendpatchset@localhost.localdomain>

[ETHERNET]: Validate new address in eth_mac_addr

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit c92ac42cd3badaf120e97223ac4798abf5226424
tree 824d080a4748fcd6f025bbe7b9466feee46e3303
parent 45da27ba265dba3c740c45d47f584c30d7066f82
author Patrick McHardy <kaber@trash.net> Mon, 18 Jun 2007 16:15:32 +0200
committer Patrick McHardy <kaber@trash.net> Mon, 18 Jun 2007 16:15:32 +0200

 net/ethernet/eth.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 0ac2524..9298a2c 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -266,8 +266,11 @@ void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
 static int eth_mac_addr(struct net_device *dev, void *p)
 {
 	struct sockaddr *addr = p;
+
 	if (netif_running(dev))
 		return -EBUSY;
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EINVAL;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
 	return 0;
 }

  reply	other threads:[~2007-06-19 13:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 13:08 [NET 00/02]: MACVLAN driver Patrick McHardy
2007-06-19 13:08 ` Patrick McHardy [this message]
2007-06-19 13:08 ` [NET 02/02]: Add " Patrick McHardy
2007-06-19 16:00 ` [NET 00/02]: " Stephen Hemminger
2007-06-19 19:53   ` Chris Leech
2007-06-19 21:14   ` Patrick McHardy
2007-06-19 22:29     ` Stephen Hemminger
2007-06-19 22:48     ` David Miller
2007-06-19 23:44       ` Patrick McHardy
2007-06-20  6:34       ` Jeff Garzik
2007-06-20 19:35         ` Prafulla Deuskar
2007-06-21 14:57           ` Patrick McHardy

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=20070619130826.26769.24481.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --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).