Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150472
b: refs/heads/master
c: 3dc4039
h: refs/heads/master
v: v3
  • Loading branch information
Frank Seidel authored and David S. Miller committed May 25, 2009
1 parent 1fd0fbb commit c32c0e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b277b8605f4c8fbd13302df33ab4570f844c1ff
refs/heads/master: 3dc403939c73ac372f2c95b5099dfdf396fe4ecc
21 changes: 17 additions & 4 deletions trunk/drivers/isdn/mISDN/l1oip_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,18 +663,28 @@ l1oip_socket_thread(void *data)
struct iovec iov;
mm_segment_t oldfs;
struct sockaddr_in sin_rx;
unsigned char recvbuf[1500];
unsigned char *recvbuf;
size_t recvbuf_size = 1500;
int recvlen;
struct socket *socket = NULL;
DECLARE_COMPLETION(wait);

/* allocate buffer memory */
recvbuf = kmalloc(recvbuf_size, GFP_KERNEL);
if (!recvbuf) {
printk(KERN_ERR "%s: Failed to alloc recvbuf.\n", __func__);
ret = -ENOMEM;
goto fail;
}

/* make daemon */
allow_signal(SIGTERM);

/* create socket */
if (sock_create(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &socket)) {
printk(KERN_ERR "%s: Failed to create socket.\n", __func__);
return -EIO;
ret = -EIO;
goto fail;
}

/* set incoming address */
Expand Down Expand Up @@ -730,10 +740,10 @@ l1oip_socket_thread(void *data)
__func__);
while (!signal_pending(current)) {
iov.iov_base = recvbuf;
iov.iov_len = sizeof(recvbuf);
iov.iov_len = recvbuf_size;
oldfs = get_fs();
set_fs(KERNEL_DS);
recvlen = sock_recvmsg(socket, &msg, sizeof(recvbuf), 0);
recvlen = sock_recvmsg(socket, &msg, recvbuf_size, 0);
set_fs(oldfs);
if (recvlen > 0) {
l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen);
Expand All @@ -760,6 +770,9 @@ l1oip_socket_thread(void *data)
__func__);

fail:
/* free recvbuf */
kfree(recvbuf);

/* close socket */
if (socket)
sock_release(socket);
Expand Down

0 comments on commit c32c0e8

Please sign in to comment.