]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET
authorVincenzo Maffione <vmaffione@FreeBSD.org>
Mon, 15 Mar 2021 17:39:18 +0000 (17:39 +0000)
committerVincenzo Maffione <vmaffione@FreeBSD.org>
Tue, 23 Mar 2021 22:04:29 +0000 (22:04 +0000)
commitf7e3976ed0336b338ae83cfaef68ef5094532040
tree08353dd457241972d7b63883f901ca1b785ba0f2
parenta9c7d90862ef1214f5d9c4455d4519eec3a34570
netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET

The netmap_ioctl() function has a reference counting bug in case of
NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`,
the function does not decrease the refcount of "nmd", which is
increased by netmap_mem_find(), causing a refcount leak.

Approved by: re (gjb)
Reported by: Xiyu Yang <sherllyyang00@gmail.com>
Submitted by: Carl Smith <carl.smith@alliedtelesis.co.nz>
MFC after: 3 days
PR: 254311

(cherry picked from commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173)
(cherry picked from commit 120a4bd4e9d05147a9774a2ca4b4eff48e062442)
sys/dev/netmap/netmap.c