Skip to contentSkip to conversation

Patch "bcache: Correct return value for sysfs attach errors" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Sep 22, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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.4-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.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 77fa100f27475d08a569b9d51c17722130f089e7 Mon Sep 17 00:00:00 2001

From: Tony Asleson <[email protected]>
Date: Wed, 6 Sep 2017 14:25:57 +0800
Subject: bcache: Correct return value for sysfs attach errors

From: Tony Asleson <[email protected]>

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.

---
 drivers/md/bcache/sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/bcache/sysfs.c +2 -2
@@ -191,7 +191,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;
 
@@ -226,7 +226,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 [email protected] are

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