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, greearb@candelatech.com,
	Patrick McHardy <kaber@trash.net>,
	xemul@openvz.org
Subject: [ETH 01/04]: Validate address in eth_mac_addr
Date: Wed, 11 Jul 2007 19:38:14 +0200 (MEST)	[thread overview]
Message-ID: <20070711173814.18369.53719.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070711173812.18369.47109.sendpatchset@localhost.localdomain>

[ETH]: Validate address in eth_mac_addr

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

---
commit 690fb4dbafa9f60f8cb520d5def544580107b3a4
tree ded62c0fcd8497b5cf9459213e1579cc700abb39
parent 99d24edeb6abc6ca3a0d0fbdb83c664c04403c8c
author Patrick McHardy <kaber@trash.net> Wed, 11 Jul 2007 19:23:22 +0200
committer Patrick McHardy <kaber@trash.net> Wed, 11 Jul 2007 19:23:22 +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 1387e54..12c7657 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 -EADDRNOTAVAIL;
 	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
 	return 0;
 }

  reply	other threads:[~2007-07-11 17:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-11 17:38 [RTNETLINK 00/04]: rtnl_link improvements Patrick McHardy
2007-07-11 17:38 ` Patrick McHardy [this message]
2007-07-12  2:41   ` [ETH 01/04]: Validate address in eth_mac_addr David Miller
2007-07-11 17:38 ` [VLAN 02/04]: Fix MAC address handling Patrick McHardy
2007-07-11 17:54   ` Patrick McHardy
2007-07-11 18:16     ` Ben Greear
2007-07-11 18:37       ` Patrick McHardy
2007-07-12  2:45     ` David Miller
2007-07-12  2:41   ` David Miller
2007-07-11 17:38 ` [RTNETLINK 03/04]: rtnl_link API simplification Patrick McHardy
2007-07-12  2:42   ` David Miller
2007-07-11 17:38 ` [RTNETLINK 04/04]: rtnl_link: allow specifying initial device address Patrick McHardy
2007-07-12  2:43   ` 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=20070711173814.18369.53719.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=greearb@candelatech.com \
    --cc=netdev@vger.kernel.org \
    --cc=xemul@openvz.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).