[Feature][ZXW-452]merge P54U02 version
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I17e6795ab66e2b9d1cbbfec4b7c0028d666e177d
diff --git a/ap/os/linux/linux-3.4.x/net/socket_rpmsg.c b/ap/os/linux/linux-3.4.x/net/socket_rpmsg.c
index a42bfc2..8b225b6 100755
--- a/ap/os/linux/linux-3.4.x/net/socket_rpmsg.c
+++ b/ap/os/linux/linux-3.4.x/net/socket_rpmsg.c
@@ -80,6 +80,9 @@
DEFINE_SPINLOCK(sock_release_peer_lock);
EXPORT_SYMBOL_GPL(sock_release_peer_lock);
+DEFINE_SPINLOCK(sock_socketaddr_table_lock);
+EXPORT_SYMBOL_GPL(sock_socketaddr_table_lock);
+
static struct dentry *ipcsocket_debugfs_dir_entry_root;
static struct dentry *ipcsocket_debugfs_dir_entry_proc;
@@ -622,15 +625,15 @@
{
struct sock_sunaddr_info *p;
struct hlist_node *pos,*n;
-
+ spin_lock(&sock_socketaddr_table_lock);
hlist_for_each_entry_safe(p, pos, n, &g_sunaddr_info, hlist_node) {
if((p->sockaddr.sun_family == psockaddr_un->sun_family) \
&&(0 == memcmp(p->sockaddr.sun_path, psockaddr_un->sun_path, UNIX_PATH_MAX))){
-
+ spin_unlock(&sock_socketaddr_table_lock);
return true;
}
}
-
+ spin_unlock(&sock_socketaddr_table_lock);
return false;
}
@@ -653,7 +656,9 @@
memcpy(&psock_sunaddr_info->sockaddr, psockaddr_un, sizeof(struct sockaddr_un));
INIT_HLIST_NODE(&psock_sunaddr_info->hlist_node);
- hlist_add_head(&psock_sunaddr_info->hlist_node, &g_sunaddr_info);
+ spin_lock(&sock_socketaddr_table_lock);
+ hlist_add_head(&psock_sunaddr_info->hlist_node, &g_sunaddr_info);
+ spin_unlock(&sock_socketaddr_table_lock);
}
static int sock_soc_del_ipc_sunaddr(struct sockaddr_un *psockaddr_un)
@@ -661,6 +666,7 @@
struct sock_sunaddr_info *p;
struct hlist_node *pos,*n;
int ret;
+ spin_lock(&sock_socketaddr_table_lock);
hlist_for_each_entry_safe(p, pos, n, &g_sunaddr_info, hlist_node) {
if(psockaddr_un->sun_path[0]){
ret = strncmp(p->sockaddr.sun_path, psockaddr_un->sun_path, strlen(psockaddr_un->sun_path));
@@ -672,10 +678,12 @@
hlist_del(&p->hlist_node);
kfree(p);
sk_soc_info("sun_path=%s, del sucess.", psockaddr_un->sun_path);
+ spin_unlock(&sock_socketaddr_table_lock);
return 0;
}
}
sk_soc_info("sun_path=%s, del failed", psockaddr_un->sun_path);
+ spin_unlock(&sock_socketaddr_table_lock);
return -1;
}