]> git.baikalelectronics.ru Git - kernel.git/commit
fs: check FMODE_WRITE in __kernel_write
authorChristoph Hellwig <hch@lst.de>
Fri, 8 May 2020 06:55:03 +0000 (08:55 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 8 Jul 2020 06:27:56 +0000 (08:27 +0200)
commitd088d45f52f997b9a68885e692ddd369ad148744
treea16940d89cd9a69f4119cd29fc80f4e0018fd2ec
parenta97683d27c7e023007e0ebf45da6391bf103d4ac
fs: check FMODE_WRITE in __kernel_write

Add a WARN_ON_ONCE if the file isn't actually open for write.  This
matches the check done in vfs_write, but actually warn warns as a
kernel user calling write on a file not opened for writing is a pretty
obvious programming error.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/read_write.c