diff options
author | Szymon Janc <szymon.janc@tieto.com> | 2012-10-29 14:04:43 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-12-03 11:47:11 -0800 |
commit | c09221cefdbd669883f94ff62f055d270df85feb (patch) | |
tree | 0dd96383bda397cc3b30605f88c92501ba0cae36 | |
parent | 9cfb66219d6e5840df9c4cf06fff70e072be1409 (diff) | |
download | linux-3.10-c09221cefdbd669883f94ff62f055d270df85feb.tar.gz linux-3.10-c09221cefdbd669883f94ff62f055d270df85feb.tar.bz2 linux-3.10-c09221cefdbd669883f94ff62f055d270df85feb.zip |
NFC: pn533: Fix use after free
commit 770f750bc2b8312489c8e45306f551d08a319d3c upstream.
cmd was freed in pn533_dep_link_up regardless of
pn533_send_cmd_frame_async return code. Cmd is passed as argument to
pn533_in_dep_link_up_complete callback and should be freed there.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/nfc/pn533.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index cb6204f7830..eeb0d59e17f 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c @@ -1385,12 +1385,8 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, int target_idx, rc = pn533_send_cmd_frame_async(dev, dev->out_frame, dev->in_frame, dev->in_maxlen, pn533_in_dep_link_up_complete, cmd, GFP_KERNEL); - if (rc) - goto out; - - -out: - kfree(cmd); + if (rc < 0) + kfree(cmd); return rc; } |