-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1 iQEcBAABAgAGBQJUbx4lAAoJEJykq7OBq3PI+/MH/0GQWCsoEr/6Xauh3jVmoi7L PcxmkYDA8bF7Gnqe22XJULClTfZhSb//SGKvc8mC4PZG8DkTwxlHWbYAdKy1QJ53 F529WKjFzySicoZKoXyPix6cq/geRucY58LbxZqPhwpIJ9cgHlro/xqUmaY89IdF jVBe2j7GGIXCHqzbD/3AO/Xx8YxC70zgZ3hZEuPo3vlGLg7+ovkC2xCuEY0kXOBp qe54vrUEIH4kQ2q3XJSydDISZOjUbj9k2dVu12JobH3ArHciKX/2XF9Jn+bb6pTR +BRE+ONljlM1L3XmwO38ElIcxlbXRjcxY2Y6BeceCvYnnoUMo3aio637xB1imDc= =xlP+ -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into staging # gpg: Signature made Fri 21 Nov 2014 11:12:37 GMT using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/net-pull-request: rtl8139: fix Pointer to local outside scope pcnet: fix Negative array index read net/socket: fix Uninitialized scalar variable net/slirp: fix memory leak Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
0e88f47850
|
@ -1212,7 +1212,7 @@ static void pcnet_transmit(PCNetState *s)
|
||||||
hwaddr xmit_cxda = 0;
|
hwaddr xmit_cxda = 0;
|
||||||
int count = CSR_XMTRL(s)-1;
|
int count = CSR_XMTRL(s)-1;
|
||||||
int add_crc = 0;
|
int add_crc = 0;
|
||||||
|
int bcnt;
|
||||||
s->xmit_pos = -1;
|
s->xmit_pos = -1;
|
||||||
|
|
||||||
if (!CSR_TXON(s)) {
|
if (!CSR_TXON(s)) {
|
||||||
|
@ -1247,16 +1247,20 @@ static void pcnet_transmit(PCNetState *s)
|
||||||
s->xmit_pos = -1;
|
s->xmit_pos = -1;
|
||||||
goto txdone;
|
goto txdone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s->xmit_pos < 0) {
|
||||||
|
goto txdone;
|
||||||
|
}
|
||||||
|
|
||||||
|
bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
|
||||||
|
s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
|
||||||
|
s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
|
||||||
|
s->xmit_pos += bcnt;
|
||||||
|
|
||||||
if (!GET_FIELD(tmd.status, TMDS, ENP)) {
|
if (!GET_FIELD(tmd.status, TMDS, ENP)) {
|
||||||
int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
|
goto txdone;
|
||||||
s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
|
}
|
||||||
s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
|
|
||||||
s->xmit_pos += bcnt;
|
|
||||||
} else if (s->xmit_pos >= 0) {
|
|
||||||
int bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
|
|
||||||
s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
|
|
||||||
s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
|
|
||||||
s->xmit_pos += bcnt;
|
|
||||||
#ifdef PCNET_DEBUG
|
#ifdef PCNET_DEBUG
|
||||||
printf("pcnet_transmit size=%d\n", s->xmit_pos);
|
printf("pcnet_transmit size=%d\n", s->xmit_pos);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1266,15 +1270,16 @@ static void pcnet_transmit(PCNetState *s)
|
||||||
s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
|
s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
|
||||||
pcnet_receive(qemu_get_queue(s->nic), s->buffer, s->xmit_pos);
|
pcnet_receive(qemu_get_queue(s->nic), s->buffer, s->xmit_pos);
|
||||||
s->looptest = 0;
|
s->looptest = 0;
|
||||||
} else
|
} else {
|
||||||
if (s->nic)
|
if (s->nic) {
|
||||||
qemu_send_packet(qemu_get_queue(s->nic), s->buffer,
|
qemu_send_packet(qemu_get_queue(s->nic), s->buffer,
|
||||||
s->xmit_pos);
|
s->xmit_pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
s->csr[0] &= ~0x0008; /* clear TDMD */
|
s->csr[0] &= ~0x0008; /* clear TDMD */
|
||||||
s->csr[4] |= 0x0004; /* set TXSTRT */
|
s->csr[4] |= 0x0004; /* set TXSTRT */
|
||||||
s->xmit_pos = -1;
|
s->xmit_pos = -1;
|
||||||
}
|
|
||||||
|
|
||||||
txdone:
|
txdone:
|
||||||
SET_FIELD(&tmd.status, TMDS, OWN, 0);
|
SET_FIELD(&tmd.status, TMDS, OWN, 0);
|
||||||
|
|
|
@ -1775,6 +1775,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
|
||||||
int do_interrupt, const uint8_t *dot1q_buf)
|
int do_interrupt, const uint8_t *dot1q_buf)
|
||||||
{
|
{
|
||||||
struct iovec *iov = NULL;
|
struct iovec *iov = NULL;
|
||||||
|
struct iovec vlan_iov[3];
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
{
|
{
|
||||||
|
@ -1789,6 +1790,9 @@ static void rtl8139_transfer_frame(RTL8139State *s, uint8_t *buf, int size,
|
||||||
{ .iov_base = buf + ETHER_ADDR_LEN * 2,
|
{ .iov_base = buf + ETHER_ADDR_LEN * 2,
|
||||||
.iov_len = size - ETHER_ADDR_LEN * 2 },
|
.iov_len = size - ETHER_ADDR_LEN * 2 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
memcpy(vlan_iov, iov, sizeof(vlan_iov));
|
||||||
|
iov = vlan_iov;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TxLoopBack == (s->TxConfig & TxLoopBack))
|
if (TxLoopBack == (s->TxConfig & TxLoopBack))
|
||||||
|
|
|
@ -643,17 +643,16 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
|
||||||
goto fail_syntax;
|
goto fail_syntax;
|
||||||
}
|
}
|
||||||
|
|
||||||
fwd = g_malloc(sizeof(struct GuestFwd));
|
|
||||||
snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port);
|
snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port);
|
||||||
|
|
||||||
if ((strlen(p) > 4) && !strncmp(p, "cmd:", 4)) {
|
if ((strlen(p) > 4) && !strncmp(p, "cmd:", 4)) {
|
||||||
if (slirp_add_exec(s->slirp, 0, &p[4], &server, port) < 0) {
|
if (slirp_add_exec(s->slirp, 0, &p[4], &server, port) < 0) {
|
||||||
error_report("conflicting/invalid host:port in guest forwarding "
|
error_report("conflicting/invalid host:port in guest forwarding "
|
||||||
"rule '%s'", config_str);
|
"rule '%s'", config_str);
|
||||||
g_free(fwd);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
fwd = g_malloc(sizeof(struct GuestFwd));
|
||||||
fwd->hd = qemu_chr_new(buf, p, NULL);
|
fwd->hd = qemu_chr_new(buf, p, NULL);
|
||||||
if (!fwd->hd) {
|
if (!fwd->hd) {
|
||||||
error_report("could not open guest forwarding device '%s'", buf);
|
error_report("could not open guest forwarding device '%s'", buf);
|
||||||
|
|
11
net/socket.c
11
net/socket.c
|
@ -389,11 +389,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
|
nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
|
||||||
"socket: fd=%d (%s mcast=%s:%d)",
|
|
||||||
fd, is_connected ? "cloned" : "",
|
|
||||||
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
||||||
|
|
||||||
s = DO_UPCAST(NetSocketState, nc, nc);
|
s = DO_UPCAST(NetSocketState, nc, nc);
|
||||||
|
|
||||||
s->fd = fd;
|
s->fd = fd;
|
||||||
|
@ -404,6 +399,12 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
|
||||||
/* mcast: save bound address as dst */
|
/* mcast: save bound address as dst */
|
||||||
if (is_connected) {
|
if (is_connected) {
|
||||||
s->dgram_dst = saddr;
|
s->dgram_dst = saddr;
|
||||||
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
|
"socket: fd=%d (cloned mcast=%s:%d)",
|
||||||
|
fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
||||||
|
} else {
|
||||||
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
|
"socket: fd=%d", fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Reference in a new issue