diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-03 14:36:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-03 14:36:27 -0400 |
commit | 1d1fdd95df681f0c065d90ffaafa215a0e8825e2 (patch) | |
tree | 19016e131bb5c7eb280a4cc8dff864ba36e53be4 /tools | |
parent | b3b49114c80e799af8b08c0c6d1ff886ea843f03 (diff) | |
parent | 3cc1f95283a125cf54ccf1e25065321d4385133b (diff) |
Merge tag 'char-misc-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc patches from Greg KH:
"Here is the big char/misc driver pull request for 3.12-rc1
Lots of driver updates all over the char/misc tree, full details in
the shortlog"
* tag 'char-misc-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (62 commits)
drivers: uio: Kconfig: add MMU dependancy for UIO
drivers: uio: Add driver for Humusoft MF624 DAQ PCI card
drivers: uio_pdrv_genirq: use dev_get_platdata()
drivers: uio_pruss: use dev_get_platdata()
drivers: uio_dmem_genirq: use dev_get_platdata()
drivers: parport: Kconfig: exclude h8300 for PARPORT_PC
drivers: misc: ti-st: fix potential race if st_kim_start fails
Drivers: hv: vmbus: Do not attempt to negoatiate a new version prematurely
misc: vmw_balloon: Remove braces to fix build for clang.
Drivers: hv: vmbus: Fix a bug in the handling of channel offers
vme: vme_ca91cx42.c: fix to pass correct device identity to free_irq()
VMCI: Add support for virtual IOMMU
VMCI: Remove non-blocking/pinned queuepair support
uio: uio_pruss: remove unnecessary platform_set_drvdata()
parport: amiga: remove unnecessary platform_set_drvdata()
vme: vme_vmivme7805.c: add missing __iomem annotation
vme: vme_ca91cx42.c: add missing __iomem annotation
vme: vme_tsi148.c: add missing __iomem annotation
drivers/misc/hpilo: Correct panic when an AUX iLO is detected
uio: drop unused vma_count member in uio_device struct
...
Diffstat (limited to 'tools')
-rw-r--r-- | tools/hv/hv_kvp_daemon.c | 44 | ||||
-rw-r--r-- | tools/hv/hv_vss_daemon.c | 59 |
2 files changed, 65 insertions, 38 deletions
diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 07819bfa7dba..8fd9ec66121c 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c | |||
@@ -79,8 +79,6 @@ enum { | |||
79 | DNS | 79 | DNS |
80 | }; | 80 | }; |
81 | 81 | ||
82 | static char kvp_send_buffer[4096]; | ||
83 | static char kvp_recv_buffer[4096 * 2]; | ||
84 | static struct sockaddr_nl addr; | 82 | static struct sockaddr_nl addr; |
85 | static int in_hand_shake = 1; | 83 | static int in_hand_shake = 1; |
86 | 84 | ||
@@ -1301,6 +1299,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) | |||
1301 | } | 1299 | } |
1302 | 1300 | ||
1303 | error = kvp_write_file(file, "HWADDR", "", mac_addr); | 1301 | error = kvp_write_file(file, "HWADDR", "", mac_addr); |
1302 | free(mac_addr); | ||
1304 | if (error) | 1303 | if (error) |
1305 | goto setval_error; | 1304 | goto setval_error; |
1306 | 1305 | ||
@@ -1346,7 +1345,6 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) | |||
1346 | goto setval_error; | 1345 | goto setval_error; |
1347 | 1346 | ||
1348 | setval_done: | 1347 | setval_done: |
1349 | free(mac_addr); | ||
1350 | fclose(file); | 1348 | fclose(file); |
1351 | 1349 | ||
1352 | /* | 1350 | /* |
@@ -1355,12 +1353,15 @@ setval_done: | |||
1355 | */ | 1353 | */ |
1356 | 1354 | ||
1357 | snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file); | 1355 | snprintf(cmd, sizeof(cmd), "%s %s", "hv_set_ifconfig", if_file); |
1358 | system(cmd); | 1356 | if (system(cmd)) { |
1357 | syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s", | ||
1358 | cmd, errno, strerror(errno)); | ||
1359 | return HV_E_FAIL; | ||
1360 | } | ||
1359 | return 0; | 1361 | return 0; |
1360 | 1362 | ||
1361 | setval_error: | 1363 | setval_error: |
1362 | syslog(LOG_ERR, "Failed to write config file"); | 1364 | syslog(LOG_ERR, "Failed to write config file"); |
1363 | free(mac_addr); | ||
1364 | fclose(file); | 1365 | fclose(file); |
1365 | return error; | 1366 | return error; |
1366 | } | 1367 | } |
@@ -1391,23 +1392,18 @@ kvp_get_domain_name(char *buffer, int length) | |||
1391 | static int | 1392 | static int |
1392 | netlink_send(int fd, struct cn_msg *msg) | 1393 | netlink_send(int fd, struct cn_msg *msg) |
1393 | { | 1394 | { |
1394 | struct nlmsghdr *nlh; | 1395 | struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE }; |
1395 | unsigned int size; | 1396 | unsigned int size; |
1396 | struct msghdr message; | 1397 | struct msghdr message; |
1397 | char buffer[64]; | ||
1398 | struct iovec iov[2]; | 1398 | struct iovec iov[2]; |
1399 | 1399 | ||
1400 | size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len); | 1400 | size = sizeof(struct cn_msg) + msg->len; |
1401 | 1401 | ||
1402 | nlh = (struct nlmsghdr *)buffer; | 1402 | nlh.nlmsg_pid = getpid(); |
1403 | nlh->nlmsg_seq = 0; | 1403 | nlh.nlmsg_len = NLMSG_LENGTH(size); |
1404 | nlh->nlmsg_pid = getpid(); | ||
1405 | nlh->nlmsg_type = NLMSG_DONE; | ||
1406 | nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); | ||
1407 | nlh->nlmsg_flags = 0; | ||
1408 | 1404 | ||
1409 | iov[0].iov_base = nlh; | 1405 | iov[0].iov_base = &nlh; |
1410 | iov[0].iov_len = sizeof(*nlh); | 1406 | iov[0].iov_len = sizeof(nlh); |
1411 | 1407 | ||
1412 | iov[1].iov_base = msg; | 1408 | iov[1].iov_base = msg; |
1413 | iov[1].iov_len = size; | 1409 | iov[1].iov_len = size; |
@@ -1437,10 +1433,22 @@ int main(void) | |||
1437 | int pool; | 1433 | int pool; |
1438 | char *if_name; | 1434 | char *if_name; |
1439 | struct hv_kvp_ipaddr_value *kvp_ip_val; | 1435 | struct hv_kvp_ipaddr_value *kvp_ip_val; |
1436 | char *kvp_send_buffer; | ||
1437 | char *kvp_recv_buffer; | ||
1438 | size_t kvp_recv_buffer_len; | ||
1440 | 1439 | ||
1441 | daemon(1, 0); | 1440 | if (daemon(1, 0)) |
1441 | return 1; | ||
1442 | openlog("KVP", 0, LOG_USER); | 1442 | openlog("KVP", 0, LOG_USER); |
1443 | syslog(LOG_INFO, "KVP starting; pid is:%d", getpid()); | 1443 | syslog(LOG_INFO, "KVP starting; pid is:%d", getpid()); |
1444 | |||
1445 | kvp_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_kvp_msg); | ||
1446 | kvp_send_buffer = calloc(1, kvp_recv_buffer_len); | ||
1447 | kvp_recv_buffer = calloc(1, kvp_recv_buffer_len); | ||
1448 | if (!(kvp_send_buffer && kvp_recv_buffer)) { | ||
1449 | syslog(LOG_ERR, "Failed to allocate netlink buffers"); | ||
1450 | exit(EXIT_FAILURE); | ||
1451 | } | ||
1444 | /* | 1452 | /* |
1445 | * Retrieve OS release information. | 1453 | * Retrieve OS release information. |
1446 | */ | 1454 | */ |
@@ -1514,7 +1522,7 @@ int main(void) | |||
1514 | continue; | 1522 | continue; |
1515 | } | 1523 | } |
1516 | 1524 | ||
1517 | len = recvfrom(fd, kvp_recv_buffer, sizeof(kvp_recv_buffer), 0, | 1525 | len = recvfrom(fd, kvp_recv_buffer, kvp_recv_buffer_len, 0, |
1518 | addr_p, &addr_l); | 1526 | addr_p, &addr_l); |
1519 | 1527 | ||
1520 | if (len < 0) { | 1528 | if (len < 0) { |
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index fea03a3edaf4..8611962c672c 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c | |||
@@ -38,8 +38,6 @@ | |||
38 | #include <linux/netlink.h> | 38 | #include <linux/netlink.h> |
39 | #include <syslog.h> | 39 | #include <syslog.h> |
40 | 40 | ||
41 | static char vss_recv_buffer[4096]; | ||
42 | static char vss_send_buffer[4096]; | ||
43 | static struct sockaddr_nl addr; | 41 | static struct sockaddr_nl addr; |
44 | 42 | ||
45 | #ifndef SOL_NETLINK | 43 | #ifndef SOL_NETLINK |
@@ -107,23 +105,18 @@ static int vss_operate(int operation) | |||
107 | 105 | ||
108 | static int netlink_send(int fd, struct cn_msg *msg) | 106 | static int netlink_send(int fd, struct cn_msg *msg) |
109 | { | 107 | { |
110 | struct nlmsghdr *nlh; | 108 | struct nlmsghdr nlh = { .nlmsg_type = NLMSG_DONE }; |
111 | unsigned int size; | 109 | unsigned int size; |
112 | struct msghdr message; | 110 | struct msghdr message; |
113 | char buffer[64]; | ||
114 | struct iovec iov[2]; | 111 | struct iovec iov[2]; |
115 | 112 | ||
116 | size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len); | 113 | size = sizeof(struct cn_msg) + msg->len; |
117 | 114 | ||
118 | nlh = (struct nlmsghdr *)buffer; | 115 | nlh.nlmsg_pid = getpid(); |
119 | nlh->nlmsg_seq = 0; | 116 | nlh.nlmsg_len = NLMSG_LENGTH(size); |
120 | nlh->nlmsg_pid = getpid(); | ||
121 | nlh->nlmsg_type = NLMSG_DONE; | ||
122 | nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); | ||
123 | nlh->nlmsg_flags = 0; | ||
124 | 117 | ||
125 | iov[0].iov_base = nlh; | 118 | iov[0].iov_base = &nlh; |
126 | iov[0].iov_len = sizeof(*nlh); | 119 | iov[0].iov_len = sizeof(nlh); |
127 | 120 | ||
128 | iov[1].iov_base = msg; | 121 | iov[1].iov_base = msg; |
129 | iov[1].iov_len = size; | 122 | iov[1].iov_len = size; |
@@ -147,6 +140,9 @@ int main(void) | |||
147 | struct cn_msg *incoming_cn_msg; | 140 | struct cn_msg *incoming_cn_msg; |
148 | int op; | 141 | int op; |
149 | struct hv_vss_msg *vss_msg; | 142 | struct hv_vss_msg *vss_msg; |
143 | char *vss_send_buffer; | ||
144 | char *vss_recv_buffer; | ||
145 | size_t vss_recv_buffer_len; | ||
150 | 146 | ||
151 | if (daemon(1, 0)) | 147 | if (daemon(1, 0)) |
152 | return 1; | 148 | return 1; |
@@ -154,9 +150,18 @@ int main(void) | |||
154 | openlog("Hyper-V VSS", 0, LOG_USER); | 150 | openlog("Hyper-V VSS", 0, LOG_USER); |
155 | syslog(LOG_INFO, "VSS starting; pid is:%d", getpid()); | 151 | syslog(LOG_INFO, "VSS starting; pid is:%d", getpid()); |
156 | 152 | ||
153 | vss_recv_buffer_len = NLMSG_HDRLEN + sizeof(struct cn_msg) + sizeof(struct hv_vss_msg); | ||
154 | vss_send_buffer = calloc(1, vss_recv_buffer_len); | ||
155 | vss_recv_buffer = calloc(1, vss_recv_buffer_len); | ||
156 | if (!(vss_send_buffer && vss_recv_buffer)) { | ||
157 | syslog(LOG_ERR, "Failed to allocate netlink buffers"); | ||
158 | exit(EXIT_FAILURE); | ||
159 | } | ||
160 | |||
157 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); | 161 | fd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR); |
158 | if (fd < 0) { | 162 | if (fd < 0) { |
159 | syslog(LOG_ERR, "netlink socket creation failed; error:%d", fd); | 163 | syslog(LOG_ERR, "netlink socket creation failed; error:%d %s", |
164 | errno, strerror(errno)); | ||
160 | exit(EXIT_FAILURE); | 165 | exit(EXIT_FAILURE); |
161 | } | 166 | } |
162 | addr.nl_family = AF_NETLINK; | 167 | addr.nl_family = AF_NETLINK; |
@@ -167,12 +172,16 @@ int main(void) | |||
167 | 172 | ||
168 | error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); | 173 | error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); |
169 | if (error < 0) { | 174 | if (error < 0) { |
170 | syslog(LOG_ERR, "bind failed; error:%d", error); | 175 | syslog(LOG_ERR, "bind failed; error:%d %s", errno, strerror(errno)); |
171 | close(fd); | 176 | close(fd); |
172 | exit(EXIT_FAILURE); | 177 | exit(EXIT_FAILURE); |
173 | } | 178 | } |
174 | nl_group = CN_VSS_IDX; | 179 | nl_group = CN_VSS_IDX; |
175 | setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)); | 180 | if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP, &nl_group, sizeof(nl_group)) < 0) { |
181 | syslog(LOG_ERR, "setsockopt failed; error:%d %s", errno, strerror(errno)); | ||
182 | close(fd); | ||
183 | exit(EXIT_FAILURE); | ||
184 | } | ||
176 | /* | 185 | /* |
177 | * Register ourselves with the kernel. | 186 | * Register ourselves with the kernel. |
178 | */ | 187 | */ |
@@ -187,7 +196,7 @@ int main(void) | |||
187 | 196 | ||
188 | len = netlink_send(fd, message); | 197 | len = netlink_send(fd, message); |
189 | if (len < 0) { | 198 | if (len < 0) { |
190 | syslog(LOG_ERR, "netlink_send failed; error:%d", len); | 199 | syslog(LOG_ERR, "netlink_send failed; error:%d %s", errno, strerror(errno)); |
191 | close(fd); | 200 | close(fd); |
192 | exit(EXIT_FAILURE); | 201 | exit(EXIT_FAILURE); |
193 | } | 202 | } |
@@ -199,9 +208,18 @@ int main(void) | |||
199 | socklen_t addr_l = sizeof(addr); | 208 | socklen_t addr_l = sizeof(addr); |
200 | pfd.events = POLLIN; | 209 | pfd.events = POLLIN; |
201 | pfd.revents = 0; | 210 | pfd.revents = 0; |
202 | poll(&pfd, 1, -1); | ||
203 | 211 | ||
204 | len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0, | 212 | if (poll(&pfd, 1, -1) < 0) { |
213 | syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno)); | ||
214 | if (errno == EINVAL) { | ||
215 | close(fd); | ||
216 | exit(EXIT_FAILURE); | ||
217 | } | ||
218 | else | ||
219 | continue; | ||
220 | } | ||
221 | |||
222 | len = recvfrom(fd, vss_recv_buffer, vss_recv_buffer_len, 0, | ||
205 | addr_p, &addr_l); | 223 | addr_p, &addr_l); |
206 | 224 | ||
207 | if (len < 0) { | 225 | if (len < 0) { |
@@ -241,7 +259,8 @@ int main(void) | |||
241 | vss_msg->error = error; | 259 | vss_msg->error = error; |
242 | len = netlink_send(fd, incoming_cn_msg); | 260 | len = netlink_send(fd, incoming_cn_msg); |
243 | if (len < 0) { | 261 | if (len < 0) { |
244 | syslog(LOG_ERR, "net_link send failed; error:%d", len); | 262 | syslog(LOG_ERR, "net_link send failed; error:%d %s", |
263 | errno, strerror(errno)); | ||
245 | exit(EXIT_FAILURE); | 264 | exit(EXIT_FAILURE); |
246 | } | 265 | } |
247 | } | 266 | } |