Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9be78f8658 | |||
| 59a79e934f | |||
| d6d47af4c9 | |||
| 9c053068c7 | |||
| 81ddd43976 | |||
| 504b891bc7 | |||
| 6829c71237 | |||
| 0098d9c5f8 | |||
| edf3b5b336 | |||
| 2498037d5a | |||
| 98debffa91 | |||
| 8cd943eb52 | |||
| 05dbb1e557 | |||
| 0721a681c6 | |||
| c255cda2af | |||
| cf43ea0341 | |||
| 76739be851 | |||
| e381a0a116 | |||
| a49567a4db | |||
| 2811d271ee | |||
| 5163b0a323 | |||
| 7a8ad840d8 | |||
| 6532533a28 |
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
||||
VERSION = 2
|
||||
PATCHLEVEL = 6
|
||||
SUBLEVEL = 13
|
||||
EXTRAVERSION =
|
||||
EXTRAVERSION = .2
|
||||
NAME=Woozy Numbat
|
||||
|
||||
# *DOCUMENTATION*
|
||||
|
||||
@ -165,7 +165,6 @@ static int __init pcibios_init(void)
|
||||
if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
|
||||
pcibios_sort();
|
||||
#endif
|
||||
pci_assign_unassigned_resources();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -170,43 +170,26 @@ static void __init pcibios_allocate_resources(int pass)
|
||||
static int __init pcibios_assign_resources(void)
|
||||
{
|
||||
struct pci_dev *dev = NULL;
|
||||
int idx;
|
||||
struct resource *r;
|
||||
struct resource *r, *pr;
|
||||
|
||||
for_each_pci_dev(dev) {
|
||||
int class = dev->class >> 8;
|
||||
|
||||
/* Don't touch classless devices and host bridges */
|
||||
if (!class || class == PCI_CLASS_BRIDGE_HOST)
|
||||
continue;
|
||||
|
||||
for(idx=0; idx<6; idx++) {
|
||||
r = &dev->resource[idx];
|
||||
|
||||
/*
|
||||
* Don't touch IDE controllers and I/O ports of video cards!
|
||||
*/
|
||||
if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) ||
|
||||
(class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO)))
|
||||
continue;
|
||||
|
||||
/*
|
||||
* We shall assign a new address to this resource, either because
|
||||
* the BIOS forgot to do so or because we have decided the old
|
||||
* address was unusable for some reason.
|
||||
*/
|
||||
if (!r->start && r->end)
|
||||
pci_assign_resource(dev, idx);
|
||||
}
|
||||
|
||||
if (pci_probe & PCI_ASSIGN_ROMS) {
|
||||
if (!(pci_probe & PCI_ASSIGN_ROMS)) {
|
||||
/* Try to use BIOS settings for ROMs, otherwise let
|
||||
pci_assign_unassigned_resources() allocate the new
|
||||
addresses. */
|
||||
for_each_pci_dev(dev) {
|
||||
r = &dev->resource[PCI_ROM_RESOURCE];
|
||||
r->end -= r->start;
|
||||
r->start = 0;
|
||||
if (r->end)
|
||||
pci_assign_resource(dev, PCI_ROM_RESOURCE);
|
||||
if (!r->flags || !r->start)
|
||||
continue;
|
||||
pr = pci_find_parent_resource(dev, r);
|
||||
if (!pr || request_resource(pr, r) < 0) {
|
||||
r->end -= r->start;
|
||||
r->start = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pci_assign_unassigned_resources();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -24,17 +24,26 @@
|
||||
static int tiocgdev(unsigned fd, unsigned cmd, unsigned int __user *ptr)
|
||||
{
|
||||
|
||||
struct file *file = fget(fd);
|
||||
struct file *file;
|
||||
struct tty_struct *real_tty;
|
||||
int fput_needed, ret;
|
||||
|
||||
file = fget_light(fd, &fput_needed);
|
||||
if (!file)
|
||||
return -EBADF;
|
||||
|
||||
ret = -EINVAL;
|
||||
if (file->f_op->ioctl != tty_ioctl)
|
||||
return -EINVAL;
|
||||
goto out;
|
||||
real_tty = (struct tty_struct *)file->private_data;
|
||||
if (!real_tty)
|
||||
return -EINVAL;
|
||||
return put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
|
||||
goto out;
|
||||
|
||||
ret = put_user(new_encode_dev(tty_devnum(real_tty)), ptr);
|
||||
|
||||
out:
|
||||
fput_light(file, fput_needed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */
|
||||
|
||||
@ -191,6 +191,8 @@ static unsigned int cbc_process_encrypt(const struct cipher_desc *desc,
|
||||
u8 *iv = desc->info;
|
||||
unsigned int done = 0;
|
||||
|
||||
nbytes -= bsize;
|
||||
|
||||
do {
|
||||
xor(iv, src);
|
||||
fn(crypto_tfm_ctx(tfm), dst, iv);
|
||||
@ -198,7 +200,7 @@ static unsigned int cbc_process_encrypt(const struct cipher_desc *desc,
|
||||
|
||||
src += bsize;
|
||||
dst += bsize;
|
||||
} while ((done += bsize) < nbytes);
|
||||
} while ((done += bsize) <= nbytes);
|
||||
|
||||
return done;
|
||||
}
|
||||
@ -219,6 +221,8 @@ static unsigned int cbc_process_decrypt(const struct cipher_desc *desc,
|
||||
u8 *iv = desc->info;
|
||||
unsigned int done = 0;
|
||||
|
||||
nbytes -= bsize;
|
||||
|
||||
do {
|
||||
u8 *tmp_dst = *dst_p;
|
||||
|
||||
@ -230,7 +234,7 @@ static unsigned int cbc_process_decrypt(const struct cipher_desc *desc,
|
||||
|
||||
src += bsize;
|
||||
dst += bsize;
|
||||
} while ((done += bsize) < nbytes);
|
||||
} while ((done += bsize) <= nbytes);
|
||||
|
||||
return done;
|
||||
}
|
||||
@ -243,12 +247,14 @@ static unsigned int ecb_process(const struct cipher_desc *desc, u8 *dst,
|
||||
void (*fn)(void *, u8 *, const u8 *) = desc->crfn;
|
||||
unsigned int done = 0;
|
||||
|
||||
nbytes -= bsize;
|
||||
|
||||
do {
|
||||
fn(crypto_tfm_ctx(tfm), dst, src);
|
||||
|
||||
src += bsize;
|
||||
dst += bsize;
|
||||
} while ((done += bsize) < nbytes);
|
||||
} while ((done += bsize) <= nbytes);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
@ -938,10 +938,9 @@ found:
|
||||
|
||||
/*
|
||||
* XXX Interrupt pin #7 in Espresso is shared between RTC and
|
||||
* PCI Slot 2 INTA# (and some INTx# in Slot 1). SA_INTERRUPT here
|
||||
* is asking for trouble with add-on boards. Change to SA_SHIRQ.
|
||||
* PCI Slot 2 INTA# (and some INTx# in Slot 1).
|
||||
*/
|
||||
if (request_irq(rtc_irq, rtc_interrupt, SA_INTERRUPT, "rtc", (void *)&rtc_port)) {
|
||||
if (request_irq(rtc_irq, rtc_interrupt, SA_SHIRQ, "rtc", (void *)&rtc_port)) {
|
||||
/*
|
||||
* Standard way for sparc to print irq's is to use
|
||||
* __irq_itoa(). I think for EBus it's ok to use %d.
|
||||
|
||||
@ -608,7 +608,7 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
|
||||
|
||||
#ifdef __i386__
|
||||
if (dev->resource[PCI_ROM_RESOURCE].start) {
|
||||
pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
|
||||
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
|
||||
printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -173,7 +173,7 @@ static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const cha
|
||||
|
||||
if (cmd & PCI_COMMAND_MEMORY) {
|
||||
if (pci_resource_start(dev, PCI_ROM_RESOURCE)) {
|
||||
pci_write_config_byte(dev, PCI_ROM_ADDRESS,
|
||||
pci_write_config_dword(dev, PCI_ROM_ADDRESS,
|
||||
dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
|
||||
printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n",
|
||||
dev->resource[PCI_ROM_RESOURCE].start);
|
||||
|
||||
@ -1334,9 +1334,13 @@ static int __devinit init_hpt366(struct pci_dev *dev)
|
||||
static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name)
|
||||
{
|
||||
int ret = 0;
|
||||
/* FIXME: Not portable */
|
||||
|
||||
/*
|
||||
* FIXME: Not portable. Also, why do we enable the ROM in the first place?
|
||||
* We don't seem to be using it.
|
||||
*/
|
||||
if (dev->resource[PCI_ROM_RESOURCE].start)
|
||||
pci_write_config_byte(dev, PCI_ROM_ADDRESS,
|
||||
pci_write_config_dword(dev, PCI_ROM_ADDRESS,
|
||||
dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
|
||||
|
||||
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4));
|
||||
|
||||
@ -254,6 +254,7 @@ config VIDEO_SAA7134_DVB
|
||||
select VIDEO_BUF_DVB
|
||||
select DVB_MT352
|
||||
select DVB_CX22702
|
||||
select DVB_TDA1004X
|
||||
---help---
|
||||
This adds support for DVB cards based on the
|
||||
Philips saa7134 chip.
|
||||
|
||||
@ -1888,6 +1888,9 @@ static int nv_open(struct net_device *dev)
|
||||
writel(NVREG_MIISTAT_MASK, base + NvRegMIIStatus);
|
||||
dprintk(KERN_INFO "startup: got 0x%08x.\n", miistat);
|
||||
}
|
||||
/* set linkspeed to invalid value, thus force nv_update_linkspeed
|
||||
* to init hw */
|
||||
np->linkspeed = 0;
|
||||
ret = nv_update_linkspeed(dev);
|
||||
nv_start_rx(dev);
|
||||
nv_start_tx(dev);
|
||||
|
||||
@ -2816,7 +2816,7 @@ static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
|
||||
#if (!defined(__sparc__) && !defined(CONFIG_PPC_PMAC))
|
||||
/* Fetch MAC address from vital product data of PCI ROM. */
|
||||
static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
|
||||
static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char *dev_addr)
|
||||
{
|
||||
int this_offset;
|
||||
|
||||
@ -2837,35 +2837,27 @@ static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsigned char
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
dev_addr[i] = readb(p + i);
|
||||
break;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_gem_mac_nonobp(struct pci_dev *pdev, unsigned char *dev_addr)
|
||||
{
|
||||
u32 rom_reg_orig;
|
||||
void __iomem *p;
|
||||
size_t size;
|
||||
void __iomem *p = pci_map_rom(pdev, &size);
|
||||
|
||||
if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
|
||||
if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
|
||||
goto use_random;
|
||||
if (p) {
|
||||
int found;
|
||||
|
||||
found = readb(p) == 0x55 &&
|
||||
readb(p + 1) == 0xaa &&
|
||||
find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
|
||||
pci_unmap_rom(pdev, p);
|
||||
if (found)
|
||||
return;
|
||||
}
|
||||
|
||||
pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
|
||||
pci_write_config_dword(pdev, pdev->rom_base_reg,
|
||||
rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
|
||||
|
||||
p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
|
||||
if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
|
||||
find_eth_addr_in_vpd(p, (64 * 1024), dev_addr);
|
||||
|
||||
if (p != NULL)
|
||||
iounmap(p);
|
||||
|
||||
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
|
||||
return;
|
||||
|
||||
use_random:
|
||||
/* Sun MAC prefix then 3 random bytes. */
|
||||
dev_addr[0] = 0x08;
|
||||
dev_addr[1] = 0x00;
|
||||
|
||||
@ -2954,7 +2954,7 @@ static int is_quattro_p(struct pci_dev *pdev)
|
||||
}
|
||||
|
||||
/* Fetch MAC address from vital product data of PCI ROM. */
|
||||
static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
|
||||
static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
|
||||
{
|
||||
int this_offset;
|
||||
|
||||
@ -2977,42 +2977,33 @@ static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, uns
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
dev_addr[i] = readb(p + i);
|
||||
break;
|
||||
return 1;
|
||||
}
|
||||
index--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr)
|
||||
{
|
||||
u32 rom_reg_orig;
|
||||
void __iomem *p;
|
||||
int index;
|
||||
size_t size;
|
||||
void __iomem *p = pci_map_rom(pdev, &size);
|
||||
|
||||
index = 0;
|
||||
if (is_quattro_p(pdev))
|
||||
index = PCI_SLOT(pdev->devfn);
|
||||
if (p) {
|
||||
int index = 0;
|
||||
int found;
|
||||
|
||||
if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
|
||||
if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
|
||||
goto use_random;
|
||||
if (is_quattro_p(pdev))
|
||||
index = PCI_SLOT(pdev->devfn);
|
||||
|
||||
found = readb(p) == 0x55 &&
|
||||
readb(p + 1) == 0xaa &&
|
||||
find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
|
||||
pci_unmap_rom(pdev, p);
|
||||
if (found)
|
||||
return;
|
||||
}
|
||||
|
||||
pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
|
||||
pci_write_config_dword(pdev, pdev->rom_base_reg,
|
||||
rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
|
||||
|
||||
p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
|
||||
if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
|
||||
find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
|
||||
|
||||
if (p != NULL)
|
||||
iounmap(p);
|
||||
|
||||
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
|
||||
return;
|
||||
|
||||
use_random:
|
||||
/* Sun MAC prefix then 3 random bytes. */
|
||||
dev_addr[0] = 0x08;
|
||||
dev_addr[1] = 0x00;
|
||||
|
||||
@ -21,13 +21,21 @@
|
||||
* between the ROM and other resources, so enabling it may disable access
|
||||
* to MMIO registers or other card memory.
|
||||
*/
|
||||
static void pci_enable_rom(struct pci_dev *pdev)
|
||||
static int pci_enable_rom(struct pci_dev *pdev)
|
||||
{
|
||||
struct resource *res = pdev->resource + PCI_ROM_RESOURCE;
|
||||
struct pci_bus_region region;
|
||||
u32 rom_addr;
|
||||
|
||||
if (!res->flags)
|
||||
return -1;
|
||||
|
||||
pcibios_resource_to_bus(pdev, ®ion, res);
|
||||
pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_addr);
|
||||
rom_addr |= PCI_ROM_ADDRESS_ENABLE;
|
||||
rom_addr &= ~PCI_ROM_ADDRESS_MASK;
|
||||
rom_addr |= region.start | PCI_ROM_ADDRESS_ENABLE;
|
||||
pci_write_config_dword(pdev, pdev->rom_base_reg, rom_addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,19 +79,21 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
|
||||
} else {
|
||||
if (res->flags & IORESOURCE_ROM_COPY) {
|
||||
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
return (void __iomem *)pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
||||
return (void __iomem *)pci_resource_start(pdev,
|
||||
PCI_ROM_RESOURCE);
|
||||
} else {
|
||||
/* assign the ROM an address if it doesn't have one */
|
||||
if (res->parent == NULL)
|
||||
pci_assign_resource(pdev, PCI_ROM_RESOURCE);
|
||||
|
||||
if (res->parent == NULL &&
|
||||
pci_assign_resource(pdev,PCI_ROM_RESOURCE))
|
||||
return NULL;
|
||||
start = pci_resource_start(pdev, PCI_ROM_RESOURCE);
|
||||
*size = pci_resource_len(pdev, PCI_ROM_RESOURCE);
|
||||
if (*size == 0)
|
||||
return NULL;
|
||||
|
||||
/* Enable ROM space decodes */
|
||||
pci_enable_rom(pdev);
|
||||
if (pci_enable_rom(pdev))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
* FIXME: IO should be max 256 bytes. However, since we may
|
||||
* have a P2P bridge below a cardbus bridge, we need 4K.
|
||||
*/
|
||||
#define CARDBUS_IO_SIZE (256)
|
||||
#define CARDBUS_IO_SIZE (4*1024)
|
||||
#define CARDBUS_MEM_SIZE (32*1024*1024)
|
||||
|
||||
static void __devinit
|
||||
|
||||
@ -968,7 +968,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
|
||||
fibsize = sizeof(struct aac_read64) +
|
||||
((le32_to_cpu(readcmd->sg.count) - 1) *
|
||||
sizeof (struct sgentry64));
|
||||
BUG_ON (fibsize > (sizeof(struct hw_fib) -
|
||||
BUG_ON (fibsize > (dev->max_fib_size -
|
||||
sizeof(struct aac_fibhdr)));
|
||||
/*
|
||||
* Now send the Fib to the adapter
|
||||
|
||||
@ -874,7 +874,7 @@ static void ftdi_determine_type(struct usb_serial_port *port)
|
||||
unsigned interfaces;
|
||||
|
||||
/* Assume it is not the original SIO device for now. */
|
||||
priv->baud_base = 48000000 / 16;
|
||||
priv->baud_base = 48000000 / 2;
|
||||
priv->write_offset = 0;
|
||||
|
||||
version = le16_to_cpu(udev->descriptor.bcdDevice);
|
||||
|
||||
@ -798,13 +798,16 @@ static int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
|
||||
r = (void *) &r4;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return -EFAULT;
|
||||
if (ret) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
set_fs (KERNEL_DS);
|
||||
ret = sys_ioctl (fd, cmd, (unsigned long) r);
|
||||
set_fs (old_fs);
|
||||
|
||||
out:
|
||||
if (mysock)
|
||||
sockfd_put(mysock);
|
||||
|
||||
|
||||
@ -128,21 +128,21 @@ void jfs_delete_inode(struct inode *inode)
|
||||
{
|
||||
jfs_info("In jfs_delete_inode, inode = 0x%p", inode);
|
||||
|
||||
if (is_bad_inode(inode) ||
|
||||
(JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
|
||||
return;
|
||||
if (!is_bad_inode(inode) &&
|
||||
(JFS_IP(inode)->fileset == cpu_to_le32(FILESYSTEM_I))) {
|
||||
|
||||
if (test_cflag(COMMIT_Freewmap, inode))
|
||||
jfs_free_zero_link(inode);
|
||||
if (test_cflag(COMMIT_Freewmap, inode))
|
||||
jfs_free_zero_link(inode);
|
||||
|
||||
diFree(inode);
|
||||
diFree(inode);
|
||||
|
||||
/*
|
||||
* Free the inode from the quota allocation.
|
||||
*/
|
||||
DQUOT_INIT(inode);
|
||||
DQUOT_FREE_INODE(inode);
|
||||
DQUOT_DROP(inode);
|
||||
/*
|
||||
* Free the inode from the quota allocation.
|
||||
*/
|
||||
DQUOT_INIT(inode);
|
||||
DQUOT_FREE_INODE(inode);
|
||||
DQUOT_DROP(inode);
|
||||
}
|
||||
|
||||
clear_inode(inode);
|
||||
}
|
||||
|
||||
@ -33,7 +33,8 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi
|
||||
extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned);
|
||||
extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *);
|
||||
extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
|
||||
extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, unsigned char *,
|
||||
int);
|
||||
|
||||
struct sock;
|
||||
extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
|
||||
|
||||
#endif /* NET_COMPAT_H */
|
||||
|
||||
@ -333,8 +333,13 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
|
||||
if (prev && prev->vm_end < vma->vm_start)
|
||||
return ERR_PTR(-EFAULT);
|
||||
if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
|
||||
unsigned long endvma = vma->vm_end;
|
||||
if (endvma > end)
|
||||
endvma = end;
|
||||
if (vma->vm_start > start)
|
||||
start = vma->vm_start;
|
||||
err = check_pgd_range(vma->vm_mm,
|
||||
vma->vm_start, vma->vm_end, nodes);
|
||||
start, endvma, nodes);
|
||||
if (err) {
|
||||
first = ERR_PTR(err);
|
||||
break;
|
||||
|
||||
44
net/compat.c
44
net/compat.c
@ -135,13 +135,14 @@ static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *ms
|
||||
* thus placement) of cmsg headers and length are different for
|
||||
* 32-bit apps. -DaveM
|
||||
*/
|
||||
int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
|
||||
int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
|
||||
unsigned char *stackbuf, int stackbuf_size)
|
||||
{
|
||||
struct compat_cmsghdr __user *ucmsg;
|
||||
struct cmsghdr *kcmsg, *kcmsg_base;
|
||||
compat_size_t ucmlen;
|
||||
__kernel_size_t kcmlen, tmp;
|
||||
int err = -EFAULT;
|
||||
|
||||
kcmlen = 0;
|
||||
kcmsg_base = kcmsg = (struct cmsghdr *)stackbuf;
|
||||
@ -156,6 +157,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
|
||||
|
||||
tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
|
||||
CMSG_ALIGN(sizeof(struct cmsghdr)));
|
||||
tmp = CMSG_ALIGN(tmp);
|
||||
kcmlen += tmp;
|
||||
ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
|
||||
}
|
||||
@ -167,30 +169,34 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
|
||||
* until we have successfully copied over all of the data
|
||||
* from the user.
|
||||
*/
|
||||
if(kcmlen > stackbuf_size)
|
||||
kcmsg_base = kcmsg = kmalloc(kcmlen, GFP_KERNEL);
|
||||
if(kcmsg == NULL)
|
||||
if (kcmlen > stackbuf_size)
|
||||
kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
|
||||
if (kcmsg == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
/* Now copy them over neatly. */
|
||||
memset(kcmsg, 0, kcmlen);
|
||||
ucmsg = CMSG_COMPAT_FIRSTHDR(kmsg);
|
||||
while(ucmsg != NULL) {
|
||||
__get_user(ucmlen, &ucmsg->cmsg_len);
|
||||
if (__get_user(ucmlen, &ucmsg->cmsg_len))
|
||||
goto Efault;
|
||||
if (!CMSG_COMPAT_OK(ucmlen, ucmsg, kmsg))
|
||||
goto Einval;
|
||||
tmp = ((ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg))) +
|
||||
CMSG_ALIGN(sizeof(struct cmsghdr)));
|
||||
if ((char *)kcmsg_base + kcmlen - (char *)kcmsg < CMSG_ALIGN(tmp))
|
||||
goto Einval;
|
||||
kcmsg->cmsg_len = tmp;
|
||||
__get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level);
|
||||
__get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type);
|
||||
|
||||
/* Copy over the data. */
|
||||
if(copy_from_user(CMSG_DATA(kcmsg),
|
||||
CMSG_COMPAT_DATA(ucmsg),
|
||||
(ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
|
||||
goto out_free_efault;
|
||||
tmp = CMSG_ALIGN(tmp);
|
||||
if (__get_user(kcmsg->cmsg_level, &ucmsg->cmsg_level) ||
|
||||
__get_user(kcmsg->cmsg_type, &ucmsg->cmsg_type) ||
|
||||
copy_from_user(CMSG_DATA(kcmsg),
|
||||
CMSG_COMPAT_DATA(ucmsg),
|
||||
(ucmlen - CMSG_COMPAT_ALIGN(sizeof(*ucmsg)))))
|
||||
goto Efault;
|
||||
|
||||
/* Advance. */
|
||||
kcmsg = (struct cmsghdr *)((char *)kcmsg + CMSG_ALIGN(tmp));
|
||||
kcmsg = (struct cmsghdr *)((char *)kcmsg + tmp);
|
||||
ucmsg = cmsg_compat_nxthdr(kmsg, ucmsg, ucmlen);
|
||||
}
|
||||
|
||||
@ -199,10 +205,12 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg,
|
||||
kmsg->msg_controllen = kcmlen;
|
||||
return 0;
|
||||
|
||||
out_free_efault:
|
||||
if(kcmsg_base != (struct cmsghdr *)stackbuf)
|
||||
kfree(kcmsg_base);
|
||||
return -EFAULT;
|
||||
Einval:
|
||||
err = -EINVAL;
|
||||
Efault:
|
||||
if (kcmsg_base != (struct cmsghdr *)stackbuf)
|
||||
sock_kfree_s(sk, kcmsg_base, kcmlen);
|
||||
return err;
|
||||
}
|
||||
|
||||
int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
|
||||
|
||||
@ -182,7 +182,7 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
|
||||
A = ntohl(*(u32 *)ptr);
|
||||
continue;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case BPF_LD|BPF_H|BPF_ABS:
|
||||
k = fentry->k;
|
||||
load_h:
|
||||
@ -191,7 +191,7 @@ int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
|
||||
A = ntohs(*(u16 *)ptr);
|
||||
continue;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case BPF_LD|BPF_B|BPF_ABS:
|
||||
k = fentry->k;
|
||||
load_b:
|
||||
@ -200,7 +200,7 @@ load_b:
|
||||
A = *(u8 *)ptr;
|
||||
continue;
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
case BPF_LD|BPF_W|BPF_LEN:
|
||||
A = skb->len;
|
||||
continue;
|
||||
|
||||
@ -457,7 +457,7 @@ static void ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
|
||||
|
||||
if (pskb_pull(skb, ihl) == NULL)
|
||||
goto err;
|
||||
if (pskb_trim(skb, end-offset))
|
||||
if (pskb_trim_rcsum(skb, end-offset))
|
||||
goto err;
|
||||
|
||||
/* Find out which fragments are in front and at the back of us
|
||||
|
||||
@ -95,6 +95,12 @@ masquerade_target(struct sk_buff **pskb,
|
||||
IP_NF_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED
|
||||
|| ctinfo == IP_CT_RELATED + IP_CT_IS_REPLY));
|
||||
|
||||
/* Source address is 0.0.0.0 - locally generated packet that is
|
||||
* probably not supposed to be masqueraded.
|
||||
*/
|
||||
if (ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.ip == 0)
|
||||
return NF_ACCEPT;
|
||||
|
||||
mr = targinfo;
|
||||
rt = (struct rtable *)(*pskb)->dst;
|
||||
newsrc = inet_select_addr(out, rt->rt_gateway, RT_SCOPE_UNIVERSE);
|
||||
|
||||
@ -358,7 +358,7 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
|
||||
if (type && code) {
|
||||
get_user(fl->fl_icmp_type, type);
|
||||
__get_user(fl->fl_icmp_code, code);
|
||||
get_user(fl->fl_icmp_code, code);
|
||||
probed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -619,7 +619,7 @@ static void rawv6_probe_proto_opt(struct flowi *fl, struct msghdr *msg)
|
||||
|
||||
if (type && code) {
|
||||
get_user(fl->fl_icmp_type, type);
|
||||
__get_user(fl->fl_icmp_code, code);
|
||||
get_user(fl->fl_icmp_code, code);
|
||||
probed = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1739,10 +1739,11 @@ asmlinkage long sys_sendmsg(int fd, struct msghdr __user *msg, unsigned flags)
|
||||
goto out_freeiov;
|
||||
ctl_len = msg_sys.msg_controllen;
|
||||
if ((MSG_CMSG_COMPAT & flags) && ctl_len) {
|
||||
err = cmsghdr_from_user_compat_to_kern(&msg_sys, ctl, sizeof(ctl));
|
||||
err = cmsghdr_from_user_compat_to_kern(&msg_sys, sock->sk, ctl, sizeof(ctl));
|
||||
if (err)
|
||||
goto out_freeiov;
|
||||
ctl_buf = msg_sys.msg_control;
|
||||
ctl_len = msg_sys.msg_controllen;
|
||||
} else if (ctl_len) {
|
||||
if (ctl_len > sizeof(ctl))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user