Skip to content

Commit 8335b31

Browse files
sudipm-mukherjeegregkh
authored andcommitted
nfc: fdp: fix NULL pointer dereference
commit b6355fb upstream. 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 <[email protected]> Signed-off-by: Samuel Ortiz <[email protected]> Signed-off-by: Amit Pundir <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 56548b6 commit 8335b31

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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)