Messages in this thread Patch in this message | | | Date | Tue, 10 Mar 2020 10:41:15 +0200 | From | Leon Romanovsky <> | Subject | Re: KASAN: use-after-free Read in rxe_query_port |
| |
On Tue, Mar 10, 2020 at 08:21:29AM +0000, Yanjun Zhu wrote: > Hi, Leon > > Thanks. From the patch https://lore.kernel.org/netdev/20200306134518.84416-1-kgraul@linux.ibm.com, > > @@ -240,6 +240,9 @@ static void smc_ib_port_event_work(struct work_struct *work) > work, struct smc_ib_device, port_event_work); > u8 port_idx; > > + if (list_empty(&smcibdev->list)) > + return; > + > for_each_set_bit(port_idx, &smcibdev->port_event_mask, SMC_MAX_PORTS) { > smc_ib_remember_port_attr(smcibdev, port_idx + 1); > clear_bit(port_idx, &smcibdev->port_event_mask); > > This block is try to check smcibdev->list to avoid ib_query_port after the NIC is down. > But smcibdev->list is used by spinlock when add and del. > " > ... > 549 spin_lock(&smc_ib_devices.lock); > 550 list_add_tail(&smcibdev->list, &smc_ib_devices.list); > 551 spin_unlock(&smc_ib_devices.lock); > ... > > 579 spin_lock(&smc_ib_devices.lock); > 580 list_del_init(&smcibdev->list); /* remove from smc_ib_devices */ > 581 spin_unlock(&smc_ib_devices.lock); > ... > " > So in the above block, is it necessary to protect smcibdev->list when it is accessed? > Please comment on it.
It is worth to read whole thread and not first email only. https://lore.kernel.org/netdev/20200308150107.GC11496@unreal/
Thanks
> > Thanks a lot. > Zhu Yanjun > > -----Original Message----- > From: Leon Romanovsky <leon@kernel.org> > Sent: Tuesday, March 10, 2020 3:40 PM > To: Jason Gunthorpe <jgg@mellanox.com> > Cc: syzbot <syzbot+e11efb687f5ab7f01f3d@syzkaller.appspotmail.com>; dledford@redhat.com; linux-kernel@vger.kernel.org; linux-rdma@vger.kernel.org; Moni Shoua <monis@mellanox.com>; syzkaller-bugs@googlegroups.com; Yanjun Zhu <yanjunz@mellanox.com> > Subject: Re: KASAN: use-after-free Read in rxe_query_port > > On Mon, Mar 09, 2020 at 02:34:51PM -0300, Jason Gunthorpe wrote: > > On Sun, Mar 01, 2020 at 03:20:12AM -0800, syzbot wrote: > > > Hello, > > > > > > syzbot found the following crash on: > > > > > > HEAD commit: f8788d86 Linux 5.6-rc3 > > > git tree: upstream > > > console output: https://syzkaller.appspot.com/x/log.txt?x=132d3645e00000 > > > kernel config: https://syzkaller.appspot.com/x/.config?x=9833e26bab355358 > > > dashboard link: https://syzkaller.appspot.com/bug?extid=e11efb687f5ab7f01f3d > > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > > > > > Unfortunately, I don't have any reproducer for this crash yet. > > > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > > Reported-by: syzbot+e11efb687f5ab7f01f3d@syzkaller.appspotmail.com > > > > Yanjun, do you have some idea what this could be? > > See this fix in the net mailing list. > https://lore.kernel.org/netdev/20200306134518.84416-1-kgraul@linux.ibm.com > > Thanks > > > > > Thanks, > > Jason
| |