Skip to content

Commit

Permalink
wl12xx: fix use after free
Browse files Browse the repository at this point in the history
When DEBUG_SPI is included in the debug log level wl1271_spi_reset()
will dump the already freed memory instead of the SPI buffer.

This bug was spotted by the semantic patch tool coccinelle using the
script found at scripts/coccinelle/free/kfree.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Mathias Krause authored and John W. Linville committed Jan 31, 2011
1 parent c7c1806 commit 9b00b41
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/wireless/wl12xx/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ static void wl1271_spi_reset(struct wl1271 *wl)
spi_message_add_tail(&t, &m);

spi_sync(wl_to_spi(wl), &m);
kfree(cmd);

wl1271_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN);
kfree(cmd);
}

static void wl1271_spi_init(struct wl1271 *wl)
Expand Down

0 comments on commit 9b00b41

Please sign in to comment.