[kernel] r18423 - in dists/sid/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Tue Dec 27 20:10:32 UTC 2011


Author: benh
Date: Tue Dec 27 20:10:31 2011
New Revision: 18423

Log:
snapshot: Implement compat_ioctl (Closes: #502816)

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/all/snapshot-Implement-compat_ioctl.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/base

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Sat Dec 24 22:14:34 2011	(r18422)
+++ dists/sid/linux-2.6/debian/changelog	Tue Dec 27 20:10:31 2011	(r18423)
@@ -1,3 +1,10 @@
+linux-2.6 (3.1.6-2) UNRELEASED; urgency=low
+
+  [ Ben Hutchings ]
+  * snapshot: Implement compat_ioctl (Closes: #502816)
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Tue, 27 Dec 2011 20:54:23 +0100
+
 linux-2.6 (3.1.6-1) unstable; urgency=low
 
   * New upstream stable update:

Added: dists/sid/linux-2.6/debian/patches/bugfix/all/snapshot-Implement-compat_ioctl.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/all/snapshot-Implement-compat_ioctl.patch	Tue Dec 27 20:10:31 2011	(r18423)
@@ -0,0 +1,102 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Tue, 27 Dec 2011 20:42:09 +0100
+Subject: [PATCH] snapshot: Implement compat_ioctl
+
+References: http://bugs.debian.org/502816
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+ kernel/power/user.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 64 insertions(+), 0 deletions(-)
+
+diff --git a/kernel/power/user.c b/kernel/power/user.c
+index 6d8f535..d86e5a7 100644
+--- a/kernel/power/user.c
++++ b/kernel/power/user.c
+@@ -21,6 +21,7 @@
+ #include <linux/swapops.h>
+ #include <linux/pm.h>
+ #include <linux/fs.h>
++#include <linux/compat.h>
+ #include <linux/console.h>
+ #include <linux/cpu.h>
+ #include <linux/freezer.h>
+@@ -464,6 +465,66 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
+ 	return error;
+ }
+ 
++#ifdef CONFIG_COMPAT
++
++struct compat_resume_swap_area {
++	compat_loff_t offset;
++	u32 dev;
++} __packed;
++
++static long
++snapshot_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
++{
++	BUILD_BUG_ON(sizeof(loff_t) != sizeof(compat_loff_t));
++
++	switch (cmd) {
++	case SNAPSHOT_GET_IMAGE_SIZE:
++	case SNAPSHOT_AVAIL_SWAP_SIZE:
++	case SNAPSHOT_ALLOC_SWAP_PAGE: {
++		compat_loff_t __user *uoffset = compat_ptr(arg);
++		loff_t offset;
++		mm_segment_t old_fs;
++		int err;
++
++		old_fs = get_fs();
++		set_fs(KERNEL_DS);
++		err = snapshot_ioctl(file, cmd, (unsigned long) &offset);
++		set_fs(old_fs);
++		if (!err && put_user(offset, uoffset))
++			err = -EFAULT;
++		return err;
++	}
++
++	case SNAPSHOT_CREATE_IMAGE:
++		return snapshot_ioctl(file, cmd,
++				      (unsigned long) compat_ptr(arg));
++
++	case SNAPSHOT_SET_SWAP_AREA: {
++		struct compat_resume_swap_area __user *u_swap_area =
++			compat_ptr(arg);
++		struct resume_swap_area swap_area;
++		mm_segment_t old_fs;
++		int err;
++
++		err = get_user(swap_area.offset, &u_swap_area->offset);
++		err |= get_user(swap_area.dev, &u_swap_area->dev);
++		if (err)
++			return -EFAULT;
++		old_fs = get_fs();
++		set_fs(KERNEL_DS);
++		err = snapshot_ioctl(file, SNAPSHOT_SET_SWAP_AREA,
++				     (unsigned long) &swap_area);
++		set_fs(old_fs);
++		return err;
++	}
++
++	default:
++		return snapshot_ioctl(file, cmd, arg);
++	}
++}
++
++#endif /* CONFIG_COMPAT */
++
+ static const struct file_operations snapshot_fops = {
+ 	.open = snapshot_open,
+ 	.release = snapshot_release,
+@@ -471,6 +532,9 @@ static const struct file_operations snapshot_fops = {
+ 	.write = snapshot_write,
+ 	.llseek = no_llseek,
+ 	.unlocked_ioctl = snapshot_ioctl,
++#ifdef CONFIG_COMPAT
++	.compat_ioctl = snapshot_compat_ioctl,
++#endif
+ };
+ 
+ static struct miscdevice snapshot_device = {
+-- 
+1.7.7.3
+

Modified: dists/sid/linux-2.6/debian/patches/series/base
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/base	Sat Dec 24 22:14:34 2011	(r18422)
+++ dists/sid/linux-2.6/debian/patches/series/base	Tue Dec 27 20:10:31 2011	(r18423)
@@ -86,3 +86,4 @@
 + bugfix/all/0005-staging-brcm80211-restrict-MIPS-dma-bug-workaround-t.patch
 + debian/inetpeer-hide-ABI-change-in-3.1.5.patch
 + bugfix/all/cciss-Add-IRQF_SHARED-back-in-for-the-non-MSI-X-inte.patch
++ bugfix/all/snapshot-Implement-compat_ioctl.patch



More information about the Kernel-svn-changes mailing list