]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
linux: make linux_netlink_p->msg_from_linux be able to fail
authorGleb Smirnoff <glebius@FreeBSD.org>
Fri, 29 Mar 2024 20:35:51 +0000 (13:35 -0700)
committerGleb Smirnoff <glebius@FreeBSD.org>
Fri, 29 Mar 2024 20:35:51 +0000 (13:35 -0700)
commitb977dd1ea5fbc2df3f1279330be4d089322eb2cf
treec493bfecd79f527ea4fce6feb099c4ed31f15ec4
parent9d4a08d162d87ba120f418a1a71facd2c631b549
linux: make linux_netlink_p->msg_from_linux be able to fail

The KPI for this function was misleading.  From the NetLink perspective it
looked like a function that: a) allocates new hdr, b) can fail.  Neither
was true.  Let the function return a error code instead of returning the
same hdr it was passed to.  In case if future Linux NetLink compatibility
support calls for reallocating header, pass hdr as pointer to pointer.

With KPI that returns a error, propagate domain conversion errors all the
way up to NetLink module.  This fixes panic when unknown domain is
converted to 0xff and this invalid value is passed into NetLink
processing.

PR: 274536
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D44392
sys/compat/linux/linux_netlink.c
sys/netlink/netlink_io.c
sys/netlink/netlink_linux.h