Re: [PATCH] e1000, e1000e valid-addr fixes

Jeff Garzik
2007-10-24T01:03:49Z

Jeff Garzik wrote:
> Actually, looking over the code I see obvious bugs in the logic:
>
> An invalid ethernet address should not cause device loading to fail,
> because the user is given the opportunity to supply a MAC address via
> userspace (ifconfig or whatever) before the interface goes up.
>
> I just created the attached -bug fix- patch as illustration, though I
> have not committed it, waiting for comment.
>
> This patch will make no difference for users hitting invalid-eep-csum
> rather than invalid-MAC-addr condition, but it's a problem I noticed
> while reviewing Adam's patch in detail.

Adding my own comment :)

Does the ethernet stack check is_valid_ether_addr() before permitting
interface-up?

I'm wondering if there is a way to avoid adding

if (!is_valid_ether_addr(dev->dev_addr))
return -EINVAL;

to every ethernet driver's ->open() hook.

Jeff