[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c087ba2c-7839-02d1-a522-b104d8ffb8d2@gmail.com>
Date: Thu, 22 Apr 2021 09:50:47 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Joe Burmeister <joe.burmeister@...tank.co.uk>,
Mark Brown <broonie@...nel.org>, Ray Jui <rjui@...adcom.com>,
Scott Branden <sbranden@...adcom.com>,
bcm-kernel-feedback-list@...adcom.com,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
linux-spi@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: bcm2835: Fix buffer overflow with CS able to go
beyond limit.
On 4/20/2021 1:34 AM, Joe Burmeister wrote:
> It was previoulsy possible to have a device tree with more chips than
> the driver supports and go off the end of CS arrays.
Do you mind walking me through the code how that could have happened? We
have spi_register_controller() call of_spi_get_gpio_numbers() which has
the following:
ctlr->num_chipselect = max_t(int, nb, ctlr->num_chipselect);
such that what the controller has is the maximum between the number of
'cs-gpios' properties parsed and what was already populated in
ctrl->num_chipselect during bcm2835_spi_probe(), which for this driver
is BCM2835_SPI_NUM_CS (3).
>
> This patches inforces CS limit but sets that limit to the max of the
> default limit and what is in the device tree when driver is loaded.
>
> Signed-off-by: Joe Burmeister <joe.burmeister@...tank.co.uk>
You have changed many more things that just enforcing a limit on
BCM2835_SPI_NUM_CS you have now made all chip-select related data
structuresd dynamically allocated and you have changed a number of
prints to use the shorthand "dev" instead of &pdev->dev.
--
Florian
Powered by blists - more mailing lists