Skip to content

Commit 2556c3e

Browse files
Kumar Sanghvigregkh
authored andcommitted
Phonet: Correct header retrieval after pskb_may_pull
[ Upstream commit a91e7d4 ] 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: Greg Kroah-Hartman <gregkh@suse.de>
1 parent f38eaf1 commit 2556c3e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/phonet/pep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ static void pipe_grant_credits(struct sock *sk)
225225
static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
226226
{
227227
struct pep_sock *pn = pep_sk(sk);
228-
struct pnpipehdr *hdr = pnp_hdr(skb);
228+
struct pnpipehdr *hdr;
229229
int wake = 0;
230230

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

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

0 commit comments

Comments
 (0)