]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/qib: Validate ->show()/store() callbacks before calling them
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 7 Nov 2019 03:20:25 +0000 (08:50 +0530)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 14 Nov 2019 15:49:15 +0000 (11:49 -0400)
commit4b7a82412601376a304b24f08c3940a5fef24867
tree924f3d8b13496eddaf6e1a2417d8b2a4964b0bac
parent3a3aa9709a1ae52f2b2e2ae9471c805d7d4b1319
RDMA/qib: Validate ->show()/store() callbacks before calling them

The permissions of the read-only or write-only sysfs files can be
changed (as root) and the user can then try to read a write-only file or
write to a read-only file which will lead to kernel crash here.

Protect against that by always validating the show/store callbacks.

Link: https://lore.kernel.org/r/d45cc26361a174ae12dbb86c994ef334d257924b.1573096807.git.viresh.kumar@linaro.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/qib/qib_sysfs.c