]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
crypto: bfin_crc - reposition free_irq to avoid access to invalid data
authorJulia Lawall <Julia.Lawall@lip6.fr>
Mon, 7 Jan 2013 10:00:16 +0000 (11:00 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 19 Jan 2013 23:16:40 +0000 (10:16 +1100)
commit17bebdcd5c7c56cde82b8ccb02c5cea69e05f6d3
tree4f2eb74f269a44c2961dc6f74c4572031fb32ef8
parentd20fb18be246d196225ed151c126832b2dab6506
crypto: bfin_crc - reposition free_irq to avoid access to invalid data

The data referenced by an interrupt handler should not be freed before the
interrupt is ended.  The handler is bfin_crypto_crc_handler.  It may refer
to crc->regs, which is released by the iounmap.

Furthermore, the second argument to all calls to free_irq is incorrect.  It
should be the same as the last argument of request_irq, which is crc,
rather than crc->dev.

The semantic match that finds the first problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@fn exists@
expression list es;
expression a,b;
identifier f;
@@

if (...) {
  ... when any
  free_irq(a,b);
  ... when any
  f(es);
  ... when any
  return ...;
}

@@
expression list fn.es;
expression fn.a,fn.b;
identifier fn.f;
@@

*f(es);
... when any
*free_irq(a,b);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/bfin_crc.c