Skip to content

Commit

Permalink
Phonet: Correct header retrieval after pskb_may_pull
Browse files Browse the repository at this point in the history
Retrieve the header after doing pskb_may_pull since, pskb_may_pull
could change the buffer structure.

This is based on the comment given by Eric Dumazet on Phonet
Pipe controller patch for a similar problem.

Signed-off-by: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kumar Sanghvi authored and David S. Miller committed Sep 30, 2010
1 parent 9337057 commit a91e7d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/phonet/pep.c
Original file line number Diff line number Diff line change
@@ -225,12 +225,13 @@ static void pipe_grant_credits(struct sock *sk)
static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
{
struct pep_sock *pn = pep_sk(sk);
struct pnpipehdr *hdr = pnp_hdr(skb);
struct pnpipehdr *hdr;
int wake = 0;

if (!pskb_may_pull(skb, sizeof(*hdr) + 4))
return -EINVAL;

hdr = pnp_hdr(skb);
if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n",
(unsigned)hdr->data[0]);

0 comments on commit a91e7d4

Please sign in to comment.