aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-08-16 14:29:57 -0400
committerTony Luck <tony.luck@intel.com>2005-08-16 14:29:57 -0400
commitf7001e8f1fa5369ee24f58255726a04a2019e4bd (patch)
tree1bbdd233ad0cf2e0adb4eb04f22b7bfa59a43494
parent85f265d887d2389376f1caa191e9682085feb76e (diff)
parentcf59001235c5a36f3e3701bd593a78cf955a4242 (diff)
Auto-update from upstream
-rw-r--r--arch/ia64/kernel/domain.c2
-rw-r--r--drivers/acpi/motherboard.c2
-rw-r--r--drivers/char/mem.c12
-rw-r--r--drivers/scsi/dc395x.c48
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/intelfb/intelfbdrv.c50
-rw-r--r--fs/cifs/CHANGES6
-rw-r--r--fs/cifs/cifssmb.c3
-rw-r--r--fs/cifs/misc.c1
-rw-r--r--fs/inotify.c2
-rw-r--r--fs/namei.c3
-rw-r--r--fs/nfs/inode.c37
-rw-r--r--fs/nfs/nfs3proc.c4
-rw-r--r--fs/nfs/nfs4proc.c10
-rw-r--r--fs/nfs/proc.c2
-rw-r--r--fs/nfs_common/nfsacl.c1
-rw-r--r--fs/ntfs/ChangeLog3
-rw-r--r--fs/ntfs/mft.c2
-rw-r--r--fs/reiserfs/namei.c3
-rw-r--r--include/asm-i386/pci.h4
-rw-r--r--include/asm-sh/unistd.h2
-rw-r--r--include/asm-um/page.h4
-rw-r--r--include/asm-x86_64/pci.h4
-rw-r--r--include/linux/fsnotify.h6
-rw-r--r--include/linux/inotify.h4
-rw-r--r--include/linux/nfs_fs.h1
-rw-r--r--include/linux/sunrpc/xdr.h1
-rw-r--r--net/sunrpc/xdr.c1
28 files changed, 132 insertions, 90 deletions
diff --git a/arch/ia64/kernel/domain.c b/arch/ia64/kernel/domain.c
index d65e87b6394f..bbb8efe126b7 100644
--- a/arch/ia64/kernel/domain.c
+++ b/arch/ia64/kernel/domain.c
@@ -341,7 +341,7 @@ next_sg:
341#endif 341#endif
342 342
343 /* Attach the domains */ 343 /* Attach the domains */
344 for_each_online_cpu(i) { 344 for_each_cpu_mask(i, *cpu_map) {
345 struct sched_domain *sd; 345 struct sched_domain *sd;
346#ifdef CONFIG_SCHED_SMT 346#ifdef CONFIG_SCHED_SMT
347 sd = &per_cpu(cpu_domains, i); 347 sd = &per_cpu(cpu_domains, i);
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c
index 2934475d67d6..61ea70742d49 100644
--- a/drivers/acpi/motherboard.c
+++ b/drivers/acpi/motherboard.c
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME ("acpi_motherboard")
43 */ 43 */
44#define IS_RESERVED_ADDR(base, len) \ 44#define IS_RESERVED_ADDR(base, len) \
45 (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ 45 (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
46 && ((base) + (len) > 0x1000)) 46 && ((base) + (len) > PCIBIOS_MIN_IO))
47 47
48/* 48/*
49 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use 49 * Clearing the flag (IORESOURCE_BUSY) allows drivers to use
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 42187381506b..850a78c9c4bc 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -261,7 +261,11 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma)
261 261
262static int mmap_kmem(struct file * file, struct vm_area_struct * vma) 262static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
263{ 263{
264 unsigned long long val; 264 unsigned long pfn;
265
266 /* Turn a kernel-virtual address into a physical page frame */
267 pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;
268
265 /* 269 /*
266 * RED-PEN: on some architectures there is more mapped memory 270 * RED-PEN: on some architectures there is more mapped memory
267 * than available in mem_map which pfn_valid checks 271 * than available in mem_map which pfn_valid checks
@@ -269,10 +273,10 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
269 * 273 *
270 * RED-PEN: vmalloc is not supported right now. 274 * RED-PEN: vmalloc is not supported right now.
271 */ 275 */
272 if (!pfn_valid(vma->vm_pgoff)) 276 if (!pfn_valid(pfn))
273 return -EIO; 277 return -EIO;
274 val = (u64)vma->vm_pgoff << PAGE_SHIFT; 278
275 vma->vm_pgoff = __pa(val) >> PAGE_SHIFT; 279 vma->vm_pgoff = pfn;
276 return mmap_mem(file, vma); 280 return mmap_mem(file, vma);
277} 281}
278 282
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 929170dcd3cb..600ba1202864 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -183,7 +183,7 @@
183 * cross a page boundy. 183 * cross a page boundy.
184 */ 184 */
185#define SEGMENTX_LEN (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY) 185#define SEGMENTX_LEN (sizeof(struct SGentry)*DC395x_MAX_SG_LISTENTRY)
186#define VIRTX_LEN (sizeof(void *) * DC395x_MAX_SG_LISTENTRY) 186
187 187
188struct SGentry { 188struct SGentry {
189 u32 address; /* bus! address */ 189 u32 address; /* bus! address */
@@ -235,7 +235,6 @@ struct ScsiReqBlk {
235 u8 sg_count; /* No of HW sg entries for this request */ 235 u8 sg_count; /* No of HW sg entries for this request */
236 u8 sg_index; /* Index of HW sg entry for this request */ 236 u8 sg_index; /* Index of HW sg entry for this request */
237 u32 total_xfer_length; /* Total number of bytes remaining to be transfered */ 237 u32 total_xfer_length; /* Total number of bytes remaining to be transfered */
238 void **virt_map;
239 unsigned char *virt_addr; /* Virtual address of current transfer position */ 238 unsigned char *virt_addr; /* Virtual address of current transfer position */
240 239
241 /* 240 /*
@@ -1022,14 +1021,14 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
1022 reqlen, cmd->request_buffer, cmd->use_sg, 1021 reqlen, cmd->request_buffer, cmd->use_sg,
1023 srb->sg_count); 1022 srb->sg_count);
1024 1023
1024 srb->virt_addr = page_address(sl->page);
1025 for (i = 0; i < srb->sg_count; i++) { 1025 for (i = 0; i < srb->sg_count; i++) {
1026 u32 seglen = (u32)sg_dma_len(sl + i); 1026 u32 busaddr = (u32)sg_dma_address(&sl[i]);
1027 sgp[i].address = (u32)sg_dma_address(sl + i); 1027 u32 seglen = (u32)sl[i].length;
1028 sgp[i].address = busaddr;
1028 sgp[i].length = seglen; 1029 sgp[i].length = seglen;
1029 srb->total_xfer_length += seglen; 1030 srb->total_xfer_length += seglen;
1030 srb->virt_map[i] = kmap(sl[i].page);
1031 } 1031 }
1032 srb->virt_addr = srb->virt_map[0];
1033 sgp += srb->sg_count - 1; 1032 sgp += srb->sg_count - 1;
1034 1033
1035 /* 1034 /*
@@ -1976,7 +1975,6 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
1976 int segment = cmd->use_sg; 1975 int segment = cmd->use_sg;
1977 u32 xferred = srb->total_xfer_length - left; /* bytes transfered */ 1976 u32 xferred = srb->total_xfer_length - left; /* bytes transfered */
1978 struct SGentry *psge = srb->segment_x + srb->sg_index; 1977 struct SGentry *psge = srb->segment_x + srb->sg_index;
1979 void **virt = srb->virt_map;
1980 1978
1981 dprintkdbg(DBG_0, 1979 dprintkdbg(DBG_0,
1982 "sg_update_list: Transfered %i of %i bytes, %i remain\n", 1980 "sg_update_list: Transfered %i of %i bytes, %i remain\n",
@@ -2016,16 +2014,16 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
2016 2014
2017 /* We have to walk the scatterlist to find it */ 2015 /* We have to walk the scatterlist to find it */
2018 sg = (struct scatterlist *)cmd->request_buffer; 2016 sg = (struct scatterlist *)cmd->request_buffer;
2019 idx = 0;
2020 while (segment--) { 2017 while (segment--) {
2021 unsigned long mask = 2018 unsigned long mask =
2022 ~((unsigned long)sg->length - 1) & PAGE_MASK; 2019 ~((unsigned long)sg->length - 1) & PAGE_MASK;
2023 if ((sg_dma_address(sg) & mask) == (psge->address & mask)) { 2020 if ((sg_dma_address(sg) & mask) == (psge->address & mask)) {
2024 srb->virt_addr = virt[idx] + (psge->address & ~PAGE_MASK); 2021 srb->virt_addr = (page_address(sg->page)
2022 + psge->address -
2023 (psge->address & PAGE_MASK));
2025 return; 2024 return;
2026 } 2025 }
2027 ++sg; 2026 ++sg;
2028 ++idx;
2029 } 2027 }
2030 2028
2031 dprintkl(KERN_ERR, "sg_update_list: sg_to_virt failed\n"); 2029 dprintkl(KERN_ERR, "sg_update_list: sg_to_virt failed\n");
@@ -2151,7 +2149,7 @@ static void data_out_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2151 DC395x_read32(acb, TRM_S1040_DMA_CXCNT)); 2149 DC395x_read32(acb, TRM_S1040_DMA_CXCNT));
2152 } 2150 }
2153 /* 2151 /*
2154 * calculate all the residue data that not yet transfered 2152 * calculate all the residue data that not yet tranfered
2155 * SCSI transfer counter + left in SCSI FIFO data 2153 * SCSI transfer counter + left in SCSI FIFO data
2156 * 2154 *
2157 * .....TRM_S1040_SCSI_COUNTER (24bits) 2155 * .....TRM_S1040_SCSI_COUNTER (24bits)
@@ -3269,7 +3267,6 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
3269 struct scsi_cmnd *cmd = srb->cmd; 3267 struct scsi_cmnd *cmd = srb->cmd;
3270 enum dma_data_direction dir = cmd->sc_data_direction; 3268 enum dma_data_direction dir = cmd->sc_data_direction;
3271 if (cmd->use_sg && dir != PCI_DMA_NONE) { 3269 if (cmd->use_sg && dir != PCI_DMA_NONE) {
3272 int i;
3273 /* unmap DC395x SG list */ 3270 /* unmap DC395x SG list */
3274 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n", 3271 dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
3275 srb->sg_bus_addr, SEGMENTX_LEN); 3272 srb->sg_bus_addr, SEGMENTX_LEN);
@@ -3279,8 +3276,6 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
3279 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n", 3276 dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",
3280 cmd->use_sg, cmd->request_buffer); 3277 cmd->use_sg, cmd->request_buffer);
3281 /* unmap the sg segments */ 3278 /* unmap the sg segments */
3282 for (i = 0; i < srb->sg_count; i++)
3283 kunmap(virt_to_page(srb->virt_map[i]));
3284 pci_unmap_sg(acb->dev, 3279 pci_unmap_sg(acb->dev,
3285 (struct scatterlist *)cmd->request_buffer, 3280 (struct scatterlist *)cmd->request_buffer,
3286 cmd->use_sg, dir); 3281 cmd->use_sg, dir);
@@ -3327,7 +3322,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3327 3322
3328 if (cmd->use_sg) { 3323 if (cmd->use_sg) {
3329 struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer; 3324 struct scatterlist* sg = (struct scatterlist *)cmd->request_buffer;
3330 ptr = (struct ScsiInqData *)(srb->virt_map[0] + sg->offset); 3325 ptr = (struct ScsiInqData *)(page_address(sg->page) + sg->offset);
3331 } else { 3326 } else {
3332 ptr = (struct ScsiInqData *)(cmd->request_buffer); 3327 ptr = (struct ScsiInqData *)(cmd->request_buffer);
3333 } 3328 }
@@ -4262,9 +4257,8 @@ static void adapter_sg_tables_free(struct AdapterCtlBlk *acb)
4262 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN; 4257 const unsigned srbs_per_page = PAGE_SIZE/SEGMENTX_LEN;
4263 4258
4264 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page) 4259 for (i = 0; i < DC395x_MAX_SRB_CNT; i += srbs_per_page)
4265 kfree(acb->srb_array[i].segment_x); 4260 if (acb->srb_array[i].segment_x)
4266 4261 kfree(acb->srb_array[i].segment_x);
4267 vfree(acb->srb_array[0].virt_map);
4268} 4262}
4269 4263
4270 4264
@@ -4280,12 +4274,9 @@ static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4280 int srb_idx = 0; 4274 int srb_idx = 0;
4281 unsigned i = 0; 4275 unsigned i = 0;
4282 struct SGentry *ptr; 4276 struct SGentry *ptr;
4283 void **virt_array;
4284 4277
4285 for (i = 0; i < DC395x_MAX_SRB_CNT; i++) { 4278 for (i = 0; i < DC395x_MAX_SRB_CNT; i++)
4286 acb->srb_array[i].segment_x = NULL; 4279 acb->srb_array[i].segment_x = NULL;
4287 acb->srb_array[i].virt_map = NULL;
4288 }
4289 4280
4290 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages); 4281 dprintkdbg(DBG_1, "Allocate %i pages for SG tables\n", pages);
4291 while (pages--) { 4282 while (pages--) {
@@ -4306,19 +4297,6 @@ static int __devinit adapter_sg_tables_alloc(struct AdapterCtlBlk *acb)
4306 ptr + (i * DC395x_MAX_SG_LISTENTRY); 4297 ptr + (i * DC395x_MAX_SG_LISTENTRY);
4307 else 4298 else
4308 dprintkl(KERN_DEBUG, "No space for tmsrb SG table reserved?!\n"); 4299 dprintkl(KERN_DEBUG, "No space for tmsrb SG table reserved?!\n");
4309
4310 virt_array = vmalloc((DC395x_MAX_SRB_CNT + 1) * DC395x_MAX_SG_LISTENTRY * sizeof(void*));
4311
4312 if (!virt_array) {
4313 adapter_sg_tables_free(acb);
4314 return 1;
4315 }
4316
4317 for (i = 0; i < DC395x_MAX_SRB_CNT + 1; i++) {
4318 acb->srb_array[i].virt_map = virt_array;
4319 virt_array += DC395x_MAX_SG_LISTENTRY;
4320 }
4321
4322 return 0; 4300 return 0;
4323} 4301}
4324 4302
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index d2e19f6dd72c..4ff853fbe0be 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -628,7 +628,7 @@ fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
628int 628int
629fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) 629fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
630{ 630{
631 int err; 631 int err, flags = info->flags;
632 632
633 if (var->activate & FB_ACTIVATE_INV_MODE) { 633 if (var->activate & FB_ACTIVATE_INV_MODE) {
634 struct fb_videomode mode1, mode2; 634 struct fb_videomode mode1, mode2;
@@ -682,7 +682,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
682 !list_empty(&info->modelist)) 682 !list_empty(&info->modelist))
683 err = fb_add_videomode(&mode, &info->modelist); 683 err = fb_add_videomode(&mode, &info->modelist);
684 684
685 if (!err && info->flags & FBINFO_MISC_USEREVENT) { 685 if (!err && (flags & FBINFO_MISC_USEREVENT)) {
686 struct fb_event event; 686 struct fb_event event;
687 687
688 info->flags &= ~FBINFO_MISC_USEREVENT; 688 info->flags &= ~FBINFO_MISC_USEREVENT;
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 298bc9cd99e7..a112a1786855 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -583,23 +583,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
583 return -ENODEV; 583 return -ENODEV;
584 } 584 }
585 585
586 /* Map the fb and MMIO regions */
587 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
588 (dinfo->aperture.physical, dinfo->aperture.size);
589 if (!dinfo->aperture.virtual) {
590 ERR_MSG("Cannot remap FB region.\n");
591 cleanup(dinfo);
592 return -ENODEV;
593 }
594 dinfo->mmio_base =
595 (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
596 INTEL_REG_SIZE);
597 if (!dinfo->mmio_base) {
598 ERR_MSG("Cannot remap MMIO region.\n");
599 cleanup(dinfo);
600 return -ENODEV;
601 }
602
603 /* Get the chipset info. */ 586 /* Get the chipset info. */
604 dinfo->pci_chipset = pdev->device; 587 dinfo->pci_chipset = pdev->device;
605 588
@@ -630,9 +613,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
630 dinfo->accel = 0; 613 dinfo->accel = 0;
631 } 614 }
632 615
616 if (MB(voffset) < stolen_size)
617 offset = (stolen_size >> 12);
618 else
619 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
620
633 /* Framebuffer parameters - Use all the stolen memory if >= vram */ 621 /* Framebuffer parameters - Use all the stolen memory if >= vram */
634 if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) { 622 if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) {
635 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size); 623 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
624 dinfo->fb.offset = 0;
636 dinfo->fbmem_gart = 0; 625 dinfo->fbmem_gart = 0;
637 } else { 626 } else {
638 dinfo->fb.size = MB(vram); 627 dinfo->fb.size = MB(vram);
@@ -663,11 +652,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
663 return -ENODEV; 652 return -ENODEV;
664 } 653 }
665 654
666 if (MB(voffset) < stolen_size)
667 offset = (stolen_size >> 12);
668 else
669 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
670
671 /* set the mem offsets - set them after the already used pages */ 655 /* set the mem offsets - set them after the already used pages */
672 if (dinfo->accel) { 656 if (dinfo->accel) {
673 dinfo->ring.offset = offset + gtt_info.current_memory; 657 dinfo->ring.offset = offset + gtt_info.current_memory;
@@ -682,6 +666,26 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
682 + (dinfo->cursor.size >> 12); 666 + (dinfo->cursor.size >> 12);
683 } 667 }
684 668
669 /* Map the fb and MMIO regions */
670 /* ioremap only up to the end of used aperture */
671 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
672 (dinfo->aperture.physical, (dinfo->fb.offset << 12)
673 + dinfo->fb.size);
674 if (!dinfo->aperture.virtual) {
675 ERR_MSG("Cannot remap FB region.\n");
676 cleanup(dinfo);
677 return -ENODEV;
678 }
679
680 dinfo->mmio_base =
681 (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
682 INTEL_REG_SIZE);
683 if (!dinfo->mmio_base) {
684 ERR_MSG("Cannot remap MMIO region.\n");
685 cleanup(dinfo);
686 return -ENODEV;
687 }
688
685 /* Allocate memories (which aren't stolen) */ 689 /* Allocate memories (which aren't stolen) */
686 if (dinfo->accel) { 690 if (dinfo->accel) {
687 if (!(dinfo->gtt_ring_mem = 691 if (!(dinfo->gtt_ring_mem =
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index dab4774ee7bb..3196d4c4eed3 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,9 @@
1Version 1.35
2------------
3Add writepage performance improvements. Fix path name conversions
4for long filenames on mounts which were done with "mapchars" mount option
5specified.
6
1Version 1.34 7Version 1.34
2------------ 8------------
3Fix error mapping of the TOO_MANY_LINKS (hardlinks) case. 9Fix error mapping of the TOO_MANY_LINKS (hardlinks) case.
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 3c628bf667a5..0db0b313d715 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2602,6 +2602,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
2602 if(name_len < PATH_MAX) { 2602 if(name_len < PATH_MAX) {
2603 memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len); 2603 memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len);
2604 byte_count += name_len; 2604 byte_count += name_len;
2605 /* 14 byte parm len above enough for 2 byte null terminator */
2606 pSMB->ResumeFileName[name_len] = 0;
2607 pSMB->ResumeFileName[name_len+1] = 0;
2605 } else { 2608 } else {
2606 rc = -EINVAL; 2609 rc = -EINVAL;
2607 goto FNext2_err_exit; 2610 goto FNext2_err_exit;
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 072b4ee8c53e..20ae4153f791 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -611,6 +611,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
611 src_char = source[i]; 611 src_char = source[i];
612 switch (src_char) { 612 switch (src_char) {
613 case 0: 613 case 0:
614 target[j] = 0;
614 goto ctoUCS_out; 615 goto ctoUCS_out;
615 case ':': 616 case ':':
616 target[j] = cpu_to_le16(UNI_COLON); 617 target[j] = cpu_to_le16(UNI_COLON);
diff --git a/fs/inotify.c b/fs/inotify.c
index 27ebcac5e07f..868901b1e779 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -402,7 +402,7 @@ static struct inotify_watch *create_watch(struct inotify_device *dev,
402 return ERR_PTR(ret); 402 return ERR_PTR(ret);
403 } 403 }
404 404
405 dev->last_wd = ret; 405 dev->last_wd = watch->wd;
406 watch->mask = mask; 406 watch->mask = mask;
407 atomic_set(&watch->count, 0); 407 atomic_set(&watch->count, 0);
408 INIT_LIST_HEAD(&watch->d_list); 408 INIT_LIST_HEAD(&watch->d_list);
diff --git a/fs/namei.c b/fs/namei.c
index 57046d98a746..b85f158aef0c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2216,7 +2216,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2216 error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry); 2216 error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry);
2217 if (!error) { 2217 if (!error) {
2218 const char *new_name = old_dentry->d_name.name; 2218 const char *new_name = old_dentry->d_name.name;
2219 fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir, new_dentry->d_inode); 2219 fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir,
2220 new_dentry->d_inode, old_dentry->d_inode);
2220 } 2221 }
2221 fsnotify_oldname_free(old_name); 2222 fsnotify_oldname_free(old_name);
2222 2223
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 4845911f1c63..bb7ca022bcb2 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -814,28 +814,39 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
814 nfs_wb_all(inode); 814 nfs_wb_all(inode);
815 } 815 }
816 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); 816 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
817 if (error == 0) { 817 if (error == 0)
818 nfs_refresh_inode(inode, &fattr); 818 nfs_refresh_inode(inode, &fattr);
819 nfs_end_data_update(inode);
820 unlock_kernel();
821 return error;
822}
823
824/**
825 * nfs_setattr_update_inode - Update inode metadata after a setattr call.
826 * @inode: pointer to struct inode
827 * @attr: pointer to struct iattr
828 *
829 * Note: we do this in the *proc.c in order to ensure that
830 * it works for things like exclusive creates too.
831 */
832void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr)
833{
834 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) {
819 if ((attr->ia_valid & ATTR_MODE) != 0) { 835 if ((attr->ia_valid & ATTR_MODE) != 0) {
820 int mode; 836 int mode = attr->ia_mode & S_IALLUGO;
821 mode = inode->i_mode & ~S_IALLUGO; 837 mode |= inode->i_mode & ~S_IALLUGO;
822 mode |= attr->ia_mode & S_IALLUGO;
823 inode->i_mode = mode; 838 inode->i_mode = mode;
824 } 839 }
825 if ((attr->ia_valid & ATTR_UID) != 0) 840 if ((attr->ia_valid & ATTR_UID) != 0)
826 inode->i_uid = attr->ia_uid; 841 inode->i_uid = attr->ia_uid;
827 if ((attr->ia_valid & ATTR_GID) != 0) 842 if ((attr->ia_valid & ATTR_GID) != 0)
828 inode->i_gid = attr->ia_gid; 843 inode->i_gid = attr->ia_gid;
829 if ((attr->ia_valid & ATTR_SIZE) != 0) {
830 inode->i_size = attr->ia_size;
831 vmtruncate(inode, attr->ia_size);
832 }
833 }
834 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0)
835 NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL; 844 NFS_FLAGS(inode) |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
836 nfs_end_data_update(inode); 845 }
837 unlock_kernel(); 846 if ((attr->ia_valid & ATTR_SIZE) != 0) {
838 return error; 847 inode->i_size = attr->ia_size;
848 vmtruncate(inode, attr->ia_size);
849 }
839} 850}
840 851
841/* 852/*
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 7851569b31c6..2681485cf2d0 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -120,6 +120,8 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
120 dprintk("NFS call setattr\n"); 120 dprintk("NFS call setattr\n");
121 fattr->valid = 0; 121 fattr->valid = 0;
122 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0); 122 status = rpc_call(NFS_CLIENT(inode), NFS3PROC_SETATTR, &arg, fattr, 0);
123 if (status == 0)
124 nfs_setattr_update_inode(inode, sattr);
123 dprintk("NFS reply setattr: %d\n", status); 125 dprintk("NFS reply setattr: %d\n", status);
124 return status; 126 return status;
125} 127}
@@ -370,6 +372,8 @@ again:
370 * not sure this buys us anything (and I'd have 372 * not sure this buys us anything (and I'd have
371 * to revamp the NFSv3 XDR code) */ 373 * to revamp the NFSv3 XDR code) */
372 status = nfs3_proc_setattr(dentry, &fattr, sattr); 374 status = nfs3_proc_setattr(dentry, &fattr, sattr);
375 if (status == 0)
376 nfs_setattr_update_inode(dentry->d_inode, sattr);
373 nfs_refresh_inode(dentry->d_inode, &fattr); 377 nfs_refresh_inode(dentry->d_inode, &fattr);
374 dprintk("NFS reply setattr (post-create): %d\n", status); 378 dprintk("NFS reply setattr (post-create): %d\n", status);
375 } 379 }
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1b76f80aedb9..0c5a308e4963 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -753,6 +753,7 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
753 .rpc_argp = &arg, 753 .rpc_argp = &arg,
754 .rpc_resp = &res, 754 .rpc_resp = &res,
755 }; 755 };
756 int status;
756 757
757 fattr->valid = 0; 758 fattr->valid = 0;
758 759
@@ -762,7 +763,8 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
762 } else 763 } else
763 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid)); 764 memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
764 765
765 return rpc_call_sync(server->client, &msg, 0); 766 status = rpc_call_sync(server->client, &msg, 0);
767 return status;
766} 768}
767 769
768static int nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, 770static int nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
@@ -1145,6 +1147,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1145 1147
1146 status = nfs4_do_setattr(NFS_SERVER(inode), fattr, 1148 status = nfs4_do_setattr(NFS_SERVER(inode), fattr,
1147 NFS_FH(inode), sattr, state); 1149 NFS_FH(inode), sattr, state);
1150 if (status == 0)
1151 nfs_setattr_update_inode(inode, sattr);
1148 if (state != NULL) 1152 if (state != NULL)
1149 nfs4_close_state(state, FMODE_WRITE); 1153 nfs4_close_state(state, FMODE_WRITE);
1150 put_rpccred(cred); 1154 put_rpccred(cred);
@@ -1449,8 +1453,10 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1449 struct nfs_fattr fattr; 1453 struct nfs_fattr fattr;
1450 status = nfs4_do_setattr(NFS_SERVER(dir), &fattr, 1454 status = nfs4_do_setattr(NFS_SERVER(dir), &fattr,
1451 NFS_FH(state->inode), sattr, state); 1455 NFS_FH(state->inode), sattr, state);
1452 if (status == 0) 1456 if (status == 0) {
1457 nfs_setattr_update_inode(state->inode, sattr);
1453 goto out; 1458 goto out;
1459 }
1454 } else if (flags != 0) 1460 } else if (flags != 0)
1455 goto out; 1461 goto out;
1456 nfs4_close_state(state, flags); 1462 nfs4_close_state(state, flags);
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index cedf636bcf3c..be23c3fb9260 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -114,6 +114,8 @@ nfs_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
114 dprintk("NFS call setattr\n"); 114 dprintk("NFS call setattr\n");
115 fattr->valid = 0; 115 fattr->valid = 0;
116 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0); 116 status = rpc_call(NFS_CLIENT(inode), NFSPROC_SETATTR, &arg, fattr, 0);
117 if (status == 0)
118 nfs_setattr_update_inode(inode, sattr);
117 dprintk("NFS reply setattr: %d\n", status); 119 dprintk("NFS reply setattr: %d\n", status);
118 return status; 120 return status;
119} 121}
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c
index 18c58c32e326..251e5a1bb1c4 100644
--- a/fs/nfs_common/nfsacl.c
+++ b/fs/nfs_common/nfsacl.c
@@ -239,6 +239,7 @@ nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
239 if (xdr_decode_word(buf, base, &entries) || 239 if (xdr_decode_word(buf, base, &entries) ||
240 entries > NFS_ACL_MAX_ENTRIES) 240 entries > NFS_ACL_MAX_ENTRIES)
241 return -EINVAL; 241 return -EINVAL;
242 nfsacl_desc.desc.array_maxlen = entries;
242 err = xdr_decode_array2(buf, base + 4, &nfsacl_desc.desc); 243 err = xdr_decode_array2(buf, base + 4, &nfsacl_desc.desc);
243 if (err) 244 if (err)
244 return err; 245 return err;
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 9709fac6531d..21e21fe519e2 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -174,6 +174,9 @@ ToDo/Notes:
174 fact that the vfs and ntfs inodes are one struct in memory to find 174 fact that the vfs and ntfs inodes are one struct in memory to find
175 the ntfs inode in memory if present. Also, the ntfs inode has its 175 the ntfs inode in memory if present. Also, the ntfs inode has its
176 own locking so it does not matter if the vfs inode is locked. 176 own locking so it does not matter if the vfs inode is locked.
177 - Fix bug in mft record writing where we forgot to set the device in
178 the buffers when mapping them after the VM had discarded them
179 Thanks to Martin MOKREJŠ for the bug report.
177 180
1782.1.22 - Many bug and race fixes and error handling improvements. 1812.1.22 - Many bug and race fixes and error handling improvements.
179 182
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index ac9ff39aa834..317f7c679fd3 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -533,6 +533,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
533 LCN lcn; 533 LCN lcn;
534 unsigned int vcn_ofs; 534 unsigned int vcn_ofs;
535 535
536 bh->b_bdev = vol->sb->s_bdev;
536 /* Obtain the vcn and offset of the current block. */ 537 /* Obtain the vcn and offset of the current block. */
537 vcn = ((VCN)mft_no << vol->mft_record_size_bits) + 538 vcn = ((VCN)mft_no << vol->mft_record_size_bits) +
538 (block_start - m_start); 539 (block_start - m_start);
@@ -725,6 +726,7 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
725 LCN lcn; 726 LCN lcn;
726 unsigned int vcn_ofs; 727 unsigned int vcn_ofs;
727 728
729 bh->b_bdev = vol->sb->s_bdev;
728 /* Obtain the vcn and offset of the current block. */ 730 /* Obtain the vcn and offset of the current block. */
729 vcn = ((VCN)ni->mft_no << vol->mft_record_size_bits) + 731 vcn = ((VCN)ni->mft_no << vol->mft_record_size_bits) +
730 (block_start - m_start); 732 (block_start - m_start);
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index a20bbc1642dc..3549067c42d9 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -593,6 +593,9 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
593 */ 593 */
594 inode->i_uid = current->fsuid; 594 inode->i_uid = current->fsuid;
595 inode->i_mode = mode; 595 inode->i_mode = mode;
596 /* Make inode invalid - just in case we are going to drop it before
597 * the initialization happens */
598 INODE_PKEY(inode)->k_objectid = 0;
596 599
597 if (dir->i_mode & S_ISGID) { 600 if (dir->i_mode & S_ISGID) {
598 inode->i_gid = dir->i_gid; 601 inode->i_gid = dir->i_gid;
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index 2cbab30734d6..78c85985aee3 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -18,9 +18,11 @@ extern unsigned int pcibios_assign_all_busses(void);
18#define pcibios_scan_all_fns(a, b) 0 18#define pcibios_scan_all_fns(a, b) 0
19 19
20extern unsigned long pci_mem_start; 20extern unsigned long pci_mem_start;
21#define PCIBIOS_MIN_IO 0x4000 21#define PCIBIOS_MIN_IO 0x1000
22#define PCIBIOS_MIN_MEM (pci_mem_start) 22#define PCIBIOS_MIN_MEM (pci_mem_start)
23 23
24#define PCIBIOS_MIN_CARDBUS_IO 0x4000
25
24void pcibios_config_init(void); 26void pcibios_config_init(void);
25struct pci_bus * pcibios_scan_root(int bus); 27struct pci_bus * pcibios_scan_root(int bus);
26 28
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
index 245447081f0d..4e7701d6d23c 100644
--- a/include/asm-sh/unistd.h
+++ b/include/asm-sh/unistd.h
@@ -406,7 +406,7 @@ register long __sc6 __asm__ ("r6") = (long) arg3; \
406register long __sc7 __asm__ ("r7") = (long) arg4; \ 406register long __sc7 __asm__ ("r7") = (long) arg4; \
407register long __sc0 __asm__ ("r0") = (long) arg5; \ 407register long __sc0 __asm__ ("r0") = (long) arg5; \
408register long __sc1 __asm__ ("r1") = (long) arg6; \ 408register long __sc1 __asm__ ("r1") = (long) arg6; \
409__asm__ __volatile__ ("trapa #0x15" \ 409__asm__ __volatile__ ("trapa #0x16" \
410 : "=z" (__sc0) \ 410 : "=z" (__sc0) \
411 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ 411 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \
412 "r" (__sc3), "r" (__sc1) \ 412 "r" (__sc3), "r" (__sc1) \
diff --git a/include/asm-um/page.h b/include/asm-um/page.h
index 5afee8a8cdf3..f58aedadeb4e 100644
--- a/include/asm-um/page.h
+++ b/include/asm-um/page.h
@@ -104,8 +104,8 @@ extern void *to_virt(unsigned long phys);
104 * casting is the right thing, but 32-bit UML can't have 64-bit virtual 104 * casting is the right thing, but 32-bit UML can't have 64-bit virtual
105 * addresses 105 * addresses
106 */ 106 */
107#define __pa(virt) to_phys((void *) (unsigned long) virt) 107#define __pa(virt) to_phys((void *) (unsigned long) (virt))
108#define __va(phys) to_virt((unsigned long) phys) 108#define __va(phys) to_virt((unsigned long) (phys))
109 109
110#define page_to_pfn(page) ((page) - mem_map) 110#define page_to_pfn(page) ((page) - mem_map)
111#define pfn_to_page(pfn) (mem_map + (pfn)) 111#define pfn_to_page(pfn) (mem_map + (pfn))
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index 9c4527eb55e2..eeb3088a1c9e 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -22,9 +22,11 @@ extern unsigned int pcibios_assign_all_busses(void);
22extern int no_iommu, force_iommu; 22extern int no_iommu, force_iommu;
23 23
24extern unsigned long pci_mem_start; 24extern unsigned long pci_mem_start;
25#define PCIBIOS_MIN_IO 0x4000 25#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM (pci_mem_start) 26#define PCIBIOS_MIN_MEM (pci_mem_start)
27 27
28#define PCIBIOS_MIN_CARDBUS_IO 0x4000
29
28void pcibios_config_init(void); 30void pcibios_config_init(void);
29struct pci_bus * pcibios_scan_root(int bus); 31struct pci_bus * pcibios_scan_root(int bus);
30extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); 32extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 602c305c8585..03b8e7932b83 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -21,7 +21,7 @@
21 */ 21 */
22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 22static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
23 const char *old_name, const char *new_name, 23 const char *old_name, const char *new_name,
24 int isdir, struct inode *target) 24 int isdir, struct inode *target, struct inode *source)
25{ 25{
26 u32 cookie = inotify_get_cookie(); 26 u32 cookie = inotify_get_cookie();
27 27
@@ -41,6 +41,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); 41 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL);
42 inotify_inode_is_dead(target); 42 inotify_inode_is_dead(target);
43 } 43 }
44
45 if (source) {
46 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL);
47 }
44} 48}
45 49
46/* 50/*
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index a40c2bf0408e..93bb3afe646b 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -35,6 +35,7 @@ struct inotify_event {
35#define IN_CREATE 0x00000100 /* Subfile was created */ 35#define IN_CREATE 0x00000100 /* Subfile was created */
36#define IN_DELETE 0x00000200 /* Subfile was deleted */ 36#define IN_DELETE 0x00000200 /* Subfile was deleted */
37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */ 37#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
38#define IN_MOVE_SELF 0x00000800 /* Self was moved */
38 39
39/* the following are legal events. they are sent as needed to any watch */ 40/* the following are legal events. they are sent as needed to any watch */
40#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ 41#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
@@ -56,7 +57,8 @@ struct inotify_event {
56 */ 57 */
57#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ 58#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
58 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ 59 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
59 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF) 60 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
61 IN_MOVE_SELF)
60 62
61#ifdef __KERNEL__ 63#ifdef __KERNEL__
62 64
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8ea249110fb0..7d78a783c64a 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -292,6 +292,7 @@ extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode);
292extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 292extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
293extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 293extern void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
294extern int nfs_setattr(struct dentry *, struct iattr *); 294extern int nfs_setattr(struct dentry *, struct iattr *);
295extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
295extern void nfs_begin_attr_update(struct inode *); 296extern void nfs_begin_attr_update(struct inode *);
296extern void nfs_end_attr_update(struct inode *); 297extern void nfs_end_attr_update(struct inode *);
297extern void nfs_begin_data_update(struct inode *); 298extern void nfs_begin_data_update(struct inode *);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 34ec3e8d99b3..23448d0fb5bc 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -177,6 +177,7 @@ typedef int (*xdr_xcode_elem_t)(struct xdr_array2_desc *desc, void *elem);
177struct xdr_array2_desc { 177struct xdr_array2_desc {
178 unsigned int elem_size; 178 unsigned int elem_size;
179 unsigned int array_len; 179 unsigned int array_len;
180 unsigned int array_maxlen;
180 xdr_xcode_elem_t xcode; 181 xdr_xcode_elem_t xcode;
181}; 182};
182 183
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index 8a4d9c106af1..fde16f40a581 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -993,6 +993,7 @@ xdr_xcode_array2(struct xdr_buf *buf, unsigned int base,
993 return -EINVAL; 993 return -EINVAL;
994 } else { 994 } else {
995 if (xdr_decode_word(buf, base, &desc->array_len) != 0 || 995 if (xdr_decode_word(buf, base, &desc->array_len) != 0 ||
996 desc->array_len > desc->array_maxlen ||
996 (unsigned long) base + 4 + desc->array_len * 997 (unsigned long) base + 4 + desc->array_len *
997 desc->elem_size > buf->len) 998 desc->elem_size > buf->len)
998 return -EINVAL; 999 return -EINVAL;