The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fad5734995e3fba428ce5e4131389c4fff0610ab

commit fad5734995e3fba428ce5e4131389c4fff0610ab
Author:     Kristof Provost <[email protected]>
AuthorDate: 2023-10-14 12:47:35 +0000
Commit:     Kristof Provost <[email protected]>
CommitDate: 2023-10-17 06:47:48 +0000

    netlink: descend into nested parsers when verifying
    
    When we verify that the attributes are correctly sorted we should also
    try to verify the nested attribute parsers.
    
    Reviewed by:    melifaro
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D42222
---
 sys/netlink/netlink_message_parser.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/netlink/netlink_message_parser.h 
b/sys/netlink/netlink_message_parser.h
index 517f3ebd49f2..c682973d3e33 100644
--- a/sys/netlink/netlink_message_parser.h
+++ b/sys/netlink/netlink_message_parser.h
@@ -289,6 +289,14 @@ nl_verify_parsers(const struct nlhdr_parser **parser, int 
count)
                for (int j = 0; j < p->np_size; j++) {
                        MPASS(p->np[j].type > attr_type);
                        attr_type = p->np[j].type;
+
+                       /* Recurse into nested objects. */
+                       if (p->np[j].cb == nlattr_get_nested ||
+                           p->np[j].cb == nlattr_get_nested_ptr) {
+                               const struct nlhdr_parser *np =
+                                   (const struct nlhdr_parser *)p->np[j].arg;
+                               nl_verify_parsers(&np, 1);
+                       }
                }
        }
 #endif

Reply via email to