lkml.org 
[lkml]   [2011]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[34-longterm 195/260] Phonet: Correct header retrieval after pskb_may_pull
    Date
    From: Kumar Sanghvi <kumar.sanghvi@stericsson.com>

    commit a91e7d471e2e384035b9746ea707ccdcd353f5dd upstream.

    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>
    Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
    ---
    net/phonet/pep.c | 3 ++-
    1 files changed, 2 insertions(+), 1 deletions(-)

    diff --git a/net/phonet/pep.c b/net/phonet/pep.c
    index e2a9576..dc1e8ae 100644
    --- a/net/phonet/pep.c
    +++ b/net/phonet/pep.c
    @@ -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]);
    --
    1.7.3.3
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-01-02 08:41    [W:0.021 / U:0.852 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site