Re: [PATCH] driver core: fix driver_set_override() issue with empty strings

From: Krzysztof Kozlowski
Date: Mon Sep 05 2022 - 02:37:15 EST


On 01/09/2022 19:37, Greg Kroah-Hartman wrote:
> Python likes to send an empty string for some sysfs files, including the
> driver_override field. When commit 23d99baf9d72 ("PCI: Use
> driver_set_override() instead of open-coding") moved the PCI core to use
> the driver core function instead of hand-rolling their own handler, this
> showed up as a regression from some userspace tools, like DPDK.
>
> Fix this up by actually looking at the length of the string first
> instead of trusting that userspace got it correct.
>
> Reported-by: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
> Fixes: 23d99baf9d72 ("PCI: Use driver_set_override() instead of open-coding")
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
> Cc: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> Cc: stable <stable@xxxxxxxxxx>
> Tested-by: Huisong Li <lihuisong@xxxxxxxxxx>


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>


Best regards,
Krzysztof