Skip to content

Commit

Permalink
Phonet: fix aligned-mode pipe socket buffer header reserve
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rémi Denis-Courmont authored and David S. Miller committed Mar 15, 2011
1 parent bfd823b commit 638be34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/phonet/pep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 638be34

Please sign in to comment.