diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2014-02-18 22:25:15 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-23 21:37:06 -0700 |
commit | f37058b88772ed4de812d1716634649ee1e6480e (patch) | |
tree | f18ce74ce734779947cbde687780d2d168583fe8 | |
parent | a299804140325db7b93173419b0724056b60f34d (diff) |
firewire: net: fix use after free
commit 8987583366ae9e03c306c2b7d73bdb952df1d08d upstream.
Commit 8408dc1c14c1 "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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/firewire/net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 638e1f71284..7cff7f7e69e 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c @@ -1014,8 +1014,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, if (rcode == RCODE_COMPLETE) { fwnet_transmit_packet_done(ptask); } else { - fwnet_transmit_packet_failed(ptask); - if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { dev_err(&ptask->dev->netdev->dev, "fwnet_write_complete failed: %x (skipped %d)\n", @@ -1023,8 +1021,10 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, errors_skipped = 0; last_rcode = rcode; - } else + } else { errors_skipped++; + } + fwnet_transmit_packet_failed(ptask); } } |