b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: gregkh@suse.de
Cc: devel@linuxdriverproject.org, b.a.t.m.a.n@lists.open-mesh.net
Subject: [B.A.T.M.A.N.] [PATCH 6/8] Staging: batman-adv: Fix skbuff leak in VIS code.
Date: Fri, 19 Feb 2010 16:18:09 +0100	[thread overview]
Message-ID: <1266592691-13090-6-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1266592691-13090-5-git-send-email-andrew@lunn.ch>

The vis code takes a copy of the data inside the skbuf if it is interesting
for us, so we always need to release the skbuf.

Reported-by: Linus Luessing <linus.luessing@web.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/staging/batman-adv/routing.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c
index 7dc9aef..d89048b 100644
--- a/drivers/staging/batman-adv/routing.c
+++ b/drivers/staging/batman-adv/routing.c
@@ -939,7 +939,6 @@ int recv_vis_packet(struct sk_buff *skb)
 	struct vis_packet *vis_packet;
 	struct ethhdr *ethhdr;
 	int hdr_size = sizeof(struct vis_packet);
-	int ret;
 
 	if (skb_headlen(skb) < hdr_size)
 		return NET_RX_DROP;
@@ -962,18 +961,18 @@ int recv_vis_packet(struct sk_buff *skb)
 	case VIS_TYPE_SERVER_SYNC:
 		/* TODO: handle fragmented skbs properly */
 		receive_server_sync_packet(vis_packet, skb_headlen(skb));
-		ret = NET_RX_SUCCESS;
 		break;
 
 	case VIS_TYPE_CLIENT_UPDATE:
 		/* TODO: handle fragmented skbs properly */
 		receive_client_update_packet(vis_packet, skb_headlen(skb));
-		ret = NET_RX_SUCCESS;
 		break;
 
 	default:	/* ignore unknown packet */
-		ret = NET_RX_DROP;
 		break;
 	}
-	return ret;
+
+	/* We take a copy of the data in the packet, so we should
+	   always free the skbuf. */
+	return NET_RX_DROP;
 }
-- 
1.6.6.2


  reply	other threads:[~2010-02-19 15:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19 15:18 [B.A.T.M.A.N.] [PATCH 1/8] Staging: batman-adv: depend on NET instead of PACKET in Kconfig Andrew Lunn
2010-02-19 15:18 ` [B.A.T.M.A.N.] [PATCH 2/8] Staging: batman-adv: don't lock while sending packets Andrew Lunn
2010-02-19 15:18   ` [B.A.T.M.A.N.] [PATCH 3/8] Staging: batman-adv: avoid having the same error message more than once Andrew Lunn
2010-02-19 15:18     ` [B.A.T.M.A.N.] [PATCH 4/8] Staging: batman-adv: remove obsolete variables Andrew Lunn
2010-02-19 15:18       ` [B.A.T.M.A.N.] [PATCH 5/8] Staging: batman-adv: atomic variable for vis-srv activation Andrew Lunn
2010-02-19 15:18         ` Andrew Lunn [this message]
2010-02-19 15:18           ` [B.A.T.M.A.N.] [PATCH 7/8] Staging: batman-adv: avoid crash on memory allocation error Andrew Lunn
2010-02-19 15:18             ` [B.A.T.M.A.N.] [PATCH 8/8] Staging: batman-adv: fix module initialization Andrew Lunn

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=1266592691-13090-6-git-send-email-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    /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).