Bug 200519

Summary: Missing check of the return value of devm_clk_get() in function bcm_get_resources()
Product: Drivers Reporter: Jason Wood (jasonwood2031)
Component: BluetoothAssignee: linux-bluetooth (linux-bluetooth)
Status: RESOLVED PATCH_ALREADY_AVAILABLE    
Severity: normal    
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: v4.18-rc4 Subsystem:
Regression: No Bisected commit-id:

Description Jason Wood 2018-07-17 08:04:25 UTC
Function bcm_get_resources() defined in drivers/bluetooth/hci_bcm.c calls devm_clk_get() which may return ERR_PTR(-ENOMEM). However, bcm_get_resources() misses the return value check of devm_clk_get(). Codes related to this bug are shown as follows.

drivers/bluetooth/hci_bcm.c:
  906  		return 0;
  907  
  908: 	dev->clk = devm_clk_get(dev->dev, NULL);
  909  
  910  	dev->device_wakeup = devm_gpiod_get_optional(dev->dev, "device-wakeup",
  911						     GPIOD_OUT_LOW);
Comment 1 Jason Wood 2018-09-13 10:40:42 UTC
We have sent the patch to the developers. Currently, we're formatting the patch according to the Linux development documentation.