Commit f37058b8 authored by Stefan Richter's avatar Stefan Richter Committed by Greg Kroah-Hartman

firewire: net: fix use after free

commit 89875833 upstream.

Commit 8408dc1c "firewire: net: use dev_printk API" introduced a
use-after-free in a failure path.  fwnet_transmit_packet_failed(ptask)
may free ptask, then the dev_err() call dereferenced it.  The fix is
straightforward; simply reorder the two calls.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a2998041
...@@ -1014,8 +1014,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, ...@@ -1014,8 +1014,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode,
if (rcode == RCODE_COMPLETE) { if (rcode == RCODE_COMPLETE) {
fwnet_transmit_packet_done(ptask); fwnet_transmit_packet_done(ptask);
} else { } else {
fwnet_transmit_packet_failed(ptask);
if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) {
dev_err(&ptask->dev->netdev->dev, dev_err(&ptask->dev->netdev->dev,
"fwnet_write_complete failed: %x (skipped %d)\n", "fwnet_write_complete failed: %x (skipped %d)\n",
...@@ -1023,9 +1021,11 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, ...@@ -1023,9 +1021,11 @@ static void fwnet_write_complete(struct fw_card *card, int rcode,
errors_skipped = 0; errors_skipped = 0;
last_rcode = rcode; last_rcode = rcode;
} else } else {
errors_skipped++; errors_skipped++;
} }
fwnet_transmit_packet_failed(ptask);
}
} }
static int fwnet_send_packet(struct fwnet_packet_task *ptask) static int fwnet_send_packet(struct fwnet_packet_task *ptask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment