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]
Message-ID: <20181214201135.GB21591@lunn.ch>
Date:   Fri, 14 Dec 2018 21:11:35 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Marek Vasut <marex@...x.de>
Cc:     netdev@...r.kernel.org, f.fainelli@...il.com,
        Tristram Ha <Tristram.Ha@...rochip.com>,
        Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
        Woojung Huh <woojung.huh@...rochip.com>,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH V2 2/3] net: dsa: ksz: Factor out common tag code

On Fri, Dec 14, 2018 at 02:30:35PM +0100, Marek Vasut wrote:
> On 12/14/2018 10:05 AM, Andrew Lunn wrote:
> >> +static struct sk_buff *ksz_common_xmit(struct sk_buff *skb,
> >> +				       struct net_device *dev, int len)
> >>  {
> >> -	struct dsa_port *dp = dsa_slave_to_port(dev);
> >>  	struct sk_buff *nskb;
> >>  	int padlen;
> >> -	u8 *tag;
> >>  
> >>  	padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len;
> >>  
> >> -	if (skb_tailroom(skb) >= padlen + KSZ_INGRESS_TAG_LEN) {
> >> +	if (skb_tailroom(skb) >= padlen + len) {
> >>  		/* Let dsa_slave_xmit() free skb */
> >>  		if (__skb_put_padto(skb, skb->len + padlen, false))
> >>  			return NULL;
> > 
> > Hi Marek
> 
> Hi,
> 
> > This can return NULL.
> > 
> >> +static struct sk_buff *ksz9477_xmit(struct sk_buff *skb,
> >> +				    struct net_device *dev)
> >> +{
> >> +	struct dsa_port *dp = dsa_slave_to_port(dev);
> >> +	struct sk_buff *nskb;
> >> +	u16 *tag;
> >> +	u8 *addr;
> >> +
> >> +	nskb = ksz_common_xmit(skb, dev, KSZ9477_INGRESS_TAG_LEN);
> > 
> > So here you need to check for NULL
> 
> What do we do if the xmit returns NULL ?

Return NULL to the caller. There are comments which explain this:

static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev)
{
[snip]
        /* Transmit function may have to reallocate the original SKB,
         * in which case it must have freed it. Only free it here on error.
         */
        nskb = p->xmit(skb, dev);
        if (!nskb) {
                kfree_skb(skb);
                return NETDEV_TX_OK;
        }

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ