From: Joonwoo Park <joonwpark81@gmail.com>
To: Jim Westfall <jwestfall@surrealistic.net>
Cc: netdev@vger.kernel.org, acme@ghostprotocols.net,
David Miller <davem@davemloft.net>
Subject: Re: [PATCH] llc: fix skb size for test responses
Date: Tue, 26 Feb 2008 16:00:25 +0900 [thread overview]
Message-ID: <20080226070025.GA24954@ehus.geninetworks.com> (raw)
In-Reply-To: <20080224190758.GW84358@surrealistic.net>
On Sun, Feb 24, 2008 at 11:07:58AM -0800, Jim Westfall wrote:
> Hi
>
> The llc test command is used for a layer2 ping and contains a variable
> length payload that we must include in the response. Use the size of the
> received skb as the size of the skb we must allocate to hold the payload.
>
> This resolved an skb_over_panic(), when trying to copy the payload into
> what was a hard coded skb of size 128.
>
> Signed-off-by: Jim Westfall <jwestfall@surrealistic.net>
>
> diff -urp linux-2.6.24.2.org/net/llc/llc_s_ac.c linux-2.6.24.2/net/llc/llc_s_ac.c
> --- linux-2.6.24.2.org/net/llc/llc_s_ac.c 2008-02-10 21:51:11.000000000 -0800
> +++ linux-2.6.24.2/net/llc/llc_s_ac.c 2008-02-24 10:15:02.000000000 -0800
> @@ -148,9 +148,18 @@ int llc_sap_action_send_test_r(struct ll
> llc_pdu_decode_sa(skb, mac_da);
> llc_pdu_decode_da(skb, mac_sa);
> llc_pdu_decode_ssap(skb, &dsap);
> - nskb = llc_alloc_frame(NULL, skb->dev);
> + nskb = alloc_skb(skb->end - skb->head, GFP_ATOMIC);
Jim,
Not enough.
Because of 'skb_reserve(nskb, 50)', we need additional 50bytes.
> +
> if (!nskb)
> goto out;
> +
> + skb_reset_mac_header(nskb);
> + skb_reserve(nskb, 50);
> + skb_reset_network_header(nskb);
> + skb_reset_transport_header(nskb);
> + nskb->protocol = htons(ETH_P_802_2);
> + nskb->dev = skb->dev;
> +
> llc_pdu_header_init(nskb, LLC_PDU_TYPE_U, sap->laddr.lsap, dsap,
> LLC_PDU_RSP);
> llc_pdu_init_as_test_rsp(nskb, skb);
> diff -urp linux-2.6.24.2.org/net/llc/llc_station.c linux-2.6.24.2/net/llc/llc_station.c
> --- linux-2.6.24.2.org/net/llc/llc_station.c 2008-02-10 21:51:11.000000000 -0800
> +++ linux-2.6.24.2/net/llc/llc_station.c 2008-02-24 10:10:01.000000000 -0800
> @@ -298,10 +298,18 @@ static int llc_station_ac_send_test_r(st
> {
> u8 mac_da[ETH_ALEN], dsap;
> int rc = 1;
> - struct sk_buff *nskb = llc_alloc_frame(NULL, skb->dev);
> + struct sk_buff *nskb = alloc_skb(skb->end - skb->head, GFP_ATOMIC);
Also here.
>
> if (!nskb)
> goto out;
> +
> + skb_reset_mac_header(nskb);
> + skb_reserve(nskb, 50);
> + skb_reset_network_header(nskb);
> + skb_reset_transport_header(nskb);
> + nskb->protocol = htons(ETH_P_802_2);
> + nskb->dev = skb->dev;
> +
> rc = 0;
> llc_pdu_decode_sa(skb, mac_da);
> llc_pdu_decode_ssap(skb, &dsap);
>
Thanks,
Joonwoo
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-02-26 7:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-24 19:07 [PATCH] llc: fix skb size for test responses Jim Westfall
2008-02-25 2:51 ` David Miller
2008-02-25 5:04 ` Jim Westfall
2008-02-25 8:30 ` Joonwoo Park
2008-02-25 14:06 ` Arnaldo Carvalho de Melo
2008-02-25 19:47 ` David Miller
2008-02-26 7:00 ` Joonwoo Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080226070025.GA24954@ehus.geninetworks.com \
--to=joonwpark81@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=davem@davemloft.net \
--cc=jwestfall@surrealistic.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).