From error27@gmail.com Mon Jun 14 15:51:12 2010 From: Dan Carpenter Date: Sat, 5 Jun 2010 19:16:42 +0200 Subject: Staging: mrst-touchscreen: fix dereferencing free memory To: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, kernel-janitors@vger.kernel.org, Alan Cox Message-ID: <20100605171642.GM5483@bicker> Content-Disposition: inline I moved the kfree() down a couple lines after the dereference. Signed-off-by: Dan Carpenter Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mrst-touchscreen/intel-mid-touch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c +++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c @@ -817,9 +817,9 @@ static int mrstouch_remove(struct spi_de free_irq(mrstouchdevp->irq, mrstouchdevp); input_unregister_device(mrstouchdevp->input); input_free_device(mrstouchdevp->input); - kfree(mrstouchdevp); if (mrstouchdevp->pendet_thrd) kthread_stop(mrstouchdevp->pendet_thrd); + kfree(mrstouchdevp); return 0; }