lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6cbe3d6e-c3f1-9d85-ade6-57cd626bd4b8@hartkopp.net>
Date:   Wed, 24 Nov 2021 10:13:02 +0100
From:   Oliver Hartkopp <socketcan@...tkopp.net>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Wolfgang Grandegger <wg@...ndegger.com>,
        Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Leon Romanovsky <leon@...nel.org>,
        Markus Plessing <plessing@...-wuensche.com>,
        linux-can@...r.kernel.org, netdev@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2 net] can: sja1000: fix use after free in
 ems_pcmcia_add_card()



On 24.11.21 09:57, Dan Carpenter wrote:
> On Wed, Nov 24, 2021 at 08:37:27AM +0100, Oliver Hartkopp wrote:
>> Hello Dan,
>>
>> On 24.11.21 07:56, Dan Carpenter wrote:
>>> If the last channel is not available then "dev" is freed.  Fortunately,
>>> we can just use "pdev->irq" instead.
>>
>> But in the case that we do not find any channel the irq for the card is
>> still requested (via pdev->irq).
>>
>>>
>>> Fixes: fd734c6f25ae ("can/sja1000: add driver for EMS PCMCIA card")
>>> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>>> ---
>>> v2: In the first version, I just failed the probe.  Sorry about that.
>>>
>>>    drivers/net/can/sja1000/ems_pcmcia.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/can/sja1000/ems_pcmcia.c b/drivers/net/can/sja1000/ems_pcmcia.c
>>> index e21b169c14c0..391a8253ed6f 100644
>>> --- a/drivers/net/can/sja1000/ems_pcmcia.c
>>> +++ b/drivers/net/can/sja1000/ems_pcmcia.c
>>> @@ -234,7 +234,7 @@ static int ems_pcmcia_add_card(struct pcmcia_device *pdev, unsigned long base)
>>>    			free_sja1000dev(dev);
>>>    	}
>>> -	err = request_irq(dev->irq, &ems_pcmcia_interrupt, IRQF_SHARED,
>>
>> When adding this check, we should be fine:
>>
>> +	if (card->channels)
> 
> Sure,  I will send a v3 with that.

With these discussed changes you might directly add my

Tested-by: Oliver Hartkopp <socketcan@...tkopp.net>

Thanks,
Oliver

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ