Merge branch 'for-linus' of git://git.kernel.dk/linux-block
* 'for-linus' of git://git.kernel.dk/linux-block: block: add missed trace_block_plug paride: fix potential information leak in pg_read() bio: change some signed vars to unsigned block: avoid unnecessary plug list flush cciss: auto engage SCSI mid layer at driver load time loop: cleanup set_status interface include/linux/bio.h: use a static inline function for bio_integrity_clone() loop: prevent information leak after failed read block: Always check length of all iov entries in blk_rq_map_user_iov() The Windows driver .inf disables ASPM on all cciss devices. Do the same. backing-dev: ensure wakeup_timer is deleted block: Revert "[SCSI] genhd: add a new attribute "alias" in gendisk"
This commit is contained in:
commit
15bd1cfb30
|
@ -206,16 +206,3 @@ Description:
|
|||
when a discarded area is read the discard_zeroes_data
|
||||
parameter will be set to one. Otherwise it will be 0 and
|
||||
the result of reading a discarded area is undefined.
|
||||
What: /sys/block/<disk>/alias
|
||||
Date: Aug 2011
|
||||
Contact: Nao Nishijima <nao.nishijima.xt@hitachi.com>
|
||||
Description:
|
||||
A raw device name of a disk does not always point a same disk
|
||||
each boot-up time. Therefore, users have to use persistent
|
||||
device names, which udev creates when the kernel finds a disk,
|
||||
instead of raw device name. However, kernel doesn't show those
|
||||
persistent names on its messages (e.g. dmesg).
|
||||
This file can store an alias of the disk and it would be
|
||||
appeared in kernel messages if it is set. A disk can have an
|
||||
alias which length is up to 255bytes. Users can use alphabets,
|
||||
numbers, "-" and "_" in alias name. This file is writeonce.
|
||||
|
|
|
@ -98,14 +98,12 @@ You must enable "SCSI tape drive support for Smart Array 5xxx" and
|
|||
"SCSI support" in your kernel configuration to be able to use SCSI
|
||||
tape drives with your Smart Array 5xxx controller.
|
||||
|
||||
Additionally, note that the driver will not engage the SCSI core at init
|
||||
time. The driver must be directed to dynamically engage the SCSI core via
|
||||
the /proc filesystem entry which the "block" side of the driver creates as
|
||||
/proc/driver/cciss/cciss* at runtime. This is because at driver init time,
|
||||
the SCSI core may not yet be initialized (because the driver is a block
|
||||
driver) and attempting to register it with the SCSI core in such a case
|
||||
would cause a hang. This is best done via an initialization script
|
||||
(typically in /etc/init.d, but could vary depending on distribution).
|
||||
Additionally, note that the driver will engage the SCSI core at init
|
||||
time if any tape drives or medium changers are detected. The driver may
|
||||
also be directed to dynamically engage the SCSI core via the /proc filesystem
|
||||
entry which the "block" side of the driver creates as
|
||||
/proc/driver/cciss/cciss* at runtime. This is best done via a script.
|
||||
|
||||
For example:
|
||||
|
||||
for x in /proc/driver/cciss/cciss[0-9]*
|
||||
|
|
|
@ -1379,15 +1379,19 @@ get_rq:
|
|||
*/
|
||||
if (list_empty(&plug->list))
|
||||
trace_block_plug(q);
|
||||
else if (!plug->should_sort) {
|
||||
struct request *__rq;
|
||||
else {
|
||||
if (!plug->should_sort) {
|
||||
struct request *__rq;
|
||||
|
||||
__rq = list_entry_rq(plug->list.prev);
|
||||
if (__rq->q != q)
|
||||
plug->should_sort = 1;
|
||||
__rq = list_entry_rq(plug->list.prev);
|
||||
if (__rq->q != q)
|
||||
plug->should_sort = 1;
|
||||
}
|
||||
if (request_count >= BLK_MAX_REQUEST_COUNT) {
|
||||
blk_flush_plug_list(plug, false);
|
||||
trace_block_plug(q);
|
||||
}
|
||||
}
|
||||
if (request_count >= BLK_MAX_REQUEST_COUNT)
|
||||
blk_flush_plug_list(plug, false);
|
||||
list_add_tail(&req->queuelist, &plug->list);
|
||||
drive_stat_acct(req, 1);
|
||||
} else {
|
||||
|
|
|
@ -204,10 +204,11 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq,
|
|||
if (!iov[i].iov_len)
|
||||
return -EINVAL;
|
||||
|
||||
if (uaddr & queue_dma_alignment(q)) {
|
||||
/*
|
||||
* Keep going so we check length of all segments
|
||||
*/
|
||||
if (uaddr & queue_dma_alignment(q))
|
||||
unaligned = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (unaligned || (q->dma_pad_mask & len) || map_data)
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/log2.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#include "blk.h"
|
||||
|
||||
|
@ -916,74 +915,6 @@ static int __init genhd_device_init(void)
|
|||
|
||||
subsys_initcall(genhd_device_init);
|
||||
|
||||
static ssize_t alias_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gendisk *disk = dev_to_disk(dev);
|
||||
ssize_t ret = 0;
|
||||
|
||||
if (disk->alias)
|
||||
ret = snprintf(buf, ALIAS_LEN, "%s\n", disk->alias);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t alias_store(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct gendisk *disk = dev_to_disk(dev);
|
||||
char *alias;
|
||||
char *envp[] = { NULL, NULL };
|
||||
unsigned char c;
|
||||
int i;
|
||||
ssize_t ret = count;
|
||||
|
||||
if (!count)
|
||||
return -EINVAL;
|
||||
|
||||
if (count >= ALIAS_LEN) {
|
||||
printk(KERN_ERR "alias: alias is too long\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Validation check */
|
||||
for (i = 0; i < count; i++) {
|
||||
c = buf[i];
|
||||
if (i == count - 1 && c == '\n')
|
||||
break;
|
||||
if (!isalnum(c) && c != '_' && c != '-') {
|
||||
printk(KERN_ERR "alias: invalid alias\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (disk->alias) {
|
||||
printk(KERN_INFO "alias: %s is already assigned (%s)\n",
|
||||
disk->disk_name, disk->alias);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
alias = kasprintf(GFP_KERNEL, "%s", buf);
|
||||
if (!alias)
|
||||
return -ENOMEM;
|
||||
|
||||
if (alias[count - 1] == '\n')
|
||||
alias[count - 1] = '\0';
|
||||
|
||||
envp[0] = kasprintf(GFP_KERNEL, "ALIAS=%s", alias);
|
||||
if (!envp[0]) {
|
||||
kfree(alias);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
disk->alias = alias;
|
||||
printk(KERN_INFO "alias: assigned %s to %s\n", alias, disk->disk_name);
|
||||
|
||||
kobject_uevent_env(&dev->kobj, KOBJ_ADD, envp);
|
||||
|
||||
kfree(envp[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t disk_range_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -1043,7 +974,6 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
|
|||
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(alias, S_IRUGO|S_IWUSR, alias_show, alias_store);
|
||||
static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
|
||||
static DEVICE_ATTR(ext_range, S_IRUGO, disk_ext_range_show, NULL);
|
||||
static DEVICE_ATTR(removable, S_IRUGO, disk_removable_show, NULL);
|
||||
|
@ -1066,7 +996,6 @@ static struct device_attribute dev_attr_fail_timeout =
|
|||
#endif
|
||||
|
||||
static struct attribute *disk_attrs[] = {
|
||||
&dev_attr_alias.attr,
|
||||
&dev_attr_range.attr,
|
||||
&dev_attr_ext_range.attr,
|
||||
&dev_attr_removable.attr,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/pci-aspm.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
|
@ -4319,6 +4320,10 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
|
|||
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
|
||||
PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
|
||||
|
||||
err = pci_enable_device(h->pdev);
|
||||
if (err) {
|
||||
dev_warn(&h->pdev->dev, "Unable to Enable PCI device\n");
|
||||
|
@ -5158,6 +5163,7 @@ reinit_after_soft_reset:
|
|||
h->cciss_max_sectors = 8192;
|
||||
|
||||
rebuild_lun_table(h, 1, 0);
|
||||
cciss_engage_scsi(h);
|
||||
h->busy_initializing = 0;
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -1720,5 +1720,6 @@ static int cciss_eh_abort_handler(struct scsi_cmnd *scsicmd)
|
|||
/* If no tape support, then these become defined out of existence */
|
||||
|
||||
#define cciss_scsi_setup(cntl_num)
|
||||
#define cciss_engage_scsi(h)
|
||||
|
||||
#endif /* CONFIG_CISS_SCSI_TAPE */
|
||||
|
|
|
@ -161,17 +161,19 @@ static struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = {
|
|||
&xor_funcs
|
||||
};
|
||||
|
||||
static loff_t get_loop_size(struct loop_device *lo, struct file *file)
|
||||
static loff_t get_size(loff_t offset, loff_t sizelimit, struct file *file)
|
||||
{
|
||||
loff_t size, offset, loopsize;
|
||||
loff_t size, loopsize;
|
||||
|
||||
/* Compute loopsize in bytes */
|
||||
size = i_size_read(file->f_mapping->host);
|
||||
offset = lo->lo_offset;
|
||||
loopsize = size - offset;
|
||||
if (lo->lo_sizelimit > 0 && lo->lo_sizelimit < loopsize)
|
||||
loopsize = lo->lo_sizelimit;
|
||||
/* offset is beyond i_size, wierd but possible */
|
||||
if (loopsize < 0)
|
||||
return 0;
|
||||
|
||||
if (sizelimit > 0 && sizelimit < loopsize)
|
||||
loopsize = sizelimit;
|
||||
/*
|
||||
* Unfortunately, if we want to do I/O on the device,
|
||||
* 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)
|
|||
return loopsize >> 9;
|
||||
}
|
||||
|
||||
static int
|
||||
figure_loop_size(struct loop_device *lo)
|
||||
static loff_t get_loop_size(struct loop_device *lo, struct file *file)
|
||||
{
|
||||
loff_t size = get_loop_size(lo, lo->lo_backing_file);
|
||||
return get_size(lo->lo_offset, lo->lo_sizelimit, file);
|
||||
}
|
||||
|
||||
static int
|
||||
figure_loop_size(struct loop_device *lo, loff_t offset, loff_t sizelimit)
|
||||
{
|
||||
loff_t size = get_size(offset, sizelimit, lo->lo_backing_file);
|
||||
sector_t x = (sector_t)size;
|
||||
|
||||
if (unlikely((loff_t)x != size))
|
||||
return -EFBIG;
|
||||
|
||||
if (lo->lo_offset != offset)
|
||||
lo->lo_offset = offset;
|
||||
if (lo->lo_sizelimit != sizelimit)
|
||||
lo->lo_sizelimit = sizelimit;
|
||||
set_capacity(lo->lo_disk, x);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -372,7 +382,8 @@ do_lo_receive(struct loop_device *lo,
|
|||
|
||||
if (retval < 0)
|
||||
return retval;
|
||||
|
||||
if (retval != bvec->bv_len)
|
||||
return -EIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1058,9 +1069,7 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
|
|||
|
||||
if (lo->lo_offset != info->lo_offset ||
|
||||
lo->lo_sizelimit != info->lo_sizelimit) {
|
||||
lo->lo_offset = info->lo_offset;
|
||||
lo->lo_sizelimit = info->lo_sizelimit;
|
||||
if (figure_loop_size(lo))
|
||||
if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit))
|
||||
return -EFBIG;
|
||||
}
|
||||
loop_config_discard(lo);
|
||||
|
@ -1246,7 +1255,7 @@ static int loop_set_capacity(struct loop_device *lo, struct block_device *bdev)
|
|||
err = -ENXIO;
|
||||
if (unlikely(lo->lo_state != Lo_bound))
|
||||
goto out;
|
||||
err = figure_loop_size(lo);
|
||||
err = figure_loop_size(lo, lo->lo_offset, lo->lo_sizelimit);
|
||||
if (unlikely(err))
|
||||
goto out;
|
||||
sec = get_capacity(lo->lo_disk);
|
||||
|
@ -1284,13 +1293,19 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,
|
|||
goto out_unlocked;
|
||||
break;
|
||||
case LOOP_SET_STATUS:
|
||||
err = loop_set_status_old(lo, (struct loop_info __user *) arg);
|
||||
err = -EPERM;
|
||||
if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN))
|
||||
err = loop_set_status_old(lo,
|
||||
(struct loop_info __user *)arg);
|
||||
break;
|
||||
case LOOP_GET_STATUS:
|
||||
err = loop_get_status_old(lo, (struct loop_info __user *) arg);
|
||||
break;
|
||||
case LOOP_SET_STATUS64:
|
||||
err = loop_set_status64(lo, (struct loop_info64 __user *) arg);
|
||||
err = -EPERM;
|
||||
if ((mode & FMODE_WRITE) || capable(CAP_SYS_ADMIN))
|
||||
err = loop_set_status64(lo,
|
||||
(struct loop_info64 __user *) arg);
|
||||
break;
|
||||
case LOOP_GET_STATUS64:
|
||||
err = loop_get_status64(lo, (struct loop_info64 __user *) arg);
|
||||
|
|
|
@ -630,6 +630,7 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t
|
|||
if (dev->status & 0x10)
|
||||
return -ETIME;
|
||||
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
hdr.magic = PG_MAGIC;
|
||||
hdr.dlen = dev->dlen;
|
||||
copy = 0;
|
||||
|
|
7
fs/bio.c
7
fs/bio.c
|
@ -337,7 +337,7 @@ static void bio_fs_destructor(struct bio *bio)
|
|||
* RETURNS:
|
||||
* Pointer to new bio on success, NULL on failure.
|
||||
*/
|
||||
struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs)
|
||||
struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
|
||||
{
|
||||
struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
|
||||
|
||||
|
@ -365,7 +365,7 @@ static void bio_kmalloc_destructor(struct bio *bio)
|
|||
* %__GFP_WAIT, the allocation is guaranteed to succeed.
|
||||
*
|
||||
**/
|
||||
struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs)
|
||||
struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
|
||||
{
|
||||
struct bio *bio;
|
||||
|
||||
|
@ -696,7 +696,8 @@ static void bio_free_map_data(struct bio_map_data *bmd)
|
|||
kfree(bmd);
|
||||
}
|
||||
|
||||
static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count,
|
||||
static struct bio_map_data *bio_alloc_map_data(int nr_segs,
|
||||
unsigned int iov_count,
|
||||
gfp_t gfp_mask)
|
||||
{
|
||||
struct bio_map_data *bmd;
|
||||
|
|
|
@ -211,8 +211,8 @@ extern void bio_pair_release(struct bio_pair *dbio);
|
|||
extern struct bio_set *bioset_create(unsigned int, unsigned int);
|
||||
extern void bioset_free(struct bio_set *);
|
||||
|
||||
extern struct bio *bio_alloc(gfp_t, int);
|
||||
extern struct bio *bio_kmalloc(gfp_t, int);
|
||||
extern struct bio *bio_alloc(gfp_t, unsigned int);
|
||||
extern struct bio *bio_kmalloc(gfp_t, unsigned int);
|
||||
extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
|
||||
extern void bio_put(struct bio *);
|
||||
extern void bio_free(struct bio *, struct bio_set *);
|
||||
|
@ -519,7 +519,11 @@ extern void bio_integrity_init(void);
|
|||
#define bioset_integrity_create(a, b) (0)
|
||||
#define bio_integrity_prep(a) (0)
|
||||
#define bio_integrity_enabled(a) (0)
|
||||
#define bio_integrity_clone(a, b, c, d) (0)
|
||||
static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
|
||||
gfp_t gfp_mask, struct bio_set *bs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#define bioset_integrity_free(a) do { } while (0)
|
||||
#define bio_integrity_free(a, b) do { } while (0)
|
||||
#define bio_integrity_endio(a, b) do { } while (0)
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
|
||||
#define disk_to_dev(disk) (&(disk)->part0.__dev)
|
||||
#define part_to_dev(part) (&((part)->__dev))
|
||||
#define alias_name(disk) ((disk)->alias ? (disk)->alias : \
|
||||
(disk)->disk_name)
|
||||
|
||||
extern struct device_type part_type;
|
||||
extern struct kobject *block_depr;
|
||||
|
@ -60,7 +58,6 @@ enum {
|
|||
|
||||
#define DISK_MAX_PARTS 256
|
||||
#define DISK_NAME_LEN 32
|
||||
#define ALIAS_LEN 256
|
||||
|
||||
#include <linux/major.h>
|
||||
#include <linux/device.h>
|
||||
|
@ -166,7 +163,6 @@ struct gendisk {
|
|||
* disks that can't be partitioned. */
|
||||
|
||||
char disk_name[DISK_NAME_LEN]; /* name of major driver */
|
||||
char *alias; /* alias name of disk */
|
||||
char *(*devnode)(struct gendisk *gd, mode_t *mode);
|
||||
|
||||
unsigned int events; /* supported events */
|
||||
|
|
|
@ -724,6 +724,14 @@ void bdi_destroy(struct backing_dev_info *bdi)
|
|||
|
||||
bdi_unregister(bdi);
|
||||
|
||||
/*
|
||||
* If bdi_unregister() had already been called earlier, the
|
||||
* wakeup_timer could still be armed because bdi_prune_sb()
|
||||
* can race with the bdi_wakeup_thread_delayed() calls from
|
||||
* __mark_inode_dirty().
|
||||
*/
|
||||
del_timer_sync(&bdi->wb.wakeup_timer);
|
||||
|
||||
for (i = 0; i < NR_BDI_STAT_ITEMS; i++)
|
||||
percpu_counter_destroy(&bdi->bdi_stat[i]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue