diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2014-02-18 16:25:15 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2014-02-28 05:02:51 -0500 |
commit | 8987583366ae9e03c306c2b7d73bdb952df1d08d (patch) | |
tree | b41f0bbe8ce8d49bc090f6d30e7ab39ee77db023 | |
parent | cfbf8d4857c26a8a307fb7cd258074c9dcd8c691 (diff) |
firewire: net: fix use after free
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>
Cc: stable@vger.kernel.org # v3.4+
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-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 6b895986dc22..4af0a7bad7f2 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -929,8 +929,6 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
929 | if (rcode == RCODE_COMPLETE) { | 929 | if (rcode == RCODE_COMPLETE) { |
930 | fwnet_transmit_packet_done(ptask); | 930 | fwnet_transmit_packet_done(ptask); |
931 | } else { | 931 | } else { |
932 | fwnet_transmit_packet_failed(ptask); | ||
933 | |||
934 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { | 932 | if (printk_timed_ratelimit(&j, 1000) || rcode != last_rcode) { |
935 | dev_err(&ptask->dev->netdev->dev, | 933 | dev_err(&ptask->dev->netdev->dev, |
936 | "fwnet_write_complete failed: %x (skipped %d)\n", | 934 | "fwnet_write_complete failed: %x (skipped %d)\n", |
@@ -938,8 +936,10 @@ static void fwnet_write_complete(struct fw_card *card, int rcode, | |||
938 | 936 | ||
939 | errors_skipped = 0; | 937 | errors_skipped = 0; |
940 | last_rcode = rcode; | 938 | last_rcode = rcode; |
941 | } else | 939 | } else { |
942 | errors_skipped++; | 940 | errors_skipped++; |
941 | } | ||
942 | fwnet_transmit_packet_failed(ptask); | ||
943 | } | 943 | } |
944 | } | 944 | } |
945 | 945 | ||