[ovs-dev] [PATCH] meta-flow: Make mf_vl_mff_mf_from_nxm_header() require a valid field.

Ben Pfaff blp at ovn.org
Tue Jul 31 21:51:54 UTC 2018


All the users of mf_vl_mff_mf_from_nxm_header() expect it to always obtain
a valid field or to report an error.  In practice, it did not report an
error in the case where the field was unknown (although it did report an
error in some other cases).  This commit fixes the problem.

Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9652
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 lib/meta-flow.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index fd8f3c6d85ea..b6d9e92b691d 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -3519,7 +3519,9 @@ mf_vl_mff_mf_from_nxm_header(uint32_t header,
                              uint64_t *tlv_bitmap)
 {
     *field = mf_from_nxm_header(header, vl_mff_map);
-    if (mf_vl_mff_invalid(*field, vl_mff_map)) {
+    if (!*field) {
+        return OFPERR_OFPBAC_BAD_SET_TYPE;
+    } else if (mf_vl_mff_invalid(*field, vl_mff_map)) {
         return OFPERR_NXFMFC_INVALID_TLV_FIELD;
     }
 
-- 
2.16.1



More information about the dev mailing list