mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-19 14:26:01 -04:00
fix(vfs): Fix event_write may not exit critical section
This commit fixes the event_write() function where the critical section was unbalanced. Merges https://github.com/espressif/esp-idf/pull/12258
This commit is contained in:
parent
e9d442d2b7
commit
7ca602e86b
@ -1,16 +1,8 @@
|
|||||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
/*
|
||||||
//
|
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
// you may not use this file except in compliance with the License.
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
// You may obtain a copy of the License at
|
*/
|
||||||
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License
|
|
||||||
|
|
||||||
|
|
||||||
#include "esp_vfs_eventfd.h"
|
#include "esp_vfs_eventfd.h"
|
||||||
@ -275,14 +267,14 @@ static ssize_t event_write(int fd, const void *data, size_t size)
|
|||||||
s_events[fd].value += *val;
|
s_events[fd].value += *val;
|
||||||
ret = size;
|
ret = size;
|
||||||
trigger_select_for_event(&s_events[fd]);
|
trigger_select_for_event(&s_events[fd]);
|
||||||
|
|
||||||
if (s_events[fd].support_isr) {
|
|
||||||
portEXIT_CRITICAL(&s_events[fd].data_spin_lock);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s_events[fd].support_isr) {
|
||||||
|
portEXIT_CRITICAL(&s_events[fd].data_spin_lock);
|
||||||
|
}
|
||||||
_lock_release_recursive(&s_events[fd].lock);
|
_lock_release_recursive(&s_events[fd].lock);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user