All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "bcache: Correct return value for sysfs attach errors" has been added to the 4.13-stable tree
@ 2017-09-22 12:03 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-09-22 12:03 UTC (permalink / raw)
  To: tasleson, axboe, colyli, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    bcache: Correct return value for sysfs attach errors

to the 4.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bcache-correct-return-value-for-sysfs-attach-errors.patch
and it can be found in the queue-4.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 77fa100f27475d08a569b9d51c17722130f089e7 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Wed, 6 Sep 2017 14:25:57 +0800
Subject: bcache: Correct return value for sysfs attach errors

From: Tony Asleson <tasleson@redhat.com>

commit 77fa100f27475d08a569b9d51c17722130f089e7 upstream.

If you encounter any errors in bch_cached_dev_attach it will return
a negative error code.  The variable 'v' which stores the result is
unsigned, thus user space sees a very large value returned for bytes
written which can cause incorrect user space behavior.  Utilize 1
signed variable to use throughout the function to preserve error return
capability.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
Acked-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/bcache/sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -192,7 +192,7 @@ STORE(__cached_dev)
 {
 	struct cached_dev *dc = container_of(kobj, struct cached_dev,
 					     disk.kobj);
-	unsigned v = size;
+	ssize_t v = size;
 	struct cache_set *c;
 	struct kobj_uevent_env *env;
 
@@ -227,7 +227,7 @@ STORE(__cached_dev)
 		bch_cached_dev_run(dc);
 
 	if (attr == &sysfs_cache_mode) {
-		ssize_t v = bch_read_string_list(buf, bch_cache_modes + 1);
+		v = bch_read_string_list(buf, bch_cache_modes + 1);
 
 		if (v < 0)
 			return v;


Patches currently in stable-queue which might be from tasleson@redhat.com are

queue-4.13/bcache-correct-return-value-for-sysfs-attach-errors.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-22 12:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-22 12:03 Patch "bcache: Correct return value for sysfs attach errors" has been added to the 4.13-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.