* [PATCH] Phonet: fix aligned-mode pipe socket buffer header reserve
@ 2011-03-15 8:37 Rémi Denis-Courmont
2011-03-15 21:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Rémi Denis-Courmont @ 2011-03-15 8:37 UTC (permalink / raw)
To: netdev
When the pipe uses aligned-mode data packets, we must reserve 4 bytes
instead of 3 for the pipe protocol header. Otherwise the Phonet header
would not be aligned, resulting in potentially corrupted headers with
later unaligned memory writes.
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
net/phonet/pep.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 68e635f..f17fd84 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -1055,7 +1055,7 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk,
if (!skb)
return err;
- skb_reserve(skb, MAX_PHONET_HEADER + 3);
+ skb_reserve(skb, MAX_PHONET_HEADER + 3 + pn->aligned);
err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len);
if (err < 0)
goto outfree;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-03-15 21:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15 8:37 [PATCH] Phonet: fix aligned-mode pipe socket buffer header reserve Rémi Denis-Courmont
2011-03-15 21:56 ` David Miller
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).