2022-05-22 19:51:45

by Zheyu Ma

[permalink] [raw]
Subject: [BUG] vDPA/ifcvf: got a warning when removing the module

Hello,

I found a bug in the ifcvf driver.
When removing the module, I got the following warning:

[ 14.478123] general protection fault, probably for non-canonical
address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN PTI
[ 14.478701] KASAN: null-ptr-deref in range
[0x0000000000000028-0x000000000000002f]
[ 14.479922] RIP: 0010:vdpa_mgmtdev_unregister+0x39/0x150
[ 14.484063] Call Trace:
[ 14.484186] <TASK>
[ 14.484292] ? _raw_spin_unlock_irqrestore+0x3d/0x60
[ 14.484536] ifcvf_remove+0x3a/0x50 [ifcvf]
[ 14.484743] pci_device_remove+0x92/0x240

The reason is that the 'ifcvf_mgmt_dev' is zero which means that
ifcvf_vdpa_dev_add() was not executed.
Since I am not familiar with the driver, I cannot find a proper solution for it.

Zheyu Ma


2022-05-23 06:54:11

by Zheyu Ma

[permalink] [raw]
Subject: Re: [BUG] vDPA/ifcvf: got a warning when removing the module

On Mon, May 23, 2022 at 12:15 PM Jason Wang <[email protected]> wrote:
>
> On Sat, May 21, 2022 at 10:27 PM Zheyu Ma <[email protected]> wrote:
> >
> > Hello,
> >
> > I found a bug in the ifcvf driver.
> > When removing the module, I got the following warning:
> >
> > [ 14.478123] general protection fault, probably for non-canonical
> > address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN PTI
> > [ 14.478701] KASAN: null-ptr-deref in range
> > [0x0000000000000028-0x000000000000002f]
> > [ 14.479922] RIP: 0010:vdpa_mgmtdev_unregister+0x39/0x150
> > [ 14.484063] Call Trace:
> > [ 14.484186] <TASK>
> > [ 14.484292] ? _raw_spin_unlock_irqrestore+0x3d/0x60
> > [ 14.484536] ifcvf_remove+0x3a/0x50 [ifcvf]
> > [ 14.484743] pci_device_remove+0x92/0x240
> >
> > The reason is that the 'ifcvf_mgmt_dev' is zero which means that
> > ifcvf_vdpa_dev_add() was not executed.
> > Since I am not familiar with the driver, I cannot find a proper solution for it.
> >
>
> Looks like the drv data needs to be set in probe(). Could you pleas
> try to the attached patch? (compile test only).

This patch works for me, thanks!

Tested-by: Zheyu Ma <[email protected]>

Regards,
Zheyu Ma

2022-05-23 07:53:37

by Jason Wang

[permalink] [raw]
Subject: Re: [BUG] vDPA/ifcvf: got a warning when removing the module

On Sat, May 21, 2022 at 10:27 PM Zheyu Ma <[email protected]> wrote:
>
> Hello,
>
> I found a bug in the ifcvf driver.
> When removing the module, I got the following warning:
>
> [ 14.478123] general protection fault, probably for non-canonical
> address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN PTI
> [ 14.478701] KASAN: null-ptr-deref in range
> [0x0000000000000028-0x000000000000002f]
> [ 14.479922] RIP: 0010:vdpa_mgmtdev_unregister+0x39/0x150
> [ 14.484063] Call Trace:
> [ 14.484186] <TASK>
> [ 14.484292] ? _raw_spin_unlock_irqrestore+0x3d/0x60
> [ 14.484536] ifcvf_remove+0x3a/0x50 [ifcvf]
> [ 14.484743] pci_device_remove+0x92/0x240
>
> The reason is that the 'ifcvf_mgmt_dev' is zero which means that
> ifcvf_vdpa_dev_add() was not executed.
> Since I am not familiar with the driver, I cannot find a proper solution for it.
>

Looks like the drv data needs to be set in probe(). Could you pleas
try to the attached patch? (compile test only).

Thanks

> Zheyu Ma
>


Attachments:
0001-vdpa-ifcvf-set-pci-driver-data-in-probe.patch (1.24 kB)