From: Krzysztof Halasa <khc@pm.waw.pl>
To: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH] NET: fix kernel panic from no dev->hard_header_len space
Date: Thu, 27 Jul 2006 19:28:03 +0200 [thread overview]
Message-ID: <m3ac6vx8ik.fsf@defiant.localdomain> (raw)
In-Reply-To: <20060727164334.GA2779@ms2.inr.ac.ru> (Alexey Kuznetsov's message of "Thu, 27 Jul 2006 20:43:34 +0400")
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> writes:
> ip_output() worries about the space, which it needs.
Well, I wrote ip_output() to give idea about the place but the
actual function, as shown in the patch, is ip_finish_output2().
It currently reads:
int hh_len = LL_RESERVED_SPACE(dev);
/* Be paranoid, rather than too clever. */
if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
struct sk_buff *skb2;
skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));
if (skb2 == NULL) {
kfree_skb(skb);
return -ENOMEM;
}
if (skb->sk)
skb_set_owner_w(skb2, skb->sk);
kfree_skb(skb);
skb = skb2;
}
while
#define LL_RESERVED_SPACE(dev) \
(((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
so IMHO the above code fragment deals with device needs.
> If some place needs more, it is its problem to check.
> To the moment where it is used, hard_header_len can even change.
>
> It can be applied, but it does not change the fact, that those
> placed which fail now must check the condition as well.
Are you sure about that? It would mean almost devices, including
Ethernet, are at risk:
void ether_setup(struct net_device *dev)
{
dev->change_mtu = eth_change_mtu;
dev->hard_header = eth_header;
...
int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type,
void *daddr, void *saddr, unsigned len)
{
struct ethhdr *eth = (struct ethhdr *)skb_push(skb,ETH_HLEN);
>> A similar problem may be present in psched_mtu().
>
> Nothing similar. The result psched_mtu() is compared with skb->len,
> how it is seen by qdiscs. If hard_header is NULL, it sees skbs
> without header.
Right, by "similar problem" I meant ignoring hard_header_len and not
kernel panic.
--
Krzysztof Halasa
next prev parent reply other threads:[~2006-07-27 17:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-27 13:56 [PATCH] NET: fix kernel panic from no dev->hard_header_len space Krzysztof Halasa
2006-07-27 16:43 ` Alexey Kuznetsov
2006-07-27 17:28 ` Krzysztof Halasa [this message]
2006-07-28 14:11 ` Krzysztof Halasa
2006-07-30 16:40 ` Krzysztof Halasa
2006-07-30 22:30 ` David Miller
2006-07-31 15:39 ` Alexey Kuznetsov
[not found] ` <m3r701zgku.fsf@defiant.localdomain>
2006-07-31 20:23 ` David Miller
2006-08-01 1:04 ` Krzysztof Halasa
2006-08-01 1:13 ` David Miller
2006-08-01 1:56 ` Krzysztof Halasa
2006-08-01 19:54 ` Alexey Kuznetsov
2006-08-02 0:24 ` Krzysztof Halasa
2006-08-02 0:38 ` David Miller
2006-08-02 21:11 ` Krzysztof Halasa
2006-07-31 20:24 ` David Miller
2006-08-01 20:25 ` Alexey Kuznetsov
2006-08-02 0:42 ` Krzysztof Halasa
2006-08-02 0:48 ` David Miller
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=m3ac6vx8ik.fsf@defiant.localdomain \
--to=khc@pm.waw.pl \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--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