diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 6 | ||||
-rw-r--r-- | drivers/block/cciss_scsi.c | 1 | ||||
-rw-r--r-- | drivers/block/loop.c | 47 | ||||
-rw-r--r-- | drivers/block/paride/pg.c | 1 |
4 files changed, 39 insertions, 16 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 486f94ef24d4..8004ac30a7a8 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/pci-aspm.h> | ||
27 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
@@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h) | |||
4319 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); | 4320 | dev_warn(&h->pdev->dev, "controller appears to be disabled\n"); |
4320 | return -ENODEV; | 4321 | return -ENODEV; |
4321 | } | 4322 | } |
4323 | |||
4324 | pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S | | ||
4325 | PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM); | ||
4326 | |||
4322 | err = pci_enable_device(h->pdev); | 4327 | err = pci_enable_device(h->pdev); |
4323 | if (err) { | 4328 | if (err) { |
4324 | dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n"); | 4329 | dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n"); |
@@ -5158,6 +5163,7 @@ reinit_after_soft_reset: | |||
5158 | h->cciss_max_sectors = 8192; | 5163 | h->cciss_max_sectors = 8192; |
5159 | 5164 | ||
5160 | rebuild_lun_table(h, 1, 0); | 5165 | rebuild_lun_table(h, 1, 0); |
5166 | cciss_engage_scsi(h); | ||
5161 | h->busy_initializing = 0; | 5167 | h->busy_initializing = 0; |
5162 | return 1; | 5168 | return 1; |
5163 | 5169 | ||
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 951a4e33b92b..e820b68d2f6c 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -1720,5 +1720,6 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd) | |||
1720 | /* If no tape support, then these become defined out of existence */ | 1720 | /* If no tape support, then these become defined out of existence */ |
1721 | 1721 | ||
1722 | #define cciss_scsi_setup(cntl_num) | 1722 | #define cciss_scsi_setup(cntl_num) |
1723 | #define cciss_engage_scsi(h) | ||
1723 | 1724 | ||
1724 | #endif /* CONFIG_CISS_SCSI_TAPE */ | 1725 | #endif /* CONFIG_CISS_SCSI_TAPE */ |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 3d806820280e..68b205a9338f 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -161,17 +161,19 @@ static struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = { | |||
161 | &xor_funcs | 161 | &xor_funcs |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static loff_t get_loop_size(struct loop_device *lo, struct file *file) | 164 | static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file) |
165 | { | 165 | { |
166 | loff_t size, offset, loopsize; | 166 | loff_t size, loopsize; |
167 | 167 | ||
168 | /* Compute loopsize in bytes */ | 168 | /* Compute loopsize in bytes */ |
169 | size = i_size_read(file->f_mapping->host); | 169 | size = i_size_read(file->f_mapping->host); |
170 | offset = lo->lo_offset; | ||
171 | loopsize = size - offset; | 170 | loopsize = size - offset; |
172 | if (lo->lo_sizelimit > 0 && lo->lo_sizelimit < loopsize) | 171 | /* offset is beyond i_size, wierd but possible */ |
173 | loopsize = lo->lo_sizelimit; | 172 | if (loopsize < 0) |
173 | return 0; | ||
174 | 174 | ||
175 | if (sizelimit > 0 && sizelimit < loopsize) | ||
176 | loopsize = sizelimit; | ||
175 | /* | 177 | /* |
176 | * Unfortunately, if we want to do I/O on the device, | 178 | * Unfortunately, if we want to do I/O on the device, |
177 | * the number of 512-byte sectors has to fit into a sector_t. | 179 | * the number of 512-byte sectors has to fit into a sector_t. |
@@ -179,17 +181,25 @@ static loff_t get_loop_size(struct loop_device *lo, struct file *file) | |||
179 | return loopsize >> 9; | 181 | return loopsize >> 9; |
180 | } | 182 | } |
181 | 183 | ||
184 | static loff_t get_loop_size(struct loop_device *lo, struct file *file) | ||
185 | { | ||
186 | return get_size(lo->lo_offset, lo->lo_sizelimit, file); | ||
187 | } | ||
188 | |||
182 | static int | 189 | static int |
183 | figure_loop_size(struct loop_device *lo) | 190 | figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit) |
184 | { | 191 | { |
185 | loff_t size = get_loop_size(lo, lo->lo_backing_file); | 192 | loff_t size = get_size(offset, sizelimit, lo->lo_backing_file); |
186 | sector_t x = (sector_t)size; | 193 | sector_t x = (sector_t)size; |
187 | 194 | ||
188 | if (unlikely((loff_t)x != size)) | 195 | if (unlikely((loff_t)x != size)) |
189 | return -EFBIG; | 196 | return -EFBIG; |
190 | 197 | if (lo->lo_offset != offset) | |
198 | lo->lo_offset = offset; | ||
199 | if (lo->lo_sizelimit != sizelimit) | ||
200 | lo->lo_sizelimit = sizelimit; | ||
191 | set_capacity(lo->lo_disk, x); | 201 | set_capacity(lo->lo_disk, x); |
192 | return 0; | 202 | return 0; |
193 | } | 203 | } |
194 | 204 | ||
195 | static inline int | 205 | static inline int |
@@ -372,7 +382,8 @@ do_lo_receive(struct loop_device *lo, | |||
372 | 382 | ||
373 | if (retval < 0) | 383 | if (retval < 0) |
374 | return retval; | 384 | return retval; |
375 | 385 | if (retval != bvec->bv_len) | |
386 | return -EIO; | ||
376 | return 0; | 387 | return 0; |
377 | } | 388 | } |
378 | 389 | ||
@@ -1058,9 +1069,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) | |||
1058 | 1069 | ||
1059 | if (lo->lo_offset != info->lo_offset || | 1070 | if (lo->lo_offset != info->lo_offset || |
1060 | lo->lo_sizelimit != info->lo_sizelimit) { | 1071 | lo->lo_sizelimit != info->lo_sizelimit) { |
1061 | lo->lo_offset = info->lo_offset; | 1072 | if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) |
1062 | lo->lo_sizelimit = info->lo_sizelimit; | ||
1063 | if (figure_loop_size(lo)) | ||
1064 | return -EFBIG; | 1073 | return -EFBIG; |
1065 | } | 1074 | } |
1066 | loop_config_discard(lo); | 1075 | loop_config_discard(lo); |
@@ -1246,7 +1255,7 @@ static int loop_set_capacity(struct loop_device *lo, struct block_device *bdev) | |||
1246 | err = -ENXIO; | 1255 | err = -ENXIO; |
1247 | if (unlikely(lo->lo_state != Lo_bound)) | 1256 | if (unlikely(lo->lo_state != Lo_bound)) |
1248 | goto out; | 1257 | goto out; |
1249 | err = figure_loop_size(lo); | 1258 | err = figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit); |
1250 | if (unlikely(err)) | 1259 | if (unlikely(err)) |
1251 | goto out; | 1260 | goto out; |
1252 | sec = get_capacity(lo->lo_disk); | 1261 | sec = get_capacity(lo->lo_disk); |
@@ -1284,13 +1293,19 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, | |||
1284 | goto out_unlocked; | 1293 | goto out_unlocked; |
1285 | break; | 1294 | break; |
1286 | case LOOP_SET_STATUS: | 1295 | case LOOP_SET_STATUS: |
1287 | err = loop_set_status_old(lo, (struct loop_info __user *) arg); | 1296 | err = -EPERM; |
1297 | if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) | ||
1298 | err = loop_set_status_old(lo, | ||
1299 | (struct loop_info __user *)arg); | ||
1288 | break; | 1300 | break; |
1289 | case LOOP_GET_STATUS: | 1301 | case LOOP_GET_STATUS: |
1290 | err = loop_get_status_old(lo, (struct loop_info __user *) arg); | 1302 | err = loop_get_status_old(lo, (struct loop_info __user *) arg); |
1291 | break; | 1303 | break; |
1292 | case LOOP_SET_STATUS64: | 1304 | case LOOP_SET_STATUS64: |
1293 | err = loop_set_status64(lo, (struct loop_info64 __user *) arg); | 1305 | err = -EPERM; |
1306 | if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN)) | ||
1307 | err = loop_set_status64(lo, | ||
1308 | (struct loop_info64 __user *) arg); | ||
1294 | break; | 1309 | break; |
1295 | case LOOP_GET_STATUS64: | 1310 | case LOOP_GET_STATUS64: |
1296 | err = loop_get_status64(lo, (struct loop_info64 __user *) arg); | 1311 | err = loop_get_status64(lo, (struct loop_info64 __user *) arg); |
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 6b9a2000d56a..a79fb4f7ff62 100644 --- a/drivers/block/paride/pg.c +++ b/drivers/block/paride/pg.c | |||
@@ -630,6 +630,7 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t | |||
630 | if (dev->status & 0x10) | 630 | if (dev->status & 0x10) |
631 | return -ETIME; | 631 | return -ETIME; |
632 | 632 | ||
633 | memset(&hdr, 0, sizeof(hdr)); | ||
633 | hdr.magic = PG_MAGIC; | 634 | hdr.magic = PG_MAGIC; |
634 | hdr.dlen = dev->dlen; | 635 | hdr.dlen = dev->dlen; |
635 | copy = 0; | 636 | copy = 0; |