projects
/
unionfs-2.6.39.y.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0a22f48
)
bcache: Strip endline when writing the label through sysfs
author
Gabriel de Perthuis
<g2p.code@gmail.com>
Tue, 24 Sep 2013 06:17:28 +0000
(23:17 -0700)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Sat, 5 Oct 2013 14:13:09 +0000
(07:13 -0700)
commit
aee6f1cfff3ce240eb4b43b41ca466b907acbd2e
upstream.
sysfs attributes with unusual characters have crappy failure modes
in Squeeze (udev 164); later versions of udev are unaffected.
This should make these characters more unusual.
Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/sysfs.c
patch
|
blob
|
history
diff --git
a/drivers/md/bcache/sysfs.c
b/drivers/md/bcache/sysfs.c
index 4d9cca47e4c6006cd20919080410007f75c3bc60..e9bd6c0cca5b4c63a3a3e07fd13ddb69b0a507eb 100644
(file)
--- a/
drivers/md/bcache/sysfs.c
+++ b/
drivers/md/bcache/sysfs.c
@@
-214,7
+214,13
@@
STORE(__cached_dev)
}
if (attr == &sysfs_label) {
- memcpy(dc->sb.label, buf, SB_LABEL_SIZE);
+ if (size > SB_LABEL_SIZE)
+ return -EINVAL;
+ memcpy(dc->sb.label, buf, size);
+ if (size < SB_LABEL_SIZE)
+ dc->sb.label[size] = '\0';
+ if (size && dc->sb.label[size - 1] == '\n')
+ dc->sb.label[size - 1] = '\0';
bch_write_bdev_super(dc, NULL);
if (dc->disk.c) {
memcpy(dc->disk.c->uuids[dc->disk.id].label,