Re: [Bluez-devel] PAN and kernel 2.4.26

Marcel Holtmann
2004-06-28T12:58:05Z

Hi Bastian,

> > remove the security patch and try again.
>
> Same effect.

I don't think so, because I looked at the patch and this seems to
introducing the problem:

diff -urPX nopatch linux-2.4.26/net/socket.c linux/net/socket.c
--- linux-2.4.26/net/socket.c Fri Feb 20 10:07:45 2004
+++ linux/net/socket.c Sat Apr 17 02:13:55 2004
@@ -1307,10 +1307,18 @@
asmlinkage long sys_getsockopt(int fd, int level, int optname, char *optval, int *optlen)
{
int err;
+ int len;
struct socket *sock;

if ((sock = sockfd_lookup(fd, &err))!=NULL)
{
+ /* XXX: insufficient for SMP, but should be redundant anyway */
+ if (get_user(len, optlen))
+ err = -EFAULT;
+ else
+ if (len < 0)
+ err = -EINVAL;
+ else
if (level == SOL_SOCKET)
err=sock_getsockopt(sock,level,optname,optval,optlen);
else

And here is the fix for pand to also work with the patch:

diff -u -r1.4 main.c
--- main.c 31 May 2004 22:21:42 -0000 1.4
+++ main.c 28 Jun 2004 10:56:35 -0000
@@ -136,6 +136,7 @@
}

/* Setup L2CAP options according to BNEP spec */
+ olen = sizeof(l2o);
if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen) < 0) {
syslog(LOG_ERR, "Failed to get L2CAP options. %s(%d)",
strerror(errno), errno);
@@ -257,6 +258,7 @@
}

/* Setup L2CAP options according to BNEP spec */
+ olen = sizeof(l2o);
getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, &olen);
l2o.imtu = l2o.omtu = BNEP_MTU;
setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o, sizeof(l2o));

I committed this one already to CVS, because it is an obvious fix.