]> git.baikalelectronics.ru Git - kernel.git/commit
afs: Fix afs_write_end() when called with copied == 0 [ver #3]
authorDavid Howells <dhowells@redhat.com>
Sat, 14 Nov 2020 17:27:57 +0000 (17:27 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Nov 2020 19:51:18 +0000 (11:51 -0800)
commit06897d365f2082a9a6be81c60c746d0351d0abe2
tree7c211765eff4950a262064f52a6831b960d61569
parentd1da28250d491dc2389e597bb07904ea4501d6a1
afs: Fix afs_write_end() when called with copied == 0 [ver #3]

When afs_write_end() is called with copied == 0, it tries to set the
dirty region, but there's no way to actually encode a 0-length region in
the encoding in page->private.

"0,0", for example, indicates a 1-byte region at offset 0.  The maths
miscalculates this and sets it incorrectly.

Fix it to just do nothing but unlock and put the page in this case.  We
don't actually need to mark the page dirty as nothing presumably
changed.

Fixes: 95fecd7d94b2 ("afs: Alter dirty range encoding in page->private")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/afs/write.c