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:	Mon, 11 Jan 2010 15:55:37 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	socketcan@...tkopp.net
Cc:	wg@...ndegger.com, netdev@...r.kernel.org,
	socketcan-core@...ts.berlios.de, mkl@...gutronix.de
Subject: Re: [PATCH net-next-2.6 v3] can: Unify droping of invalid tx skbs
 and netdev stats

From: Oliver Hartkopp <socketcan@...tkopp.net>
Date: Tue, 12 Jan 2010 00:19:21 +0100

>  static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
>  {
> +	struct can_frame *cf = (struct can_frame *)skb->data;
>  	struct net_device_stats *stats = &dev->stats;
>  	int loop;
>  
> +	if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
> +		kfree_skb(skb);
> +		stats->tx_dropped++;
> +		return NETDEV_TX_OK;
> +	}
> +
 ...
> +/* Drop a given socketbuffer if it does not contain a valid CAN frame. */
> +static inline int can_dropped_invalid_skb(struct net_device *dev,
> +					  struct sk_buff *skb)
> +{
> +	const struct can_frame *cf = (struct can_frame *)skb->data;
> +
> +	if (unlikely(skb->len != sizeof(*cf) || cf->can_dlc > 8)) {
> +		kfree_skb(skb);
> +		dev->stats.tx_dropped++;
> +		return 1;
> +	}
> +
> +	return 0;
> +}
> +
>  struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max);

Why are you not using the new helper function in vcan_tx()?
--
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