]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Dec 2019 07:49:39 +0000 (08:49 +0100)
commitbca481bd8eb0ea81c0ff138be96507b46b28b00f
tree029f9f1ffa16583cdecf8376e4159bc44093d026
parent333b7396439ac287013e51c3d493f37afa639c34
RDMA/qib: Validate ->show()/store() callbacks before calling them

commit 7ee23491b39259ae83899dd93b2a29ef0f22f0a7 upstream.

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/qib/qib_sysfs.c