* [PATCH v1] att: Check security level before setting
@ 2024-11-20 8:04 Jiayang Mao
2024-11-20 8:22 ` [v1] " bluez.test.bot
2024-11-20 14:20 ` [PATCH v1] " Luiz Augusto von Dentz
0 siblings, 2 replies; 4+ messages in thread
From: Jiayang Mao @ 2024-11-20 8:04 UTC (permalink / raw)
To: linux-bluetooth; +Cc: quic_chejiang, quic_jiaymao
bt_gatt_client_set_security could fail if the security level in
kernel is already BT_ATT_SECURITY_MEDIUM but long term key is not
ready. So, get and check the security level before setting it.
Signed-off-by: Jiayang Mao <quic_jiaymao@quicinc.com>
---
src/shared/att.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/shared/att.c b/src/shared/att.c
index 4a406f4b9..dabbdb431 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -727,6 +727,9 @@ static bool bt_att_chan_set_security(struct bt_att_chan *chan, int level)
{
struct bt_security sec;
+ if (level == bt_att_chan_get_security(chan))
+ return true;
+
if (chan->type == BT_ATT_LOCAL) {
chan->sec_level = level;
return true;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [v1] att: Check security level before setting
2024-11-20 8:04 [PATCH v1] att: Check security level before setting Jiayang Mao
@ 2024-11-20 8:22 ` bluez.test.bot
2024-11-20 14:20 ` [PATCH v1] " Luiz Augusto von Dentz
1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-11-20 8:22 UTC (permalink / raw)
To: linux-bluetooth, quic_jiaymao
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
----- Output -----
error: patch failed: src/shared/att.c:727
error: src/shared/att.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Please resolve the issue and submit the patches again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] att: Check security level before setting
2024-11-20 8:04 [PATCH v1] att: Check security level before setting Jiayang Mao
2024-11-20 8:22 ` [v1] " bluez.test.bot
@ 2024-11-20 14:20 ` Luiz Augusto von Dentz
2024-11-20 14:37 ` Jiayang Mao
1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2024-11-20 14:20 UTC (permalink / raw)
To: Jiayang Mao; +Cc: linux-bluetooth, quic_chejiang
Hi Jiayang,
On Wed, Nov 20, 2024 at 3:18 AM Jiayang Mao <quic_jiaymao@quicinc.com> wrote:
>
> bt_gatt_client_set_security could fail if the security level in
> kernel is already BT_ATT_SECURITY_MEDIUM but long term key is not
> ready. So, get and check the security level before setting it.
Ive already pushed a similar fix.
> Signed-off-by: Jiayang Mao <quic_jiaymao@quicinc.com>
> ---
> src/shared/att.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/src/shared/att.c b/src/shared/att.c
> index 4a406f4b9..dabbdb431 100644
> --- a/src/shared/att.c
> +++ b/src/shared/att.c
> @@ -727,6 +727,9 @@ static bool bt_att_chan_set_security(struct bt_att_chan *chan, int level)
> {
> struct bt_security sec;
>
> + if (level == bt_att_chan_get_security(chan))
> + return true;
> +
> if (chan->type == BT_ATT_LOCAL) {
> chan->sec_level = level;
> return true;
> --
> 2.25.1
>
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] att: Check security level before setting
2024-11-20 14:20 ` [PATCH v1] " Luiz Augusto von Dentz
@ 2024-11-20 14:37 ` Jiayang Mao
0 siblings, 0 replies; 4+ messages in thread
From: Jiayang Mao @ 2024-11-20 14:37 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On 2024/11/20 22:20, Luiz Augusto von Dentz wrote:
> Hi Jiayang,
>
> On Wed, Nov 20, 2024 at 3:18 AM Jiayang Mao <quic_jiaymao@quicinc.com> wrote:
>>
>> bt_gatt_client_set_security could fail if the security level in
>> kernel is already BT_ATT_SECURITY_MEDIUM but long term key is not
>> ready. So, get and check the security level before setting it.
>
> Ive already pushed a similar fix.
I just saw your fix. Thank you very much for the update!
>
>> Signed-off-by: Jiayang Mao <quic_jiaymao@quicinc.com>
>> ---
>> src/shared/att.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/src/shared/att.c b/src/shared/att.c
>> index 4a406f4b9..dabbdb431 100644
>> --- a/src/shared/att.c
>> +++ b/src/shared/att.c
>> @@ -727,6 +727,9 @@ static bool bt_att_chan_set_security(struct bt_att_chan *chan, int level)
>> {
>> struct bt_security sec;
>>
>> + if (level == bt_att_chan_get_security(chan))
>> + return true;
>> +
>> if (chan->type == BT_ATT_LOCAL) {
>> chan->sec_level = level;
>> return true;
>> --
>> 2.25.1
>>
>>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-20 14:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-20 8:04 [PATCH v1] att: Check security level before setting Jiayang Mao
2024-11-20 8:22 ` [v1] " bluez.test.bot
2024-11-20 14:20 ` [PATCH v1] " Luiz Augusto von Dentz
2024-11-20 14:37 ` Jiayang Mao
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).