]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt_en: fix memory leaks in bnxt_dcbnl_ieee_getets()
authorEdwin Peer <edwin.peer@broadcom.com>
Sun, 22 Mar 2020 20:40:02 +0000 (16:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:01:41 +0000 (11:01 +0200)
commit4d7018a0ef748ffd201990b23c964267a24e031c
treef1c55af47e6998734a785023b6516d3ce098c5d9
parentbf1a0baed19a7bfbc0505fe2f81f6f43460bb873
bnxt_en: fix memory leaks in bnxt_dcbnl_ieee_getets()

[ Upstream commit fb9c6b6c60697986945c14d2a3f68c9997698ff2 ]

The allocated ieee_ets structure goes out of scope without being freed,
leaking memory. Appropriate result codes should be returned so that
callers do not rely on invalid data passed by reference.

Also cache the ETS config retrieved from the device so that it doesn't
need to be freed. The balance of the code was clearly written with the
intent of having the results of querying the hardware cached in the
device structure. The commensurate store was evidently missed though.

Fixes: f91e0d9c0ee6 ("bnxt_en: Implement DCBNL to support host-based DCBX.")
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c