Re: [PATCH v1] att: Check security level before setting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jiayang,

On Wed, Nov 20, 2024 at 3:18 AM Jiayang Mao <quic_jiaymao@xxxxxxxxxxx> 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@xxxxxxxxxxx>
> ---
>  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





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux