Skip to content

Commit b6355fb

Browse files
sudipm-mukherjeeSamuel Ortiz
authored andcommitted
nfc: fdp: fix NULL pointer dereference
We are checking phy after dereferencing it. We can print the debug information after checking it. If phy is NULL then we will get a good stack trace to tell us that we are in this irq handler. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent ce69b95 commit b6355fb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/nfc/fdp/i2c.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ static irqreturn_t fdp_nci_i2c_irq_thread_fn(int irq, void *phy_id)
210210
struct sk_buff *skb;
211211
int r;
212212

213-
client = phy->i2c_dev;
214-
dev_dbg(&client->dev, "%s\n", __func__);
215-
216213
if (!phy || irq != phy->i2c_dev->irq) {
217214
WARN_ON_ONCE(1);
218215
return IRQ_NONE;
219216
}
220217

218+
client = phy->i2c_dev;
219+
dev_dbg(&client->dev, "%s\n", __func__);
220+
221221
r = fdp_nci_i2c_read(phy, &skb);
222222

223223
if (r == -EREMOTEIO)

0 commit comments

Comments
 (0)