All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org,
	syzbot+46fe08363dbba223dec5@syzkaller.appspotmail.com
Subject: Re: [PATCH rdma-rc] RDMA/mad: Do not crash if the rdma device does not have a umad interface
Date: Fri, 13 Mar 2020 10:33:40 -0300	[thread overview]
Message-ID: <20200313133340.GA23557@ziepe.ca> (raw)
In-Reply-To: <20200310075339.238090-1-leon@kernel.org>

On Tue, Mar 10, 2020 at 09:53:39AM +0200, Leon Romanovsky wrote:
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> Non-IB devices do not have a umad interface and the client_data will be
> left set to NULL. In this case calling get_nl_info() will try to kref a
> NULL cdev causing a crash:
> 
>   general protection fault, probably for non-canonical address 0xdffffc00000000ba: 0000 [#1] PREEMPT SMP KASAN
>   KASAN: null-ptr-deref in range [0x00000000000005d0-0x00000000000005d7]
>   CPU: 0 PID: 20851 Comm: syz-executor.0 Not tainted 5.6.0-rc2-syzkaller #0
>   Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
>   RIP: 0010:kobject_get+0x35/0x150 lib/kobject.c:640
>   Code: 53 e8 3f b0 8b f9 4d 85 e4 0f 84 a2 00 00 00 e8 31 b0 8b f9 49 8d 7c 24 3c 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f  b6 04 02 48 89 fa
> +83 e2 07 38 d0 7f 08 84 c0 0f 85 eb 00 00 00
>   RSP: 0018:ffffc9000946f1a0 EFLAGS: 00010203
>   RAX: dffffc0000000000 RBX: ffffffff85bdbbb0 RCX: ffffc9000bf22000
>   RDX: 00000000000000ba RSI: ffffffff87e9d78f RDI: 00000000000005d4
>   RBP: ffffc9000946f1b8 R08: ffff8880581a6440 R09: ffff8880581a6cd0
>   R10: fffffbfff154b838 R11: ffffffff8aa5c1c7 R12: 0000000000000598
>   R13: 0000000000000000 R14: ffffc9000946f278 R15: ffff88805cb0c4d0
>   FS:  00007faa9e8af700(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
>   CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>   CR2: 0000001b30121000 CR3: 000000004515d000 CR4: 00000000001406f0
>   DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>   DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>   Call Trace:
>    get_device+0x25/0x40 drivers/base/core.c:2574
>    __ib_get_client_nl_info+0x205/0x2e0 drivers/infiniband/core/device.c:1861
>    ib_get_client_nl_info+0x35/0x180 drivers/infiniband/core/device.c:1881
>    nldev_get_chardev+0x575/0xac0 drivers/infiniband/core/nldev.c:1621
>    rdma_nl_rcv_msg drivers/infiniband/core/netlink.c:195 [inline]
>    rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
>    rdma_nl_rcv+0x5d9/0x980 drivers/infiniband/core/netlink.c:259
>    netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
>    netlink_unicast+0x59e/0x7e0 net/netlink/af_netlink.c:1329
>    netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1918
>    sock_sendmsg_nosec net/socket.c:652 [inline]
>    sock_sendmsg+0xd7/0x130 net/socket.c:672
>    ____sys_sendmsg+0x753/0x880 net/socket.c:2343
>    ___sys_sendmsg+0x100/0x170 net/socket.c:2397
>    __sys_sendmsg+0x105/0x1d0 net/socket.c:2430
>    __do_sys_sendmsg net/socket.c:2439 [inline]
>    __se_sys_sendmsg net/socket.c:2437 [inline]
>    __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2437
>    do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>    entry_SYSCALL_64_after_hwframe+0x49/0xbe
> 
> Fixes: 8f71bb0030b8 ("RDMA: Report available cdevs through RDMA_NLDEV_CMD_GET_CHARDEV")
> Reported-by: syzbot+46fe08363dbba223dec5@syzkaller.appspotmail.com
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/core/user_mad.c | 33 ++++++++++++++++++++----------
>  1 file changed, 22 insertions(+), 11 deletions(-)

Applied to for-rc

Jason

      reply	other threads:[~2020-03-13 13:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  7:53 [PATCH rdma-rc] RDMA/mad: Do not crash if the rdma device does not have a umad interface Leon Romanovsky
2020-03-13 13:33 ` Jason Gunthorpe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200313133340.GA23557@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=syzbot+46fe08363dbba223dec5@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.