From: "Denis V. Lunev" <den@openvz.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, devel@openvz.org,
"Denis V. Lunev" <den@openvz.org>
Subject: [PATCH] [IGMP]: Optimize kfree_skb in igmp_rcv.
Date: Fri, 8 Feb 2008 17:14:17 +0300 [thread overview]
Message-ID: <1202480057-23367-1-git-send-email-den@openvz.org> (raw)
Merge error paths inside igmp_rcv.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv4/igmp.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index fe2e6cd..d3f34a7 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -922,13 +922,11 @@ int igmp_rcv(struct sk_buff *skb)
struct in_device *in_dev = in_dev_get(skb->dev);
int len = skb->len;
- if (in_dev==NULL) {
- kfree_skb(skb);
- return 0;
- }
+ if (in_dev == NULL)
+ goto drop;
if (!pskb_may_pull(skb, sizeof(struct igmphdr)))
- goto drop;
+ goto drop_ref;
switch (skb->ip_summed) {
case CHECKSUM_COMPLETE:
@@ -938,7 +936,7 @@ int igmp_rcv(struct sk_buff *skb)
case CHECKSUM_NONE:
skb->csum = 0;
if (__skb_checksum_complete(skb))
- goto drop;
+ goto drop_ref;
}
ih = igmp_hdr(skb);
@@ -972,8 +970,9 @@ int igmp_rcv(struct sk_buff *skb)
break;
}
-drop:
+drop_ref:
in_dev_put(in_dev);
+drop:
kfree_skb(skb);
return 0;
}
--
1.5.3.rc5
next reply other threads:[~2008-02-08 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-08 14:14 Denis V. Lunev [this message]
2008-02-10 7:22 ` [PATCH] [IGMP]: Optimize kfree_skb in igmp_rcv David Miller
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=1202480057-23367-1-git-send-email-den@openvz.org \
--to=den@openvz.org \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).