Sfoglia il codice sorgente

qcacmn: Fix SKB double free issue in nl_srv_ucast

If netlink_unicast() fails it already frees SKB buffer hence
do not double free the SKB when netlink_unicast() returns failure.

Change-Id: I2aa99c47f99c573abbd281c06ff58fcb38aad76b
CRs-Fixed: 2022800
Rajeev Kumar 8 anni fa
parent
commit
a85d8b4ad7
1 ha cambiato i file con 8 aggiunte e 9 eliminazioni
  1. 8 9
      utils/nlink/src/wlan_nlink_srv.c

+ 8 - 9
utils/nlink/src/wlan_nlink_srv.c

@@ -147,15 +147,14 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
 
 	if (nl_srv_is_initialized() == 0) {
 		err = cnss_logger_nl_ucast(skb, dst_pid, flag);
-		if (err < 0) {
+		if (err < 0)
 			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
 				  "NLINK: netlink_unicast to pid[%d] failed, ret[%d]",
 				  dst_pid, err);
-			dev_kfree_skb(skb);
-		}
-	}
-	else
+	} else {
 		dev_kfree_skb(skb);
+	}
+
 	return err;
 }
 
@@ -567,14 +566,14 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
 
 	if (nl_srv_sock) {
 		err = netlink_unicast(nl_srv_sock, skb, dst_pid, flag);
-		if (err < 0) {
+		if (err < 0)
 			QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
 				  "NLINK: netlink_unicast to pid[%d] failed, ret[%d]",
 				  dst_pid, err);
-			dev_kfree_skb(skb);
-		}
-	} else
+	} else {
 		dev_kfree_skb(skb);
+	}
+
 	return err;
 }