nci_to_errno() returns negative errno values for nonzero data-status bytes. Passing that value to nci_add_rx_data_frag() through a __u8 parameter truncates the errno and changes it to an unrelated positive value before the completion callback receives it. Keep the error parameter as int so the original errno reaches the completion path unchanged. Fixes: 98ff416f97c5 ("NFC: nci: Add status byte management in case of error.") Cc: stable@vger.kernel.org Signed-off-by: Bin Luo (University of Electronic Science and Technology of China) --- v3: - Split the signed NCI status errno correction into a separate patch. net/nfc/nci/data.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c index 3bbebb950..4a2326a33 100644 --- a/net/nfc/nci/data.c +++ b/net/nfc/nci/data.c @@ -213,13 +213,11 @@ EXPORT_SYMBOL(nci_send_data); static void nci_add_rx_data_frag(struct nci_dev *ndev, struct sk_buff *skb, - __u8 pbf, __u8 conn_id, __u8 status) + __u8 pbf, __u8 conn_id, int err) { int reassembly_len; - int err = 0; - if (status) { - err = status; + if (err) { kfree_skb(ndev->rx_data_reassembly); ndev->rx_data_reassembly = NULL; goto exit;