FAILED: patch "[PATCH] staging: rtl8712: error handling refactoring" failed to apply to 5.4-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e9e6aa51b2735d83a67d9fa0119cf11abef80d99 Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <[email protected]>
Date: Wed, 21 Jul 2021 22:34:47 +0300
Subject: [PATCH] staging: rtl8712: error handling refactoring
There was strange error handling logic in case of fw load failure. For some reason fw loader callback was doing clean up stuff when fw is not available. I don't see any reason behind doing this. Since this driver doesn't have EEPROM firmware let's just disconnect it in case of fw load failure. Doing clean up stuff in 2 different place which can run concurently is not good idea and syzbot found 2 bugs related to this strange approach.
So, in this pacth I deleted all clean up code from fw callback and made a call to device_release_driver() under device_lock(parent) in case of fw load failure. This approach is more generic and it defend driver from UAF bugs, since all clean up code is moved to one place.
drivers/staging/rtl8712/hal_init.c +20 -10
@@ -29,21 +29,31 @@#define FWBUFF_ALIGN_SZ 512#define MAX_DUMP_FWSZ (48 * 1024) +static void rtl871x_load_fw_fail (struct _adapter *adapter) +{ +struct usb_device *udev = adapter->dvobjpriv.pusbdev; +struct device *dev = &udev->dev; +struct device *parent = dev->parent; + +complete (&adapter->rtl8712_fw_ready); + +dev_err (&udev->dev,"r8712u: Firmware request failed\n" ); + +if (parent) +device_lock (parent); + +device_release_driver (dev); + +if (parent) +device_unlock (parent); +} +static void rtl871x_load_fw_cb (const struct firmware *firmware,void *context) {struct _adapter *adapter = context;if (!firmware) { -struct usb_device *udev = adapter->dvobjpriv.pusbdev; -struct usb_interface *usb_intf = adapter->pusb_intf; - -dev_err (&udev->dev,"r8712u: Firmware request failed\n" ); -usb_put_dev (udev); -usb_set_intfdata (usb_intf,NULL ); -r8712_free_drv_sw (adapter); - adapter->dvobj_deinit (adapter); -complete (&adapter->rtl8712_fw_ready); -free_netdev (adapter->pnetdev); +rtl871x_load_fw_fail (adapter);return ; } adapter->fw = firmware;
drivers/staging/rtl8712/usb_intf.c +23 -29
59 lines not on this page · raw message
Quoted 10 lines · On 8/9/21 12:48 PM, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
Hi, Greg!
Should I rewrote this patch to make it applicable to 5.4-stable? I believe, that following patch "staging: rtl8712: get rid of flush_scheduled_work" makes no sense without this one.
With regards,
Pavel Skripkin
Greg KH
maintainerQuoted 11 lines · Pavel Skripkin
Quoted 8 lines · On 8/9/21 12:48 PM, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
Quoted 8 lines
Quoted 2 lines
greg k-h
Hi, Greg!
Should I rewrote this patch to make it applicable to 5.4-stable? I believe, that following patch "staging: rtl8712: get rid of
flush_scheduled_work" makes no sense without this one.
That makes sense, please provide a working backport if you think it should go to this tree.
thanks,
greg k-h