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] [day] [month] [year] [list]
Date:	Thu, 26 May 2011 14:22:42 -0400 (EDT)
From:	David Miller <davem@...emloft.net>
To:	greearb@...delatech.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] af-packet: Use existing netdev reference for bound
 sockets.

From: greearb@...delatech.com
Date: Wed, 25 May 2011 16:15:32 -0700

> @@ -1161,6 +1168,7 @@ static int packet_snd(struct socket *sock,
>  
>  	if (saddr == NULL) {
>  		ifindex	= po->ifindex;
> +		dev = po->prot_hook.dev;
>  		proto	= po->num;
>  		addr	= NULL;
>  	} else {
> @@ -1174,8 +1182,11 @@ static int packet_snd(struct socket *sock,
>  		addr	= saddr->sll_addr;
>  	}
>  
> +	if (!dev) {
> +		dev = dev_get_by_index(sock_net(sk), ifindex);
> +		need_rls_dev = true;
> +	}
>  

Why don't you move this second hunk into the "saddr != NULL" code
block?

That way all you can:

1) Call dev_get_by_index() unconditionally from that spot.

2) Only have the dev==NULL check right afterwards inside of the
   unbound case as well.
--
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