diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 2cfff70f70e062db8be50df2542bc8f3596c93e8..9e524884d4ac4a0cefd230dea1ff4b90c4ec7f55 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -894,6 +894,11 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, return -EINVAL; } + if (protocol >= NFC_PROTO_MAX) { + pr_err("the requested nfc protocol is invalid\n"); + return -EINVAL; + } + if (!(nci_target->supported_protocols & (1 << protocol))) { pr_err("target does not support the requested protocol 0x%x\n", protocol);