Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224493
b: refs/heads/master
c: bba14de
h: refs/heads/master
i:
  224491: 7d12758
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Nov 24, 2010
1 parent c87a266 commit 201e820
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 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: 456b61bca8ee324ab6c18b065e632c9a8c88aa39
refs/heads/master: bba14de98753cb6599a2dae0e520714b2153522d
5 changes: 3 additions & 2 deletions trunk/include/net/scm.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
/* Well, we should have at least one descriptor open
* to accept passed FDs 8)
*/
#define SCM_MAX_FD 255
#define SCM_MAX_FD 253

struct scm_fp_list {
struct list_head list;
int count;
short count;
short max;
struct file *fp[SCM_MAX_FD];
};

Expand Down
10 changes: 6 additions & 4 deletions trunk/net/core/scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp)
return -ENOMEM;
*fplp = fpl;
fpl->count = 0;
fpl->max = SCM_MAX_FD;
}
fpp = &fpl->fp[fpl->count];

if (fpl->count + num > SCM_MAX_FD)
if (fpl->count + num > fpl->max)
return -EINVAL;

/*
Expand Down Expand Up @@ -331,11 +332,12 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl)
if (!fpl)
return NULL;

new_fpl = kmalloc(sizeof(*fpl), GFP_KERNEL);
new_fpl = kmemdup(fpl, offsetof(struct scm_fp_list, fp[fpl->count]),
GFP_KERNEL);
if (new_fpl) {
for (i=fpl->count-1; i>=0; i--)
for (i = 0; i < fpl->count; i++)
get_file(fpl->fp[i]);
memcpy(new_fpl, fpl, sizeof(*fpl));
new_fpl->max = new_fpl->count;
}
return new_fpl;
}
Expand Down

0 comments on commit 201e820

Please sign in to comment.