lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 29 Jan 2015 01:50:46 +0200
From:	Robert Dolca <robert.dolca@...el.com>
To:	linux-nfc@...ts.01.org,
	Lauro Ramos Venancio <lauro.venancio@...nbossa.org>,
	Aloisio Almeida Jr <aloisio.almeida@...nbossa.org>,
	Samuel Ortiz <sameo@...ux.intel.com>
Cc:	linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
	netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
	Berg Johannes <johannes.berg@...el.com>,
	Clement Perrochaud <clement.perrochaud@....com>,
	Robert Dolca <robert.dolca@...el.com>
Subject: [RFC] NFC: PN544: Supply the right length to skb_trim

The 2nd parameter of skb_trim is the new length of the skb.

pn544_hci_i2c_remove_len_crc used the tailroom for the 2nd parameter so
the new length was 2 no metter how big the skb was.
Now the length is (skb->len - PN544_I2C_FRAME_TAILROOM)

Signed-off-by: Robert Dolca <robert.dolca@...el.com>
---
 drivers/nfc/pn544/i2c.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
index 58b9029..42e7b26 100644
--- a/drivers/nfc/pn544/i2c.c
+++ b/drivers/nfc/pn544/i2c.c
@@ -297,7 +297,7 @@ static void pn544_hci_i2c_add_len_crc(struct sk_buff *skb)
 static void pn544_hci_i2c_remove_len_crc(struct sk_buff *skb)
 {
 	skb_pull(skb, PN544_I2C_FRAME_HEADROOM);
-	skb_trim(skb, PN544_I2C_FRAME_TAILROOM);
+	skb_trim(skb, skb->len - PN544_I2C_FRAME_TAILROOM);
 }
 
 /*
@@ -411,8 +411,7 @@ static int pn544_hci_i2c_read(struct pn544_i2c_phy *phy, struct sk_buff **skb)
 		goto flush;
 	}
 
-	skb_pull(*skb, 1);
-	skb_trim(*skb, (*skb)->len - 2);
+	pn544_hci_i2c_remove_len_crc(*skb);
 
 	usleep_range(3000, 6000);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ