Phonet: fix aligned-mode pipe socket buffer header reserve
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Tue, 15 Mar 2011 21:55:49 +0000 (14:55 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 15 Mar 2011 21:55:49 +0000 (14:55 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/phonet/pep.c

index 68e635f11de8958f08f46909fab96bbc0ea4d004..f17fd841f9487d944adcab970e3ff238ea2c9287 100644 (file)
@@ -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;