Skip to content

Commit

Permalink
34.0.1.EL
Browse files Browse the repository at this point in the history
  • Loading branch information
rhkernel committed Jan 27, 2011
1 parent 6a9f0c7 commit 52b86e8
Show file tree
Hide file tree
Showing 26 changed files with 129 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.9-prep
# Sun Jan 23 12:43:24 2011
# Sun Jan 23 12:41:46 2011
#
CONFIG_X86_64=y
CONFIG_64BIT=y
Expand Down
15 changes: 11 additions & 4 deletions arch/x86_64/kernel/signal.c
Expand Up @@ -29,6 +29,7 @@
#include <asm/uaccess.h>
#include <asm/i387.h>
#include <asm/proto.h>
#include <asm/vsyscall.h>

/* #define DEBUG_SIG 1 */

Expand Down Expand Up @@ -99,8 +100,12 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned

#define COPY(x) err |= __get_user(regs->x, &sc->x)

COPY(rdi); COPY(rsi); COPY(rbp); COPY(rsp); COPY(rbx);
COPY(rdx); COPY(rcx); COPY(rip);
COPY(rdi); COPY(rsi); COPY(rbp); COPY(rsp);
if (unlikely(regs->rsp >= TASK_SIZE))
regs->rsp = 0UL;
COPY(rbx); COPY(rdx); COPY(rcx); COPY(rip);
if (unlikely(regs->rip >= TASK_SIZE && regs->rip < VSYSCALL_START))
regs->rip = 0UL;
COPY(r8);
COPY(r9);
COPY(r10);
Expand Down Expand Up @@ -325,9 +330,11 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
next argument after the signal number on the stack. */
regs->rsi = (unsigned long)&frame->info;
regs->rdx = (unsigned long)&frame->uc;
regs->rip = (unsigned long) ka->sa.sa_handler;

regs->rsp = (unsigned long)frame;
if (unlikely((unsigned long)ka->sa.sa_handler >= TASK_SIZE))
regs->rip = 0UL;
else
regs->rip = (unsigned long)ka->sa.sa_handler;

set_fs(USER_DS);
if (regs->eflags & TF_MASK) {
Expand Down
2 changes: 1 addition & 1 deletion configs/kernel-2.6.9-x86_64-largesmp.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.9-prep
# Sun Jan 23 12:43:24 2011
# Sun Jan 23 12:41:46 2011
#
CONFIG_X86_64=y
CONFIG_64BIT=y
Expand Down
2 changes: 1 addition & 1 deletion configs/kernel-2.6.9-x86_64-smp.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.9-prep
# Sun Jan 23 12:43:24 2011
# Sun Jan 23 12:41:46 2011
#
CONFIG_X86_64=y
CONFIG_64BIT=y
Expand Down
2 changes: 1 addition & 1 deletion configs/kernel-2.6.9-x86_64.config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.9-prep
# Sun Jan 23 12:43:24 2011
# Sun Jan 23 12:41:46 2011
#
CONFIG_X86_64=y
CONFIG_64BIT=y
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/sg.c
Expand Up @@ -1734,7 +1734,7 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages,
up_read(&current->mm->mmap_sem);

/* Errors and no page mapped should return here */
if (res < nr_pages)
if ((res < 0) || (res < nr_pages))
goto out_unmap;

for (i=0; i < nr_pages; i++) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/st.c
Expand Up @@ -4312,7 +4312,7 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
up_read(&current->mm->mmap_sem);

/* Errors and no page mapped should return here */
if (res < nr_pages)
if ((res < 0) || (res < nr_pages))
goto out_unmap;

for (i=0; i < nr_pages; i++) {
Expand Down
17 changes: 11 additions & 6 deletions fs/binfmt_elf.c
Expand Up @@ -81,7 +81,7 @@ static struct linux_binfmt elf_format = {
.min_coredump = ELF_EXEC_PAGESIZE
};

#define BAD_ADDR(x) ((unsigned long)(x) > TASK_SIZE)
#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)

static int set_brk(unsigned long start, unsigned long end)
{
Expand Down Expand Up @@ -409,7 +409,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
* <= p_memsize so it is only necessary to check p_memsz.
*/
k = load_addr + eppnt->p_vaddr;
if (k > TASK_SIZE || eppnt->p_filesz > eppnt->p_memsz ||
if (BAD_ADDR(k) || eppnt->p_filesz > eppnt->p_memsz ||
eppnt->p_memsz > TASK_SIZE || TASK_SIZE - eppnt->p_memsz < k) {
error = -ENOMEM;
goto out_close;
Expand Down Expand Up @@ -885,7 +885,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
* allowed task size. Note that p_filesz must always be
* <= p_memsz so it is only necessary to check p_memsz.
*/
if (k > TASK_SIZE || elf_ppnt->p_filesz > elf_ppnt->p_memsz ||
if (BAD_ADDR(k) || elf_ppnt->p_filesz > elf_ppnt->p_memsz ||
elf_ppnt->p_memsz > TASK_SIZE ||
TASK_SIZE - elf_ppnt->p_memsz < k) {
/* set_brk can never work. Avoid overflows. */
Expand Down Expand Up @@ -936,9 +936,9 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
&interp_load_addr,
load_bias);
if (BAD_ADDR(elf_entry)) {
printk(KERN_ERR "Unable to load interpreter\n");
send_sig(SIGSEGV, current, 0);
retval = -ENOEXEC; /* Nobody gets to see this, but.. */
force_sig(SIGSEGV, current);
retval = IS_ERR((void *)elf_entry) ?
(int)elf_entry : -EINVAL;
goto out_free_dentry;
}
reloc_func_desc = interp_load_addr;
Expand All @@ -948,6 +948,11 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
kfree(elf_interpreter);
} else {
elf_entry = loc->elf_ex.e_entry;
if (BAD_ADDR(elf_entry)) {
force_sig(SIGSEGV, current);
retval = -EINVAL;
goto out_free_dentry;
}
}

kfree(elf_phdata);
Expand Down
4 changes: 4 additions & 0 deletions fs/compat.c
Expand Up @@ -1213,6 +1213,10 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
if (ret)
goto out;

ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE);
if (ret)
goto out;

fnv = NULL;
if (type == READ) {
fn = file->f_op->read;
Expand Down
10 changes: 10 additions & 0 deletions fs/nfs/direct.c
Expand Up @@ -57,6 +57,7 @@

#define NFSDBG_FACILITY NFSDBG_VFS

static void nfs_free_user_pages(struct page **pages, int npages, int do_dirty);
static kmem_cache_t *nfs_direct_cachep;

/*
Expand Down Expand Up @@ -121,6 +122,15 @@ static inline int nfs_get_user_pages(int rw, unsigned long user_addr, size_t siz
page_count, (rw == READ), 0,
*pages, NULL);
up_read(&current->mm->mmap_sem);
/*
* If we got fewer pages than expected from get_user_pages(),
* the user buffer runs off the end of a mapping; return EFAULT.
*/
if (result >= 0 && result < page_count) {
nfs_free_user_pages(*pages, result, 0);
*pages = NULL;
result = -EFAULT;
}
}
return result;
}
Expand Down
7 changes: 2 additions & 5 deletions fs/proc/task_mmu.c
Expand Up @@ -55,9 +55,6 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,

static int show_map(struct seq_file *m, void *v)
{
#ifdef __i386__
struct task_struct *task = m->private;
#endif
struct vm_area_struct *map = v;
struct file *file = map->vm_file;
int flags = map->vm_flags;
Expand All @@ -78,8 +75,8 @@ static int show_map(struct seq_file *m, void *v)
flags & VM_WRITE ? 'w' : '-',
(flags & VM_EXEC
#ifdef __i386__
|| (!nx_enabled &&
(map->vm_start < task->mm->context.exec_limit))
|| (!nx_enabled && map->vm_mm &&
(map->vm_start < map->vm_mm->context.exec_limit))
#endif
)
? 'x' : '-',
Expand Down
4 changes: 4 additions & 0 deletions fs/read_write.c
Expand Up @@ -455,6 +455,10 @@ static ssize_t do_readv_writev(int type, struct file *file,
if (ret)
goto out;

ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE);
if (ret)
goto out;

fnv = NULL;
if (type == READ) {
fn = file->f_op->read;
Expand Down
5 changes: 5 additions & 0 deletions fs/smbfs/dir.c
Expand Up @@ -431,6 +431,11 @@ smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
if (dentry->d_name.len > SMB_MAXNAMELEN)
goto out;

/* Do not allow lookup of names with backslashes in them */
error = -EINVAL;
if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
goto out;

lock_kernel();
error = smb_proc_getattr(dentry, &finfo);
#ifdef SMBFS_PARANOIA
Expand Down
2 changes: 1 addition & 1 deletion include/linux/autoconf.h
@@ -1,7 +1,7 @@
/*
* Automatically generated C config: don't edit
* Linux kernel version: 2.6.9-prep
* Sun Jan 23 12:43:24 2011
* Sun Jan 23 12:41:46 2011
*/
#define AUTOCONF_INCLUDED
#define CONFIG_X86_64 1
Expand Down
2 changes: 0 additions & 2 deletions kernel/exit.c
Expand Up @@ -522,8 +522,6 @@ static inline void choose_new_parent(task_t *p, task_t *reaper, task_t *child_re
*/
BUG_ON(p == reaper || reaper->state >= EXIT_ZOMBIE || reaper->exit_state >= EXIT_ZOMBIE);
p->real_parent = reaper;
if (p->parent == p->real_parent)
BUG();
}

static inline void reparent_thread(task_t *p, task_t *father, int traced)
Expand Down
6 changes: 4 additions & 2 deletions net/bridge/br_input.c
Expand Up @@ -54,6 +54,9 @@ int br_handle_frame_finish(struct sk_buff *skb)
struct net_bridge_fdb_entry *dst;
int passedup = 0;

/* insert into forwarding database after filtering to avoid spoofing */
br_fdb_insert(p->br, p, eth_hdr(skb)->h_source, 0);

if (br->dev->flags & IFF_PROMISC) {
struct sk_buff *skb2;

Expand Down Expand Up @@ -108,8 +111,7 @@ int br_handle_frame(struct net_bridge_port *p, struct sk_buff **pskb)
if (eth_hdr(skb)->h_source[0] & 1)
goto err;

if (p->state == BR_STATE_LEARNING ||
p->state == BR_STATE_FORWARDING)
if (p->state == BR_STATE_LEARNING)
br_fdb_insert(p->br, p, eth_hdr(skb)->h_source, 0);

if (p->br->stp_enabled &&
Expand Down
3 changes: 3 additions & 0 deletions net/bridge/br_stp_bpdu.c
Expand Up @@ -140,6 +140,9 @@ int br_stp_handle_bpdu(struct sk_buff *skb)
struct net_bridge *br = p->br;
unsigned char *buf;

/* insert into forwarding database after filtering to avoid spoofing */
br_fdb_insert(p->br, p, eth_hdr(skb)->h_source, 0);

/* need at least the 802 and STP headers */
if (!pskb_may_pull(skb, sizeof(header)+1) ||
memcmp(skb->data, header, sizeof(header)))
Expand Down
11 changes: 7 additions & 4 deletions net/ipv4/netfilter/ip_conntrack_proto_sctp.c
Expand Up @@ -235,12 +235,15 @@ static int do_basic_checks(struct ip_conntrack *conntrack,
flag = 1;
}

/* Cookie Ack/Echo chunks not the first OR
Init / Init Ack / Shutdown compl chunks not the only chunks */
if ((sch->type == SCTP_CID_COOKIE_ACK
/*
* Cookie Ack/Echo chunks not the first OR
* Init / Init Ack / Shutdown compl chunks not the only chunks
* OR zero-length.
*/
if (((sch->type == SCTP_CID_COOKIE_ACK
|| sch->type == SCTP_CID_COOKIE_ECHO
|| flag)
&& count !=0 ) {
&& count !=0) || !sch->length) {
DEBUGP("Basic checks failed\n");
return 1;
}
Expand Down
5 changes: 4 additions & 1 deletion net/ipv4/route.c
Expand Up @@ -2351,7 +2351,10 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
/* Reserve room for dummy headers, this skb can pass
through good chunk of routing engine.
*/
skb->mac.raw = skb->data;
skb->mac.raw = skb->nh.raw = skb->data;

/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
skb->nh.iph->protocol = IPPROTO_ICMP;
skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));

if (rta[RTA_SRC - 1])
Expand Down
4 changes: 3 additions & 1 deletion net/ipv6/udp.c
Expand Up @@ -98,14 +98,16 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum)
next:;
}
result = best;
for(;; result += UDP_HTABLE_SIZE) {
for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) {
if (result > sysctl_local_port_range[1])
result = sysctl_local_port_range[0]
+ ((result - sysctl_local_port_range[0]) &
(UDP_HTABLE_SIZE - 1));
if (!udp_lport_inuse(result))
break;
}
if (i >= (1 << 16) / UDP_HTABLE_SIZE)
goto fail;
gotit:
udp_port_rover = snum = result;
} else {
Expand Down
13 changes: 8 additions & 5 deletions net/sctp/sm_statefuns.c
Expand Up @@ -547,8 +547,9 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep,
*/
chunk->subh.cookie_hdr =
(struct sctp_signed_cookie *)chunk->skb->data;
skb_pull(chunk->skb,
ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t));
if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)))
goto nomem;

/* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint
* "Z" will reply with a COOKIE ACK chunk after building a TCB
Expand Down Expand Up @@ -836,7 +837,8 @@ sctp_disposition_t sctp_sf_beat_8_3(const struct sctp_endpoint *ep,
*/
chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data;
paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t);
skb_pull(chunk->skb, paylen);
if (!pskb_pull(chunk->skb, paylen))
goto nomem;

reply = sctp_make_heartbeat_ack(asoc, chunk,
chunk->subh.hb_hdr, paylen);
Expand Down Expand Up @@ -1663,8 +1665,9 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(const struct sctp_endpoint *ep,
* are in good shape.
*/
chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data;
skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t));
if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) -
sizeof(sctp_chunkhdr_t)))
goto nomem;

/* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie
* of a duplicate COOKIE ECHO match the Verification Tags of the
Expand Down
10 changes: 5 additions & 5 deletions net/sctp/sm_statetable.c
Expand Up @@ -355,9 +355,9 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_EMPTY */ \
{.fn = sctp_sf_ootb, .name = "sctp_sf_ootb"}, \
/* SCTP_STATE_CLOSED */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
{.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
/* SCTP_STATE_COOKIE_WAIT */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
{.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
/* SCTP_STATE_COOKIE_ECHOED */ \
{.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
/* SCTP_STATE_ESTABLISHED */ \
Expand All @@ -369,7 +369,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{.fn = sctp_sf_do_ecne, .name = "sctp_sf_do_ecne"}, \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
{.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
} /* TYPE_SCTP_ECN_ECNE */

#define TYPE_SCTP_ECN_CWR { \
Expand All @@ -390,7 +390,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type,
/* SCTP_STATE_SHUTDOWN_RECEIVED */ \
{.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
/* SCTP_STATE_SHUTDOWN_ACK_SENT */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
{.fn = sctp_sf_discard_chunk, .name = "sctp_sf_discard_chunk"}, \
} /* TYPE_SCTP_ECN_CWR */

#define TYPE_SCTP_SHUTDOWN_COMPLETE { \
Expand Down Expand Up @@ -636,7 +636,7 @@ chunk_event_table_unknown[SCTP_STATE_NUM_STATES] = {
/* SCTP_STATE_EMPTY */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
/* SCTP_STATE_CLOSED */ \
{.fn = sctp_sf_bug, .name = "sctp_sf_bug"}, \
{.fn = sctp_sf_error_closed, .name = "sctp_sf_error_closed"}, \
/* SCTP_STATE_COOKIE_WAIT */ \
{.fn = sctp_sf_do_prm_requestheartbeat, \
.name = "sctp_sf_do_prm_requestheartbeat"}, \
Expand Down

0 comments on commit 52b86e8

Please sign in to comment.