All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Martin Townsend <mtownsend1973@gmail.com>
Cc: linux-zigbee-devel@lists.sourceforge.net,
	linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org,
	marcel@holtmann.org, Martin Townsend <martin.townsend@xsilon.com>
Subject: Re: [PATCH v2 bluetooth] 6lowpan: fix incorrect return values in lowpan_rcv
Date: Mon, 15 Sep 2014 12:24:58 +0200	[thread overview]
Message-ID: <20140915102457.GB10580@omega> (raw)
In-Reply-To: <20140915101331.GA10580@omega>

On Mon, Sep 15, 2014 at 12:13:31PM +0200, Alexander Aring wrote:
...
> 
> >  			if (ret == 1) {
> > -				ret = process_data(skb, &hdr);
> > -				if (ret == NET_RX_DROP)
> > +				ret = process_data(&skb, &hdr);
> > +				if (ret < 0)
> >  					goto drop;
> this function returning an errno, you can't return the errno here. goto
> drop returns the ret variable. Maybe just make a return NET_RX_DROP at
> drop. We should never return a different variable.
Oops, I looked at the wong please I mean before drop, when all things
are fine.

> 
> Also this need to be drop_skb at several places in this code, we don't
> have a kfree_skb at process_data anymore. This leaks memory.
> 
> > +			} else {
> > +				return NET_RX_SUCCESS;
> >  			}
> >  			break;
> >  		case LOWPAN_DISPATCH_FRAGN:	/* next fragments headers */
> >  			ret = lowpan_frag_rcv(skb, LOWPAN_DISPATCH_FRAGN);
> 
> same here.
> >  			if (ret == 1) {
> > -				ret = process_data(skb, &hdr);
> > -				if (ret == NET_RX_DROP)
> > +				ret = process_data(&skb, &hdr);
> > +				if (ret < 0)
> >  					goto drop;
> 
> same here.
> 
> > +			} else {
> > +				return NET_RX_SUCCESS;
> >  			}
> >  			break;
> >  		default:
> > @@ -515,7 +514,16 @@ static int lowpan_rcv(struct sk_buff *skb, struct net_device *dev,
> >  		}
> >  	}
> >  

If all things are fine, there is somewhere a return ret;

We should change it to return NET_RX_SUCCESS.

- Alex

  reply	other threads:[~2014-09-15 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12  9:34 [PATCH v2 bluetooth] Fix lowpan_rcv Martin Townsend
2014-09-12  9:34 ` Martin Townsend
2014-09-12  9:34 ` [PATCH v2 bluetooth] 6lowpan: fix incorrect return values in lowpan_rcv Martin Townsend
2014-09-15 10:13   ` Alexander Aring
2014-09-15 10:24     ` Alexander Aring [this message]
2014-09-15 11:08     ` Martin Townsend
2014-09-15 11:50       ` Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140915102457.GB10580@omega \
    --to=alex.aring@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=linux-zigbee-devel@lists.sourceforge.net \
    --cc=marcel@holtmann.org \
    --cc=martin.townsend@xsilon.com \
    --cc=mtownsend1973@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.