Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, linux-wpan@vger.kernel.org,
	kernel@pengutronix.de, Varka Bhadram <varkab@cdac.in>,
	Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH 2/4] mac802154: common error path
Date: Mon, 11 Aug 2014 13:25:08 +0200	[thread overview]
Message-ID: <1407756310-26592-3-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1407756310-26592-1-git-send-email-alex.aring@gmail.com>

From: Varka Bhadram <varkab@cdac.in>

By introducing label fail, making the common error path for
mac802154_llsec_decrypt() and packet type default case.

Signed-off-by: Varka Bhadram <varkab@cdac.in>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/wpan.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c
index 3c3069f..ce17570 100644
--- a/net/mac802154/wpan.c
+++ b/net/mac802154/wpan.c
@@ -472,8 +472,7 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb,
 	rc = mac802154_llsec_decrypt(&sdata->sec, skb);
 	if (rc) {
 		pr_debug("decryption failed: %i\n", rc);
-		kfree_skb(skb);
-		return NET_RX_DROP;
+		goto fail;
 	}
 
 	sdata->dev->stats.rx_packets++;
@@ -485,9 +484,12 @@ mac802154_subif_frame(struct mac802154_sub_if_data *sdata, struct sk_buff *skb,
 	default:
 		pr_warn("ieee802154: bad frame received (type = %d)\n",
 			mac_cb(skb)->type);
-		kfree_skb(skb);
-		return NET_RX_DROP;
+		goto fail;
 	}
+
+fail:
+	kfree_skb(skb);
+	return NET_RX_DROP;
 }
 
 static void mac802154_print_addr(const char *name,
-- 
2.0.3


  parent reply	other threads:[~2014-08-11 11:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 11:25 pull-request: wpan-next 2014-08-11 Alexander Aring
2014-08-11 11:25 ` [PATCH 1/4] mac802154: cleanup in rx path Alexander Aring
2014-08-11 19:18   ` Marcel Holtmann
2014-08-11 11:25 ` Alexander Aring [this message]
2014-08-11 19:18   ` [PATCH 2/4] mac802154: common error path Marcel Holtmann
2014-08-11 11:25 ` [PATCH 3/4] ieee802154: 6lowpan: remove unused function Alexander Aring
2014-08-11 19:17   ` Marcel Holtmann
2014-08-11 11:25 ` [PATCH 4/4] mac802154: common tx error path Alexander Aring
2014-08-11 19:17   ` Marcel Holtmann
2014-08-11 11:39 ` pull-request: wpan-next 2014-08-11 Alexander Aring
2014-08-11 19:24   ` Marcel Holtmann

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=1407756310-26592-3-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=varkab@cdac.in \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox