linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1 0/1] net: cdc_ncm: Fix TX zero padding
@ 2017-05-04 19:41 Jim Baxter
  2017-05-04 19:41 ` [PATCH V1 1/1] " Jim Baxter
  0 siblings, 1 reply; 6+ messages in thread
From: Jim Baxter @ 2017-05-04 19:41 UTC (permalink / raw)
  To: linux-usb, linux-kernel, Oliver Neukum; +Cc: jim_baxter

Analysis
--------

The zero padding that is added to NTB's does not zero
the memory correctly.
This happens because the skb_put called within the memset in
the line:
memset(skb_put(skb_out, ctx->tx_max - skb_out->len),
       0, ctx->tx_max - skb_out->len);
causes the value of skb_out->len to be modified during
the two uses of it within the above line.
This causes non-zeroed data at the end of skb_out.

This issue was found when connecting between an ARM
Sabre SD Host platform and a test box that was
dropping the NDP's due to the non zeroed memory being
identified as an error.

Solution
--------

To resolve this I have cached the value of
ctx->tx_max - skb_out->len before the memset operation.

Jim Baxter (1):
  net: cdc_ncm: Fix TX zero padding

 drivers/net/usb/cdc_ncm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

-- 
1.9.1

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

end of thread, other threads:[~2017-05-08 12:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 19:41 [PATCH V1 0/1] net: cdc_ncm: Fix TX zero padding Jim Baxter
2017-05-04 19:41 ` [PATCH V1 1/1] " Jim Baxter
2017-05-04 21:01   ` Bjørn Mork
2017-05-08 10:49     ` Baxter, Jim
2017-05-08 11:08       ` Bjørn Mork
2017-05-08 12:02         ` Baxter, Jim

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).