]> www.infradead.org Git - users/jedix/linux-maple.git/commit
IB/sa: Fix netlink local service GFP crash
authorKaike Wan <kaike.wan@intel.com>
Thu, 21 Jan 2016 13:41:31 +0000 (08:41 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 06:15:47 +0000 (23:15 -0700)
commit53d7c72ed25dbafd4df638a1a901f20ee160adbc
tree891ee20eacaca4612c0a1d401cbcc445a0a491a3
parent0680315a7222f45664572c6eb5eaadd17fb6daeb
IB/sa: Fix netlink local service GFP crash

Orabug: 26124118

The rdma netlink local service registers a handler to handle RESOLVE
response and another handler to handle SET_TIMEOUT request. The first
thing these handlers do is to call netlink_capable() to check the
access right of the received skb to make sure that the sender has root
access. Under normal conditions, such responses and requests will be
directly forwarded to the handlers without going through the netlink_dump
pathway (see ibnl_rcv_msg() in drivers/infiniband/core/netlink.c).
However, a user application could send a RESOLVE request (not response)
to the local service, which will fall into the netlink_dump pathway,
where a new skb will be created without initializing the control block.
This new skb will be eventually forwarded to the local service RESOLVE
response handler. Unfortunately, netlink_capable() will cause general
protection fault if the skb's control block is not initialized. This
patch will address the problem by checking the skb first.

Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
(cherry picked from commit 2deeb4772971e56d5bdac0bd3375d5eadaa827fd)

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com>
drivers/infiniband/core/sa_query.c