netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION
@ 2022-04-01 18:09 Martin Faltesek
  2022-04-02  8:55 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Faltesek @ 2022-04-01 18:09 UTC (permalink / raw)
  To: netdev, kuba, krzk, christophe.ricard, jordy
  Cc: sameo, wklin, groeck, mfaltesek, gregkh

The first validation check for EVT_TRANSACTION has two different checks
tied together with logical AND. One is a check for minimum packet length,
and the other is for a valid aid_tag. If either condition is true (fails),
then an error should be triggered.  The fix is to change && to ||.

Fixes: 26fc6c7f02cb ("NFC: st21nfca: Add HCI transaction event support")
Signed-off-by: Martin Faltesek <mfaltesek@google.com>
---
 drivers/nfc/st21nfca/se.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nfc/st21nfca/se.c b/drivers/nfc/st21nfca/se.c
index c922f10d0d7b..9a37de60f73f 100644
--- a/drivers/nfc/st21nfca/se.c
+++ b/drivers/nfc/st21nfca/se.c
@@ -307,7 +307,7 @@ int st21nfca_connectivity_event_received(struct nfc_hci_dev *hdev, u8 host,
 		 * AID		81	5 to 16
 		 * PARAMETERS	82	0 to 255
 		 */
-		if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
+		if (skb->len < NFC_MIN_AID_LENGTH + 2 ||
 		    skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
 			return -EPROTO;
 
-- 
2.35.1.1094.g7c7d902a7c-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/3] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION
  2022-04-01 18:09 [PATCH v2 1/3] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION Martin Faltesek
@ 2022-04-02  8:55 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-02  8:55 UTC (permalink / raw)
  To: Martin Faltesek, netdev, kuba, christophe.ricard, jordy
  Cc: sameo, wklin, groeck, mfaltesek, gregkh

On 01/04/2022 20:09, Martin Faltesek wrote:
> The first validation check for EVT_TRANSACTION has two different checks
> tied together with logical AND. One is a check for minimum packet length,
> and the other is for a valid aid_tag. If either condition is true (fails),
> then an error should be triggered.  The fix is to change && to ||.
> 
> Fixes: 26fc6c7f02cb ("NFC: st21nfca: Add HCI transaction event support")
> Signed-off-by: Martin Faltesek <mfaltesek@google.com>
> ---
>  drivers/nfc/st21nfca/se.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-02  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-01 18:09 [PATCH v2 1/3] nfc: st21nfca: fix incorrect validating logic in EVT_TRANSACTION Martin Faltesek
2022-04-02  8:55 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).