Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1546147

[PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from crashing the kernel

From Geoff Lansberry <geoff@kuvee.com>
Newsgroups linux.kernel
Subject [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from crashing the kernel
Date 2016-12-22 05:20 +0100
Message-ID <sR31f-4py-7@gated-at.bofh.it> (permalink)
References <sR31f-4py-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Jaret Cantu <jaret.cantu@timesys.com>

Repeated polling attempts cause a NULL dereference error to occur.
This is because the state of the trf7970a is currently reading but
another request has been made to send a command before it has finished.

The solution is to properly kill the waiting reading (workqueue)
before failing on the send.

Signed-off-by: Geoff Lansberry <geoff@kuvee.com>
---
 drivers/nfc/trf7970a.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index e3c72c6..ba5f9b8 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -1496,6 +1496,10 @@ static int trf7970a_send_cmd(struct nfc_digital_dev *ddev,
 			(trf->state != TRF7970A_ST_IDLE_RX_BLOCKED)) {
 		dev_err(trf->dev, "%s - Bogus state: %d\n", __func__,
 				trf->state);
+		if (trf->state == TRF7970A_ST_WAIT_FOR_RX_DATA ||
+		    trf->state == TRF7970A_ST_WAIT_FOR_RX_DATA_CONT)
+			trf->ignore_timeout =
+				!cancel_delayed_work(&trf->timeout_work);
 		ret = -EIO;
 		goto out_err;
 	}
-- 
2.7.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from crashing the kernel Geoff Lansberry <geoff@kuvee.com> - 2016-12-22 05:20 +0100
  Re: [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from  crashing the kernel Mark Greer <mgreer@animalcreek.com> - 2016-12-24 07:10 +0100
    Re: [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from  crashing the kernel Geoff Lansberry <geoff@kuvee.com> - 2016-12-24 17:20 +0100
      Re: [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from  crashing the kernel Mark Greer <mgreer@animalcreek.com> - 2016-12-24 18:30 +0100
        Re: [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from  crashing the kernel Geoff Lansberry <geoff@kuvee.com> - 2016-12-27 15:30 +0100
          Re: [PATCH v3 3/3] nfc: trf7970a: Prevent repeated polling from  crashing the kernel Mark Greer <mgreer@animalcreek.com> - 2017-01-03 17:50 +0100

csiph-web