disk_replace_part_tbl(disk, NULL);
free_part_stats(&disk->part0);
free_part_info(&disk->part0);
+ if (disk->queue)
+ blk_put_queue(disk->queue);
kfree(disk);
}
+
+static int disk_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ struct gendisk *disk = dev_to_disk(dev);
+ struct disk_part_iter piter;
+ struct hd_struct *part;
+ int cnt = 0;
+
+ disk_part_iter_init(&piter, disk, 0);
+ while((part = disk_part_iter_next(&piter)))
+ cnt++;
+ disk_part_iter_exit(&piter);
+ add_uevent_var(env, "NPARTS=%u", cnt);
+ return 0;
+}
+
struct class block_class = {
.name = "block",
};
#endif
+/*
+ * Writing to dma coherent memory on ARM may be delayed via L2
+ * writing buffer, so introduce the helper which can flush L2 writing
+ * buffer into memory immediately, especially used to flush ehci
+ * descriptor to memory.
+ * */
+#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
+static inline void ehci_sync_mem()
+{
+ mb();
+}
+#else
+static inline void ehci_sync_mem()
+{
+}
+#endif
+
/*-------------------------------------------------------------------------*/
+ #ifdef CONFIG_PCI
+
+ /* For working around the MosChip frame-index-register bug */
+ static unsigned ehci_read_frame_index(struct ehci_hcd *ehci);
+
+ #else
+
+ static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
+ {
+ return ehci_readl(ehci, &ehci->regs->frame_index);
+ }
+
+ #endif
+
+ /*-------------------------------------------------------------------------*/
+
#ifndef DEBUG
#define STUB_DEBUG_FILES
#endif /* DEBUG */
mm = get_task_mm(task);
if (mm && mm != current->mm &&
- !ptrace_may_access(task, PTRACE_MODE_READ) &&
- !ptrace_may_access(task, mode)) {
++ !ptrace_may_access(task, mode) &&
+ !capable(CAP_SYS_RESOURCE)) {
mmput(mm);
mm = ERR_PTR(-EACCES);
}
copied = -EIO;
break;
}
- copied += retval;
- buf += retval;
- dst += retval;
- count -= retval;
+
+ if (!write && copy_to_user(buf, page, this_len)) {
+ copied = -EFAULT;
+ break;
+ }
+
+ buf += this_len;
+ addr += this_len;
+ copied += this_len;
+ count -= this_len;
}
- *ppos = dst;
+ *ppos = addr;
- out_mm:
mmput(mm);
- out_free:
+ free:
free_page((unsigned long) page);
- out_task:
- put_task_struct(task);
- out_no_task:
return copied;
}
+
+ static ssize_t mem_read(struct file *file, char __user *buf,
+ size_t count, loff_t *ppos)
+ {
+ return mem_rw(file, buf, count, ppos, 0);
+ }
+
++#define mem_write NULL
++
++#ifndef mem_write
++/* This is a security hazard */
+ static ssize_t mem_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+ {
+ return mem_rw(file, (char __user*)buf, count, ppos, 1);
+ }
+#endif
loff_t mem_lseek(struct file *file, loff_t offset, int orig)
{