Skip to content

Commit 5bd1baf

Browse files
kuba-mooPaolo Abeni
authored andcommitted
eth: fbnic: avoid double free when failing to DMA-map FW msg
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]>
1 parent 9b70c36 commit 5bd1baf

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)