diff options
author | Edward O'Callaghan <quasisec@google.com> | 2020-03-26 14:37:37 +1100 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2020-03-26 05:31:38 +0000 |
commit | d08bc5ad7a83f56e0114b1d01bcab853d0da5cfb (patch) | |
tree | 5296f8c2e6936b11818b3e053ffec2801827c29c /src/drivers | |
parent | 2a82f744d460afee2218e072a3b8a31a4c6efb11 (diff) | |
download | coreboot-d08bc5ad7a83f56e0114b1d01bcab853d0da5cfb.tar.xz |
drivers/net/r8168: Fix leaking memory from mapping
BUG=b:152157720,b:152459313
BRANCH=none
TEST=none
Change-Id: Ie79c3209d0be719ae1394e87efb357b84ce32840
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39855
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/net/r8168.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/drivers/net/r8168.c b/src/drivers/net/r8168.c index fcdac90481..99d472ce8e 100644 --- a/src/drivers/net/r8168.c +++ b/src/drivers/net/r8168.c @@ -117,6 +117,7 @@ static enum cb_err fetch_mac_vpd_key(u8 *macstrbuf, const char *vpd_key) if (offset == search_length) { printk(BIOS_ERR, "Error: Could not locate '%s' in VPD\n", vpd_key); + rdev_munmap(&rdev, search_address); return CB_ERR; } printk(BIOS_DEBUG, "Located '%s' in VPD\n", vpd_key); @@ -124,10 +125,12 @@ static enum cb_err fetch_mac_vpd_key(u8 *macstrbuf, const char *vpd_key) offset += strlen(vpd_key) + 1; /* move to next character */ if (offset + MACLEN > search_length) { + rdev_munmap(&rdev, search_address); printk(BIOS_ERR, "Search result too small!\n"); return CB_ERR; } memcpy(macstrbuf, search_address + offset, MACLEN); + rdev_munmap(&rdev, search_address); return CB_SUCCESS; } |