Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19822
b: refs/heads/master
c: ad2ad0f
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Feb 5, 2006
1 parent 8e8407f commit 4cb7ce2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c2db292438c20c3f13db6e5563e0ce5b449bedac
refs/heads/master: ad2ad0f96546d6d56b2665bcc863c33ae57c49c4
8 changes: 5 additions & 3 deletions trunk/net/bridge/netfilter/ebt_ulog.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ static void ulog_timer(unsigned long data)
static struct sk_buff *ulog_alloc_skb(unsigned int size)
{
struct sk_buff *skb;
unsigned int n;

skb = alloc_skb(nlbufsiz, GFP_ATOMIC);
n = max(size, nlbufsiz);
skb = alloc_skb(n, GFP_ATOMIC);
if (!skb) {
PRINTR(KERN_ERR "ebt_ulog: can't alloc whole buffer "
"of size %ub!\n", nlbufsiz);
if (size < nlbufsiz) {
"of size %ub!\n", n);
if (n > size) {
/* try to allocate only as much as we need for
* current packet */
skb = alloc_skb(size, GFP_ATOMIC);
Expand Down
20 changes: 12 additions & 8 deletions trunk/net/ipv4/netfilter/ipt_ULOG.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,26 @@ static void ulog_timer(unsigned long data)
static struct sk_buff *ulog_alloc_skb(unsigned int size)
{
struct sk_buff *skb;
unsigned int n;

/* alloc skb which should be big enough for a whole
* multipart message. WARNING: has to be <= 131000
* due to slab allocator restrictions */

skb = alloc_skb(nlbufsiz, GFP_ATOMIC);
n = max(size, nlbufsiz);
skb = alloc_skb(n, GFP_ATOMIC);
if (!skb) {
PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n",
nlbufsiz);
PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n", n);

/* try to allocate only as much as we need for
* current packet */
if (n > size) {
/* try to allocate only as much as we need for
* current packet */

skb = alloc_skb(size, GFP_ATOMIC);
if (!skb)
PRINTR("ipt_ULOG: can't even allocate %ub\n", size);
skb = alloc_skb(size, GFP_ATOMIC);
if (!skb)
PRINTR("ipt_ULOG: can't even allocate %ub\n",
size);
}
}

return skb;
Expand Down
18 changes: 11 additions & 7 deletions trunk/net/netfilter/nfnetlink_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,28 @@ static struct sk_buff *nfulnl_alloc_skb(unsigned int inst_size,
unsigned int pkt_size)
{
struct sk_buff *skb;
unsigned int n;

UDEBUG("entered (%u, %u)\n", inst_size, pkt_size);

/* alloc skb which should be big enough for a whole multipart
* message. WARNING: has to be <= 128k due to slab restrictions */

skb = alloc_skb(inst_size, GFP_ATOMIC);
n = max(inst_size, pkt_size);
skb = alloc_skb(n, GFP_ATOMIC);
if (!skb) {
PRINTR("nfnetlink_log: can't alloc whole buffer (%u bytes)\n",
inst_size);

/* try to allocate only as much as we need for current
* packet */
if (n > pkt_size) {
/* try to allocate only as much as we need for current
* packet */

skb = alloc_skb(pkt_size, GFP_ATOMIC);
if (!skb)
PRINTR("nfnetlink_log: can't even alloc %u bytes\n",
pkt_size);
skb = alloc_skb(pkt_size, GFP_ATOMIC);
if (!skb)
PRINTR("nfnetlink_log: can't even alloc %u "
"bytes\n", pkt_size);
}
}

return skb;
Expand Down

0 comments on commit 4cb7ce2

Please sign in to comment.