[ovs-dev] [PATCH] pktbuf: Always initialize '*bufferp' even when 'pb == NULL'.

Ben Pfaff blp at nicira.com
Sat Jan 17 17:21:13 UTC 2015


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 at nicira.com>
---
 ofproto/pktbuf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ofproto/pktbuf.c b/ofproto/pktbuf.c
index ad2b1a4..aa6912e 100644
--- a/ofproto/pktbuf.c
+++ b/ofproto/pktbuf.c
@@ -184,7 +184,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 OFPERR_OFPBRC_BUFFER_UNKNOWN;
+        error = OFPERR_OFPBRC_BUFFER_UNKNOWN;
+        goto error;
     }
 
     p = &pb->packets[id & PKTBUF_MASK];
-- 
2.1.3




More information about the dev mailing list