lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 1 Aug 2013 12:35:09 +0200
From:	Phil Sutter <phil@....cc>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH 1/3] af_packet: when sending ethernet frames, parse
 header for skb->protocol

Hi,

On Wed, Jul 31, 2013 at 05:30:17PM -0700, David Miller wrote:
> From: Phil Sutter <phil@....cc>
> Date: Wed, 31 Jul 2013 19:27:45 +0200
> 
> > @@ -2324,6 +2328,13 @@ static int packet_snd(struct socket *sock,
> >  
> >  	sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags);
> >  
> > +	if (dev->type == ARPHRD_ETHER) {
> > +		skb->protocol = eth_type_trans(skb, dev);
> > +	} else {
> > +		skb->protocol = proto;
> > +		skb->dev = dev;
> > +	}
> > +
> >  	if (!gso_type && (len > dev->mtu + reserve + extra_len)) {
> >  		/* Earlier code assumed this would be a VLAN pkt,
> >  		 * double-check this now that we have the actual
> > @@ -2338,8 +2349,6 @@ static int packet_snd(struct socket *sock,
> >  		}
> >  	}
> >  
> > -	skb->protocol = proto;
> > -	skb->dev = dev;
> >  	skb->priority = sk->sk_priority;
> >  	skb->mark = sk->sk_mark;
> 
> I don't see anything explaining why you are avoiding setting skb->dev when
> you use eth_type_trans() to set the skb->protocol field.

Simply because eth_type_trans() sets skb->dev already. You're right, I
probably should have mentioned this explicitly. At least my introductory
mail elaborated on this.

> Also, why isn't the user setting the protocol field correctly?  Isn't
> that the _real_ source of these problems?

Because the user specifies the value later used for skb->protocol at
either socket(), bind() or sendto() (i.e. flush) stage. Having both
"regular" and VLAN frames in the same TX ring is not possible at least.

> This patch series cannot be applied as is, it's either wrong, or
> explanations are missing from the commit messages.

Hmm. Is it OK to rely on eth_type_trans() setting skb->dev after all?
Depending on that, I would either add a comment or drop the change.

Best wishes, Phil
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ