* [PATCH] net: fix incorrect return code
@ 2021-11-24 10:01 liuguoqiang
2021-11-24 10:12 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: liuguoqiang @ 2021-11-24 10:01 UTC (permalink / raw)
To: johannes; +Cc: davem, kuba, linux-wireless, liuguoqiang
In drv_can_aggregate_in_amsdu, when ops->can_aggregate_in_amsdu is NULL,
should return -EOPNOTSUPP rather than true.
Also check check_sdata_in_driver's return code, exit called when failed.
Signed-off-by: liuguoqiang <liuguoqiang@uniontech.com>
---
net/mac80211/driver-ops.h | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index cd3731cbf6c6..d0b3a5476d28 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1241,7 +1241,7 @@ static inline int drv_can_aggregate_in_amsdu(struct ieee80211_local *local,
struct sk_buff *skb)
{
if (!local->ops->can_aggregate_in_amsdu)
- return true;
+ return -EOPNOTSUPP;
return local->ops->can_aggregate_in_amsdu(&local->hw, head, skb);
}
@@ -1303,7 +1303,8 @@ static inline int drv_start_nan(struct ieee80211_local *local,
int ret;
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
trace_drv_start_nan(local, sdata, conf);
ret = local->ops->start_nan(&local->hw, &sdata->vif, conf);
@@ -1315,7 +1316,8 @@ static inline void drv_stop_nan(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata)
{
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return;
trace_drv_stop_nan(local, sdata);
local->ops->stop_nan(&local->hw, &sdata->vif);
@@ -1330,7 +1332,8 @@ static inline int drv_nan_change_conf(struct ieee80211_local *local,
int ret;
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
if (!local->ops->nan_change_conf)
return -EOPNOTSUPP;
@@ -1350,7 +1353,8 @@ static inline int drv_add_nan_func(struct ieee80211_local *local,
int ret;
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
if (!local->ops->add_nan_func)
return -EOPNOTSUPP;
@@ -1367,7 +1371,8 @@ static inline void drv_del_nan_func(struct ieee80211_local *local,
u8 instance_id)
{
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return;
trace_drv_del_nan_func(local, sdata, instance_id);
if (local->ops->del_nan_func)
@@ -1407,7 +1412,8 @@ static inline void drv_update_vif_offload(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata)
{
might_sleep();
- check_sdata_in_driver(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return;
if (!local->ops->update_vif_offload)
return;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: fix incorrect return code
2021-11-24 10:01 [PATCH] net: fix incorrect return code liuguoqiang
@ 2021-11-24 10:12 ` Johannes Berg
[not found] ` <tencent_32DC18DA2901E67504F97177@qq.com>
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2021-11-24 10:12 UTC (permalink / raw)
To: liuguoqiang; +Cc: davem, kuba, linux-wireless
On Wed, 2021-11-24 at 18:01 +0800, liuguoqiang wrote:
> In drv_can_aggregate_in_amsdu, when ops->can_aggregate_in_amsdu is NULL,
> should return -EOPNOTSUPP rather than true.
>
No, this is wrong, the return type is actually wrong.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 回复:[PATCH] net: fix incorrect return code
[not found] ` <tencent_32DC18DA2901E67504F97177@qq.com>
@ 2021-11-24 10:50 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2021-11-24 10:50 UTC (permalink / raw)
To: 刘国强; +Cc: davem, kuba, linux-wireless
On Wed, 2021-11-24 at 18:29 +0800, 刘国强 wrote:
> which return type is wrong? EOPNOTSUPP or check_sdata_in_driver
The return *type* of drv_can_aggregate_in_amsdu() should be bool.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-24 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24 10:01 [PATCH] net: fix incorrect return code liuguoqiang
2021-11-24 10:12 ` Johannes Berg
[not found] ` <tencent_32DC18DA2901E67504F97177@qq.com>
2021-11-24 10:50 ` 回复:[PATCH] " Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.