Commit 81d1ab82c045fd4d2f3c803147f0a1c6bd2015fc

Authored by Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block

* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  block: fix missing bio back/front segment size setting in blk_recount_segments()
  loop: don't increment p->offset with (size_t) -EINVAL
  cciss: remove 30 second initial timeout on controller reset
  Fix kernel NULL pointer dereference in xen-blkfront

Showing 4 changed files Side-by-side Diff

... ... @@ -39,14 +39,13 @@
39 39 }
40 40  
41 41 static unsigned int __blk_recalc_rq_segments(struct request_queue *q,
42   - struct bio *bio,
43   - unsigned int *seg_size_ptr)
  42 + struct bio *bio)
44 43 {
45 44 unsigned int phys_size;
46 45 struct bio_vec *bv, *bvprv = NULL;
47 46 int cluster, i, high, highprv = 1;
48 47 unsigned int seg_size, nr_phys_segs;
49   - struct bio *fbio;
  48 + struct bio *fbio, *bbio;
50 49  
51 50 if (!bio)
52 51 return 0;
53 52  
54 53  
... ... @@ -87,26 +86,20 @@
87 86 seg_size = bv->bv_len;
88 87 highprv = high;
89 88 }
  89 + bbio = bio;
90 90 }
91 91  
92   - if (seg_size_ptr)
93   - *seg_size_ptr = seg_size;
  92 + if (nr_phys_segs == 1 && seg_size > fbio->bi_seg_front_size)
  93 + fbio->bi_seg_front_size = seg_size;
  94 + if (seg_size > bbio->bi_seg_back_size)
  95 + bbio->bi_seg_back_size = seg_size;
94 96  
95 97 return nr_phys_segs;
96 98 }
97 99  
98 100 void blk_recalc_rq_segments(struct request *rq)
99 101 {
100   - unsigned int seg_size = 0, phys_segs;
101   -
102   - phys_segs = __blk_recalc_rq_segments(rq->q, rq->bio, &seg_size);
103   -
104   - if (phys_segs == 1 && seg_size > rq->bio->bi_seg_front_size)
105   - rq->bio->bi_seg_front_size = seg_size;
106   - if (seg_size > rq->biotail->bi_seg_back_size)
107   - rq->biotail->bi_seg_back_size = seg_size;
108   -
109   - rq->nr_phys_segments = phys_segs;
  102 + rq->nr_phys_segments = __blk_recalc_rq_segments(rq->q, rq->bio);
110 103 }
111 104  
112 105 void blk_recount_segments(struct request_queue *q, struct bio *bio)
... ... @@ -114,7 +107,7 @@
114 107 struct bio *nxt = bio->bi_next;
115 108  
116 109 bio->bi_next = NULL;
117   - bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, NULL);
  110 + bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio);
118 111 bio->bi_next = nxt;
119 112 bio->bi_flags |= (1 << BIO_SEG_VALID);
120 113 }
drivers/block/cciss.c
... ... @@ -3606,11 +3606,9 @@
3606 3606 if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
3607 3607 return -ENODEV;
3608 3608  
3609   - /* Some devices (notably the HP Smart Array 5i Controller)
3610   - need a little pause here */
3611   - schedule_timeout_uninterruptible(30*HZ);
3612   -
3613   - /* Now try to get the controller to respond to a no-op */
  3609 + /* Now try to get the controller to respond to a no-op. Some
  3610 + devices (notably the HP Smart Array 5i Controller) need
  3611 + up to 30 seconds to respond. */
3614 3612 for (i=0; i<30; i++) {
3615 3613 if (cciss_noop(pdev) == 0)
3616 3614 break;
drivers/block/loop.c
... ... @@ -392,8 +392,7 @@
392 392 struct loop_device *lo = p->lo;
393 393 struct page *page = buf->page;
394 394 sector_t IV;
395   - size_t size;
396   - int ret;
  395 + int size, ret;
397 396  
398 397 ret = buf->ops->confirm(pipe, buf);
399 398 if (unlikely(ret))
drivers/block/xen-blkfront.c
... ... @@ -977,6 +977,8 @@
977 977 break;
978 978  
979 979 case XenbusStateClosing:
  980 + if (info->gd == NULL)
  981 + xenbus_dev_fatal(dev, -ENODEV, "gd is NULL");
980 982 bd = bdget_disk(info->gd, 0);
981 983 if (bd == NULL)
982 984 xenbus_dev_fatal(dev, -ENODEV, "bdget failed");