Message ID | 1481841044-4314-3-git-send-email-glansberry@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Samuel Ortiz |
Headers | show |
On Thu, Dec 15, 2016 at 05:30:44PM -0500, Geoff Lansberry wrote: > From: Jaret Cantu <jaret.cantu@timesys.com> > > Repeated polling attempts cause a NULL dereference error to occur. > This is because the curent state of the trf7970a is reading but > a request has been made to send a command. > > The solution is to properly kill the waiting reading (workqueue) > before failing on the send. Maybe its just me but I find this description a little hard to grok. Mind reworking it? The patch itself looks fine. Thanks, Mark --
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index b4c37ab..f96a321 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -1493,6 +1493,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; }
From: Jaret Cantu <jaret.cantu@timesys.com> Repeated polling attempts cause a NULL dereference error to occur. This is because the curent state of the trf7970a is reading but a request has been made to send a command. The solution is to properly kill the waiting reading (workqueue) before failing on the send. --- drivers/nfc/trf7970a.c | 4 ++++ 1 file changed, 4 insertions(+)