Re: potential memory leak in netlbl_mgmt_add_common

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 18, 2020 at 8:59 AM Stephen Smalley
<stephen.smalley.work@xxxxxxxxx> wrote:
>
> On Tue, Aug 18, 2020 at 8:52 AM Stephen Smalley
> <stephen.smalley.work@xxxxxxxxx> wrote:
> > If I am decoding this correctly, it looks like the leaking allocation
> > is at net/netlabel/netlabel_mgmt.c:152:
> >    147         if (info->attrs[NLBL_MGMT_A_IPV4ADDR]) {
> >     148                 struct in_addr *addr;
> >     149                 struct in_addr *mask;
> >     150                 struct netlbl_domaddr4_map *map;
> >     151
> >     152                 addrmap = kzalloc(sizeof(*addrmap), GFP_KERNEL);
> >     153                 if (addrmap == NULL) {
> >     154                         ret_val = -ENOMEM;
> >     155                         goto add_doi_put_def;
> >     156                 }
>
> And the full stacktrace fed through decode_stacktrace.sh (which I
> didn't realize existed until just now, was doing it by hand) is:
> netlbl_mgmt_add_common (net/netlabel/netlabel_mgmt.c:153)
> netlbl_mgmt_adddef (net/netlabel/netlabel_mgmt.c:546)
> genl_rcv_msg (net/netlink/genetlink.c:693 net/netlink/genetlink.c:736
> net/netlink/genetlink.c:753)
> netlink_rcv_skb (net/netlink/af_netlink.c:2470)
> genl_rcv (net/netlink/genetlink.c:765)
> netlink_unicast (net/netlink/af_netlink.c:1304 net/netlink/af_netlink.c:1329)
> netlink_sendmsg (net/netlink/af_netlink.c:1918)
> sock_sendmsg (net/socket.c:652 net/socket.c:672)
> ____sys_sendmsg (net/socket.c:2352)
> ___sys_sendmsg (net/socket.c:2408)
> __sys_sendmsg (./include/linux/file.h:31 net/socket.c:2441)
> do_syscall_64 (arch/x86/entry/common.c:359)
> entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:124)

Also, there appear to be other leaks of memory allocated near
net/netlabel/netlabel_mgmt.c:88
net/netlabel/netlabel_mgmt.c:201:
     86         struct netlbl_dom_map *entry = kzalloc(sizeof(*entry),
GFP_KERNEL);
     87
     88         if (!entry)
     89                 return -ENOMEM;
...
    195         } else if (info->attrs[NLBL_MGMT_A_IPV6ADDR]) {
    196                 struct in6_addr *addr;
    197                 struct in6_addr *mask;
    198                 struct netlbl_domaddr6_map *map;
    199
    200                 addrmap = kzalloc(sizeof(*addrmap), GFP_KERNEL);
    201                 if (addrmap == NULL) {
    202                         ret_val = -ENOMEM;
    203                         goto add_doi_put_def;
    204                 }

Probably the same cause for all of them.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux