From patchwork Tue Sep 28 09:10:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kumar A Sanghvi X-Patchwork-Id: 65944 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0E61AB6EE9 for ; Tue, 28 Sep 2010 19:11:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753807Ab0I1JLC (ORCPT ); Tue, 28 Sep 2010 05:11:02 -0400 Received: from eu1sys200aog106.obsmtp.com ([207.126.144.121]:37093 "EHLO eu1sys200aog106.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753214Ab0I1JLA (ORCPT ); Tue, 28 Sep 2010 05:11:00 -0400 Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob106.postini.com ([207.126.147.11]) with SMTP ID DSNKTKGxHAOqrybNXq47TDIZDbhBz+8nk0pX@postini.com; Tue, 28 Sep 2010 09:11:00 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A222A127; Tue, 28 Sep 2010 09:10:47 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B1B44443; Tue, 28 Sep 2010 09:10:46 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 4A066A8096; Tue, 28 Sep 2010 11:10:41 +0200 (CEST) Received: from localhost (10.201.54.119) by exdcvycastm022.EQ1STM.local (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.1.393.1; Tue, 28 Sep 2010 11:10:45 +0200 From: Kumar A Sanghvi To: , , , Cc: , Kumar Sanghvi , Linus Walleij Subject: [PATCH] Phonet: Correct header retrieval after pskb_may_pull Date: Tue, 28 Sep 2010 14:40:42 +0530 Message-ID: <1285665042-20548-1-git-send-email-kumar.sanghvi@stericsson.com> X-Mailer: git-send-email 1.7.2.dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Kumar Sanghvi 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 Acked-by: Linus Walleij Acked-by: Eric Dumazet Acked-by: RĂ©mi Denis-Courmont --- 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 7bf23cf..9746c6d 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -507,12 +507,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]);