]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xen-netfront: handle NULL returned by xdp_convert_buff_to_frame()
authorAlexey Nepomnyashih <sdl@nppct.ru>
Thu, 17 Apr 2025 12:21:17 +0000 (12:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:50:46 +0000 (07:50 +0200)
commitcefd8a2e2de46209ce66e6d30c237eb59b6c5bfa
tree90ff3c170e1132f69a94d7d491a2e2f3cda4d1e1
parent284db2f35b39081b00b2e76b92949463b7fc460a
xen-netfront: handle NULL returned by xdp_convert_buff_to_frame()

commit cc3628dcd851ddd8d418bf0c897024b4621ddc92 upstream.

The function xdp_convert_buff_to_frame() may return NULL if it fails
to correctly convert the XDP buffer into an XDP frame due to memory
constraints, internal errors, or invalid data. Failing to check for NULL
may lead to a NULL pointer dereference if the result is used later in
processing, potentially causing crashes, data corruption, or undefined
behavior.

On XDP redirect failure, the associated page must be released explicitly
if it was previously retained via get_page(). Failing to do so may result
in a memory leak, as the pages reference count is not decremented.

Cc: stable@vger.kernel.org # v5.9+
Fixes: 6c5aa6fc4def ("xen networking: add basic XDP support for xen-netfront")
Signed-off-by: Alexey Nepomnyashih <sdl@nppct.ru>
Link: https://patch.msgid.link/20250417122118.1009824-1-sdl@nppct.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/xen-netfront.c