summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2015-01-17 09:21:04 -0800
committerBen Pfaff <blp@nicira.com>2015-01-19 10:10:45 -0800
commit0dbab0f8047c18ca042d269c79c1c85ee8c40eeb (patch)
treead6d7cd5eeca9eae7640a015fa8e25cf126ec025
parenta69c2d98d05c882c43e7f9eadbe3f2b5cbf37bb0 (diff)
downloadopenvswitch-branch-1.4.tar.gz
pktbuf: Always initialize '*bufferp' even when 'pb == NULL'.branch-1.4
Otherwise if a service connection (which does not have buffers) attempts to use buffers, '*bufferp' will be uninitialized, which can cause a segfault in the caller. Found using OFtest configured to use service (active rather than passive) connections. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com>
-rw-r--r--ofproto/pktbuf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c
index fc4c66ca1..5c5670909 100644
--- a/ofproto/pktbuf.c
+++ b/ofproto/pktbuf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2015 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -183,7 +183,8 @@ pktbuf_retrieve(struct pktbuf *pb, uint32_t id, struct ofpbuf **bufferp,
if (!pb) {
VLOG_WARN_RL(&rl, "attempt to send buffered packet via connection "
"without buffers");
- return ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BUFFER_UNKNOWN);
+ error = ofp_mkerr(OFPET_BAD_REQUEST, OFPBRC_BUFFER_UNKNOWN);
+ goto error;
}
p = &pb->packets[id & PKTBUF_MASK];