mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-20 05:16:50 +07:00
4c62764d0f
While running regressions, observed below kernel panic when sdio disconnect called. This is because of, kthread_stop() is taking care of wait_for_completion() by default. When wait_for_completion triggered in kthread_stop and as it was done already, giving kernel panic. Hence, removing redundant wait_for_completion() from rsi_kill_thread(). ... skipping ... BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff810a63df>] exit_creds+0x1f/0x50 PGD 0 Oops: 0002 [#1] SMP CPU: 0 PID: 6502 Comm: rmmod Tainted: G OE 4.15.9-Generic #154-Ubuntu Hardware name: Dell Inc. Edge Gateway 3003/ , BIOS 01.00.00 04/17/2017 Stack: ffff88007392e600 ffff880075847dc0 ffffffff8108160a 0000000000000000 ffff88007392e600 ffff880075847de8 ffffffff810a484b ffff880076127000 ffff88003cd3a800 ffff880074f12a00 ffff880075847e28 ffffffffc09bed15 Call Trace: [<ffffffff8108160a>] __put_task_struct+0x5a/0x140 [<ffffffff810a484b>] kthread_stop+0x10b/0x110 [<ffffffffc09bed15>] rsi_disconnect+0x2f5/0x300 [ven_rsi_sdio] [<ffffffff81578bcb>] ? __pm_runtime_resume+0x5b/0x80 [<ffffffff816f0918>] sdio_bus_remove+0x38/0x100 [<ffffffff8156cc64>] __device_release_driver+0xa4/0x150 [<ffffffff8156d7a5>] driver_detach+0xb5/0xc0 [<ffffffff8156c6c5>] bus_remove_driver+0x55/0xd0 [<ffffffff8156dfbc>] driver_unregister+0x2c/0x50 [<ffffffff816f0b8a>] sdio_unregister_driver+0x1a/0x20 [<ffffffffc09bf0f5>] rsi_module_exit+0x15/0x30 [ven_rsi_sdio] [<ffffffff8110cad8>] SyS_delete_module+0x1b8/0x210 [<ffffffff81851dc8>] entry_SYSCALL_64_fastpath+0x1c/0xbb Signed-off-by: Siva Rebbagondla <siva.rebbagondla@redpinesignals.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
93 lines
2.9 KiB
C
93 lines
2.9 KiB
C
/**
|
|
* Copyright (c) 2014 Redpine Signals Inc.
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
|
|
#ifndef __RSI_COMMON_H__
|
|
#define __RSI_COMMON_H__
|
|
|
|
#include <linux/kthread.h>
|
|
|
|
#define EVENT_WAIT_FOREVER 0
|
|
#define FIRMWARE_RSI9113 "rs9113_wlan_qspi.rps"
|
|
#define QUEUE_NOT_FULL 1
|
|
#define QUEUE_FULL 0
|
|
|
|
static inline int rsi_init_event(struct rsi_event *pevent)
|
|
{
|
|
atomic_set(&pevent->event_condition, 1);
|
|
init_waitqueue_head(&pevent->event_queue);
|
|
return 0;
|
|
}
|
|
|
|
static inline int rsi_wait_event(struct rsi_event *event, u32 timeout)
|
|
{
|
|
int status = 0;
|
|
|
|
if (!timeout)
|
|
status = wait_event_interruptible(event->event_queue,
|
|
(atomic_read(&event->event_condition) == 0));
|
|
else
|
|
status = wait_event_interruptible_timeout(event->event_queue,
|
|
(atomic_read(&event->event_condition) == 0),
|
|
timeout);
|
|
return status;
|
|
}
|
|
|
|
static inline void rsi_set_event(struct rsi_event *event)
|
|
{
|
|
atomic_set(&event->event_condition, 0);
|
|
wake_up_interruptible(&event->event_queue);
|
|
}
|
|
|
|
static inline void rsi_reset_event(struct rsi_event *event)
|
|
{
|
|
atomic_set(&event->event_condition, 1);
|
|
}
|
|
|
|
static inline int rsi_create_kthread(struct rsi_common *common,
|
|
struct rsi_thread *thread,
|
|
void *func_ptr,
|
|
u8 *name)
|
|
{
|
|
init_completion(&thread->completion);
|
|
atomic_set(&thread->thread_done, 0);
|
|
thread->task = kthread_run(func_ptr, common, "%s", name);
|
|
if (IS_ERR(thread->task))
|
|
return (int)PTR_ERR(thread->task);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline int rsi_kill_thread(struct rsi_thread *handle)
|
|
{
|
|
atomic_inc(&handle->thread_done);
|
|
rsi_set_event(&handle->event);
|
|
|
|
return kthread_stop(handle->task);
|
|
}
|
|
|
|
void rsi_mac80211_detach(struct rsi_hw *hw);
|
|
u16 rsi_get_connected_channel(struct ieee80211_vif *vif);
|
|
struct rsi_hw *rsi_91x_init(u16 oper_mode);
|
|
void rsi_91x_deinit(struct rsi_hw *adapter);
|
|
int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len);
|
|
#ifdef CONFIG_PM
|
|
int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan);
|
|
#endif
|
|
struct rsi_sta *rsi_find_sta(struct rsi_common *common, u8 *mac_addr);
|
|
struct ieee80211_vif *rsi_get_vif(struct rsi_hw *adapter, u8 *mac);
|
|
void rsi_roc_timeout(struct timer_list *t);
|
|
#endif
|