[linux] 01/01: nbd: use loff_t for blocksize and nbd_set_size args (Closes: #851533)

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Mon Jan 16 02:36:30 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch sid
in repository linux.

commit a7f877c1f1d9ac05045e4a108e54dc5a40d842f1
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Mon Jan 16 02:36:18 2017 +0000

    nbd: use loff_t for blocksize and nbd_set_size args (Closes: #851533)
---
 debian/changelog                                   |  1 +
 ...off_t-for-blocksize-and-nbd_set_size-args.patch | 56 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 58 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7c60b71..2020c30 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -237,6 +237,7 @@ linux (4.9.4-1) UNRELEASED; urgency=medium
   [ Ben Hutchings ]
   * [armel,armhf,s390x,x86] linux-headers: Fix regression of multilib compiler
     support (Closes: #851481)
+  * nbd: use loff_t for blocksize and nbd_set_size args (Closes: #851533)
 
  -- Salvatore Bonaccorso <carnil at debian.org>  Sun, 15 Jan 2017 14:48:41 +0100
 
diff --git a/debian/patches/bugfix/all/nbd-use-loff_t-for-blocksize-and-nbd_set_size-args.patch b/debian/patches/bugfix/all/nbd-use-loff_t-for-blocksize-and-nbd_set_size-args.patch
new file mode 100644
index 0000000..4dbae88
--- /dev/null
+++ b/debian/patches/bugfix/all/nbd-use-loff_t-for-blocksize-and-nbd_set_size-args.patch
@@ -0,0 +1,56 @@
+From: Josef Bacik <jbacik at fb.com>
+Date: Fri, 2 Dec 2016 16:19:12 -0500
+Subject: nbd: use loff_t for blocksize and nbd_set_size args
+Origin: https://git.kernel.org/linus/ef77b515243b3499d62cf446eda6ca7e0a0b079c
+Bug-Debian: https://bugs.debian.org/851533
+
+If we have large devices (say like the 40t drive I was trying to test with) we
+will end up overflowing the int arguments to nbd_set_size and not get the right
+size for our device.  Fix this by using loff_t everywhere so I don't have to
+think about this again.  Thanks,
+
+Signed-off-by: Josef Bacik <jbacik at fb.com>
+Signed-off-by: Jens Axboe <axboe at fb.com>
+[bwh: Backported to 4.9: adjust context]
+---
+ drivers/block/nbd.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -54,7 +54,7 @@ struct nbd_device {
+ 
+ 	struct mutex tx_lock;
+ 	struct gendisk *disk;
+-	int blksize;
++	loff_t blksize;
+ 	loff_t bytesize;
+ 
+ 	/* protects initialization and shutdown of the socket */
+@@ -126,7 +126,7 @@ static void nbd_size_update(struct nbd_d
+ }
+ 
+ static int nbd_size_set(struct nbd_device *nbd, struct block_device *bdev,
+-			int blocksize, int nr_blocks)
++			loff_t blocksize, loff_t nr_blocks)
+ {
+ 	int ret;
+ 
+@@ -135,7 +135,7 @@ static int nbd_size_set(struct nbd_devic
+ 		return ret;
+ 
+ 	nbd->blksize = blocksize;
+-	nbd->bytesize = (loff_t)blocksize * (loff_t)nr_blocks;
++	nbd->bytesize = blocksize * nr_blocks;
+ 
+ 	nbd_size_update(nbd, bdev);
+ 
+@@ -817,7 +817,7 @@ static int nbd_dev_dbg_init(struct nbd_d
+ 	debugfs_create_file("tasks", 0444, dir, nbd, &nbd_dbg_tasks_ops);
+ 	debugfs_create_u64("size_bytes", 0444, dir, &nbd->bytesize);
+ 	debugfs_create_u32("timeout", 0444, dir, &nbd->tag_set.timeout);
+-	debugfs_create_u32("blocksize", 0444, dir, &nbd->blksize);
++	debugfs_create_u64("blocksize", 0444, dir, &nbd->blksize);
+ 	debugfs_create_file("flags", 0444, dir, nbd, &nbd_dbg_flags_ops);
+ 
+ 	return 0;
diff --git a/debian/patches/series b/debian/patches/series
index 4682eea..14e5a83 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -64,6 +64,7 @@ bugfix/all/kbuild-do-not-use-hyphen-in-exported-variable-name.patch
 bugfix/all/ext4-fix-bug-838544.patch
 bugfix/all/mm-memcontrol-use-special-workqueue-for-creating-per-memcg-caches.patch
 bugfix/all/partially-revert-usb-kconfig-using-select-for-usb_co.patch
+bugfix/all/nbd-use-loff_t-for-blocksize-and-nbd_set_size-args.patch
 
 # Miscellaneous features
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list