mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
bcache: Strip endline when writing the label through sysfs
commit aee6f1cfff 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0a22f485ee
commit
bb34311525
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user