aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-06-03 19:11:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-06-03 19:11:26 -0400
commit4f1ba49efafccbc73017f824efa2505c81b247cd (patch)
treedb072bbccffd1f1c6b1269ac7a752cb30af3a726 /drivers/block
parent39b4a46f19295b4876fba6655f27d67232dc6a1f (diff)
parente3a57b3ccf5c04934ac43b5b80e32ba51b817288 (diff)
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
* 'for-linus' of git://git.kernel.dk/linux-block: block: Use hlist_entry() for io_context.cic_list.first cfq-iosched: Remove bogus check in queue_fail path xen/blkback: potential null dereference in error handling xen/blkback: don't call vbd_size() if bd_disk is NULL block: blkdev_get() should access ->bd_disk only after success CFQ: Fix typo and remove unnecessary semicolon block: remove unwanted semicolons Revert "block: Remove extra discard_alignment from hd_struct." nbd: adjust 'max_part' according to part_shift nbd: limit module parameters to a sane value nbd: pass MSG_* flags to kernel_recvmsg() block: improve the bio_add_page() and bio_add_pc_page() descriptions
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c22
-rw-r--r--drivers/block/xen-blkback/blkback.c10
-rw-r--r--drivers/block/xen-blkback/xenbus.c3
3 files changed, 27 insertions, 8 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e6fc716aca45..f533f3375e24 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -192,7 +192,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
192 if (lo->xmit_timeout) 192 if (lo->xmit_timeout)
193 del_timer_sync(&ti); 193 del_timer_sync(&ti);
194 } else 194 } else
195 result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); 195 result = kernel_recvmsg(sock, &msg, &iov, 1, size,
196 msg.msg_flags);
196 197
197 if (signal_pending(current)) { 198 if (signal_pending(current)) {
198 siginfo_t info; 199 siginfo_t info;
@@ -753,9 +754,26 @@ static int __init nbd_init(void)
753 return -ENOMEM; 754 return -ENOMEM;
754 755
755 part_shift = 0; 756 part_shift = 0;
756 if (max_part > 0) 757 if (max_part > 0) {
757 part_shift = fls(max_part); 758 part_shift = fls(max_part);
758 759
760 /*
761 * Adjust max_part according to part_shift as it is exported
762 * to user space so that user can know the max number of
763 * partition kernel should be able to manage.
764 *
765 * Note that -1 is required because partition 0 is reserved
766 * for the whole disk.
767 */
768 max_part = (1UL << part_shift) - 1;
769 }
770
771 if ((1UL << part_shift) > DISK_MAX_PARTS)
772 return -EINVAL;
773
774 if (nbds_max > 1UL << (MINORBITS - part_shift))
775 return -EINVAL;
776
759 for (i = 0; i < nbds_max; i++) { 777 for (i = 0; i < nbds_max; i++) {
760 struct gendisk *disk = alloc_disk(1 << part_shift); 778 struct gendisk *disk = alloc_disk(1 << part_shift);
761 if (!disk) 779 if (!disk)
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index c73910cc28c9..5cf2993a8338 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -809,11 +809,13 @@ static int __init xen_blkif_init(void)
809 failed_init: 809 failed_init:
810 kfree(blkbk->pending_reqs); 810 kfree(blkbk->pending_reqs);
811 kfree(blkbk->pending_grant_handles); 811 kfree(blkbk->pending_grant_handles);
812 for (i = 0; i < mmap_pages; i++) { 812 if (blkbk->pending_pages) {
813 if (blkbk->pending_pages[i]) 813 for (i = 0; i < mmap_pages; i++) {
814 __free_page(blkbk->pending_pages[i]); 814 if (blkbk->pending_pages[i])
815 __free_page(blkbk->pending_pages[i]);
816 }
817 kfree(blkbk->pending_pages);
815 } 818 }
816 kfree(blkbk->pending_pages);
817 kfree(blkbk); 819 kfree(blkbk);
818 blkbk = NULL; 820 blkbk = NULL;
819 return rc; 821 return rc;
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 34570823355b..6cc0db1bf522 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
357 } 357 }
358 358
359 vbd->bdev = bdev; 359 vbd->bdev = bdev;
360 vbd->size = vbd_sz(vbd);
361
362 if (vbd->bdev->bd_disk == NULL) { 360 if (vbd->bdev->bd_disk == NULL) {
363 DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", 361 DPRINTK("xen_vbd_create: device %08x doesn't exist.\n",
364 vbd->pdevice); 362 vbd->pdevice);
365 xen_vbd_free(vbd); 363 xen_vbd_free(vbd);
366 return -ENOENT; 364 return -ENOENT;
367 } 365 }
366 vbd->size = vbd_sz(vbd);
368 367
369 if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) 368 if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
370 vbd->type |= VDISK_CDROM; 369 vbd->type |= VDISK_CDROM;