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] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ec86c10-3cef-d806-2e27-c99a12704288@bitwise.fi>
Date:   Mon, 30 May 2022 13:55:41 +0300
From:   Anssi Hannula <anssi.hannula@...wise.fi>
To:     Jimmy Assarsson <extja@...ser.com>
Cc:     linux-can@...r.kernel.org, Marc Kleine-Budde <mkl@...gutronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/12] can: kvaser_usb_leaf: Fix silently failing bus
 params setup

On 28.5.2022 10.37, Jimmy Assarsson wrote:
> On 5/16/22 15:47, Anssi Hannula wrote:
>> The device may reject bus params with cmd 45, which is an unhandled
>> error event that does not contain any channel reference.
>>
>> In such cases set_bittiming() callback returns 0 so upper levels will
>> think setting bitrate succeeded and proceed with starting the interface
>> with wrong parameters, causing bus errors (the kernel log will have
>> "Unhandled command (45)", though).
>>
>> Fix that by verifying the bus params took hold by reading them back.
>>
>> Also, add a handler for cmd 45 that simply prints out the error.
>>
>> This condition can be triggered on 0bfd:0124 Kvaser Mini PCI Express
>> 2xHS FW 4.18.778 by trying to set bitrate 1300000 and on 0bfd:0124
>> Kvaser Mini PCI Express 2xHS FW 4.18.778 by trying to set bitrate
>> 1000000.
> The device will send cmd CMD_ERROR_EVENT (45) when invalid data is
> received from the driver and should never occur. CMD_ERROR_EVENT
> indicates a misbehaving driver.
>
> For the Kvaser Mini PCI Express 2xHS case, the problem is settings
> resulting in prescaler equal to 1 are not accepted. This is a bug in the
> firmware and will be fixed in our next release.
>
> And for Kvaser Memorator Professional HS/HS, the can_bittiming_const
> limits are not correct.
> I'll have to look into this a bit more. I'm pretty sure we endup with
> three different can_bittiming_const in kvaser_usb_leaf, depedning on
> firmware/microcontroller.
>
> I created new patches for the CMD_ERROR_EVENT, based on your patch.
> See at end of this mail.
>
> I prefere if we can avoid the paramter readback and
> kvaser_usb_setup_rx_urbs() in kvaser_usb_leaf_set_bittiming().
> With correct can_bittiming_const limits this should not be an issue.
> On the otherhand, since there are existing devices with a bug that will
> reject parameters that are within the correct limits, and the result
> silently failing calls, I cannot see any alternative...
>
> If it ok with you I'll create a new patch based on your readback fix,
> and also implement this in kvaser_usb_hydra?

All OK for me.

-- 
Anssi Hannula / Bitwise Oy
+358 503803997

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ