>Subject: [PATCH net] tipc: require a NUL-terminated media name > >TIPC_NLA_MEDIA_NAME is an NLA_STRING, which may lack a NUL terminator, >but tipc_nl_media_get() and __tipc_nl_media_set() pass it to >tipc_media_find(), which compares it with strcmp(). A name without a >terminator at the end of the message makes strcmp() read past the >attribute: > > BUG: KMSAN: uninit-value in strcmp (lib/string.c:267) > strcmp (lib/string.c:267) > __tipc_nl_media_set (net/tipc/bearer.c:82 net/tipc/bearer.c:1381) > tipc_nl_media_set (net/tipc/bearer.c:1426) > genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114) > genl_rcv_msg (net/netlink/genetlink.c:1209) > netlink_rcv_skb (net/netlink/af_netlink.c:2585) > Uninit was created at: > __alloc_skb (net/core/skbuff.c:716) > netlink_alloc_large_skb (net/netlink/af_netlink.c:1202) > netlink_sendmsg (net/netlink/af_netlink.c:1896) > >Make it an NLA_NUL_STRING bounded by TIPC_MAX_MEDIA_NAME, as the >link and bearer names already are. > >Fixes: 46f15c6794fb ("tipc: add media get/dump to new netlink api") >Signed-off-by: Kyuwon Cho <kyuw…@gmail.com>
Reviewed-by: Tung Nguyen <tung…@est.tech>