Skip to content

Commit 3580ff3

Browse files
kuba-moosmb49
authored andcommitted
eth: fbnic: avoid double free when failing to DMA-map FW msg
BugLink: https://bugs.launchpad.net/bugs/2120812 [ Upstream commit 5bd1bafd4474ee26f504b41aba11f3e2a1175b88 ] The semantics are that caller of fbnic_mbx_map_msg() retains the ownership of the message on error. All existing callers dutifully free the page. Fixes: da3cde0 ("eth: fbnic: Add FW communication mechanism") Reviewed-by: Alexander Duyck <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent ea8b285 commit 3580ff3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/net/ethernet/meta/fbnic/fbnic_fw.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,8 @@ static int fbnic_mbx_map_msg(struct fbnic_dev *fbd, int mbx_idx,
127127
return -EBUSY;
128128

129129
addr = dma_map_single(fbd->dev, msg, PAGE_SIZE, direction);
130-
if (dma_mapping_error(fbd->dev, addr)) {
131-
free_page((unsigned long)msg);
132-
130+
if (dma_mapping_error(fbd->dev, addr))
133131
return -ENOSPC;
134-
}
135132

136133
mbx->buf_info[tail].msg = msg;
137134
mbx->buf_info[tail].addr = addr;

0 commit comments

Comments
 (0)