Skip to contentSkip to conversation

net: fix incorrect return code

PATCH In review liuguoqiang 2 participants 3 messages Nov 24, 2021 1 message not in the archive mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix incorrect return code

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.

---
 net/mac80211/driver-ops.h | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
net/mac80211/driver-ops.h +13 -7
index cd3731cbf6c6..d0b3a5476d28 100644
@@ -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;
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 3 lines · liuguoqiang

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#3 lore raw
Quoted 1 line · 刘国强

which return type is wrong? EOPNOTSUPP or check_sdata_in_driver

The return *type* of drv_can_aggregate_in_amsdu() should be bool.

johannes