linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bluetooth:Fix error handling in the function hci_inquiry_cache_update
@ 2015-08-19 16:36 Nicholas Krause
  2015-08-24  9:58 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Krause @ 2015-08-19 16:36 UTC (permalink / raw)
  To: marcel; +Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev,
	linux-kernel

This fixes error handling in the function hci_inquiry_cache_update
for checking if the call to the function hci_remove_oob_data has
failed by returning the error code -ENOENT and if so exit immediately
to the caller of the function hci_inquiry_cache_update by returning
the error code -ENOENT to signal that the call to this function has
failed.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 net/bluetooth/hci_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2f8fb33..ae1bb3d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1136,7 +1136,8 @@ u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
 
 	BT_DBG("cache %p, %pMR", cache, &data->bdaddr);
 
-	hci_remove_remote_oob_data(hdev, &data->bdaddr, BDADDR_BREDR);
+	if (hci_remove_remote_oob_data(hdev, &data->bdaddr, BDADDR_BREDR))
+		return -ENOENT;
 
 	if (!data->ssp_mode)
 		flags |= MGMT_DEV_FOUND_LEGACY_PAIRING;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bluetooth:Fix error handling in the function hci_inquiry_cache_update
  2015-08-19 16:36 [PATCH] bluetooth:Fix error handling in the function hci_inquiry_cache_update Nicholas Krause
@ 2015-08-24  9:58 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2015-08-24  9:58 UTC (permalink / raw)
  To: Nicholas Krause; +Cc: linux-bluetooth

Hi Nicholas,

(again unneeded recipients removed from CC)

On Wed, Aug 19, 2015, Nicholas Krause wrote:
> This fixes error handling in the function hci_inquiry_cache_update
> for checking if the call to the function hci_remove_oob_data has
> failed by returning the error code -ENOENT and if so exit immediately
> to the caller of the function hci_inquiry_cache_update by returning
> the error code -ENOENT to signal that the call to this function has
> failed.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  net/bluetooth/hci_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 2f8fb33..ae1bb3d 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1136,7 +1136,8 @@ u32 hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data,
>  
>  	BT_DBG("cache %p, %pMR", cache, &data->bdaddr);
>  
> -	hci_remove_remote_oob_data(hdev, &data->bdaddr, BDADDR_BREDR);
> +	if (hci_remove_remote_oob_data(hdev, &data->bdaddr, BDADDR_BREDR))
> +		return -ENOENT;
>  
>  	if (!data->ssp_mode)
>  		flags |= MGMT_DEV_FOUND_LEGACY_PAIRING;

This patch is wrong for several reasons. Firstly, this function returns
returns u32 so trying to return -ENOENT makes no sense. Secondly, it's
normal for hci_remove_remote_oob_data() to fail in this scenario so we
can safely ignore its return value.

Johan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-24  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 16:36 [PATCH] bluetooth:Fix error handling in the function hci_inquiry_cache_update Nicholas Krause
2015-08-24  9:58 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).