Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  iwlwifi: Allow building iwl3945 without iwl4965.
  wireless: Fix compile error with wifi & leds
  tcp: Fix slab corruption with ipv6 and tcp6fuzz
  ipv4/ipv6 compat: Fix SSM applications on 64bit kernels.
  [IPSEC]: Use digest_null directly for auth
  sunrpc: fix missing kernel-doc
  can: Fix copy_from_user() results interpretation
  Revert "ipv6: Fix typo in net/ipv6/Kconfig"
  tipc: endianness annotations
  ipv6: result of csum_fold() is already 16bit, no need to cast
  [XFRM] AUDIT: Fix flowlabel text format ambibuity.
  • Loading branch information
torvalds committed Apr 28, 2008
2 parents 96fffeb + 358c129 commit 77a50df
Show file tree
Hide file tree
Showing 15 changed files with 159 additions and 25 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ obj-$(CONFIG_RTL8187) += rtl8187.o

obj-$(CONFIG_ADM8211) += adm8211.o

obj-$(CONFIG_IWLCORE) += iwlwifi/
obj-$(CONFIG_IWLWIFI) += iwlwifi/
obj-$(CONFIG_RT2X00) += rt2x00/

obj-$(CONFIG_P54_COMMON) += p54/
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/iwlwifi/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
config IWLWIFI
bool
default n

config IWLCORE
tristate "Intel Wireless Wifi Core"
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select IWLWIFI

config IWLWIFI_LEDS
bool
Expand Down Expand Up @@ -106,6 +111,7 @@ config IWL3945
tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
select FW_LOADER
select IWLWIFI
---help---
Select to build the driver supporting the:

Expand Down
3 changes: 3 additions & 0 deletions include/net/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);

extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);

extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int,
int (*)(struct sock *, int, int, char __user *, int));

#endif /* NET_COMPAT_H */
21 changes: 10 additions & 11 deletions net/can/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,13 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
if (!filter)
return -ENOMEM;

err = copy_from_user(filter, optval, optlen);
if (err) {
if (copy_from_user(filter, optval, optlen)) {
kfree(filter);
return err;
return -EFAULT;
}
} else if (count == 1) {
err = copy_from_user(&sfilter, optval, optlen);
if (err)
return err;
if (copy_from_user(&sfilter, optval, optlen))
return -EFAULT;
}

lock_sock(sk);
Expand Down Expand Up @@ -493,9 +491,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
if (optlen != sizeof(err_mask))
return -EINVAL;

err = copy_from_user(&err_mask, optval, optlen);
if (err)
return err;
if (copy_from_user(&err_mask, optval, optlen))
return -EFAULT;

err_mask &= CAN_ERR_MASK;

Expand Down Expand Up @@ -531,15 +528,17 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
if (optlen != sizeof(ro->loopback))
return -EINVAL;

err = copy_from_user(&ro->loopback, optval, optlen);
if (copy_from_user(&ro->loopback, optval, optlen))
return -EFAULT;

break;

case CAN_RAW_RECV_OWN_MSGS:
if (optlen != sizeof(ro->recv_own_msgs))
return -EINVAL;

err = copy_from_user(&ro->recv_own_msgs, optval, optlen);
if (copy_from_user(&ro->recv_own_msgs, optval, optlen))
return -EFAULT;

break;

Expand Down
117 changes: 117 additions & 0 deletions net/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <net/scm.h>
#include <net/sock.h>
#include <net/ip.h>
#include <net/ipv6.h>
#include <asm/uaccess.h>
#include <net/compat.h>

Expand Down Expand Up @@ -521,6 +523,121 @@ asmlinkage long compat_sys_getsockopt(int fd, int level, int optname,
}
return err;
}

struct compat_group_req {
__u32 gr_interface;
struct __kernel_sockaddr_storage gr_group
__attribute__ ((aligned(4)));
} __attribute__ ((packed));

struct compat_group_source_req {
__u32 gsr_interface;
struct __kernel_sockaddr_storage gsr_group
__attribute__ ((aligned(4)));
struct __kernel_sockaddr_storage gsr_source
__attribute__ ((aligned(4)));
} __attribute__ ((packed));

struct compat_group_filter {
__u32 gf_interface;
struct __kernel_sockaddr_storage gf_group
__attribute__ ((aligned(4)));
__u32 gf_fmode;
__u32 gf_numsrc;
struct __kernel_sockaddr_storage gf_slist[1]
__attribute__ ((aligned(4)));
} __attribute__ ((packed));


int compat_mc_setsockopt(struct sock *sock, int level, int optname,
char __user *optval, int optlen,
int (*setsockopt)(struct sock *,int,int,char __user *,int))
{
char __user *koptval = optval;
int koptlen = optlen;

switch (optname) {
case MCAST_JOIN_GROUP:
case MCAST_LEAVE_GROUP:
{
struct compat_group_req __user *gr32 = (void *)optval;
struct group_req __user *kgr =
compat_alloc_user_space(sizeof(struct group_req));
u32 interface;

if (!access_ok(VERIFY_READ, gr32, sizeof(*gr32)) ||
!access_ok(VERIFY_WRITE, kgr, sizeof(struct group_req)) ||
__get_user(interface, &gr32->gr_interface) ||
__put_user(interface, &kgr->gr_interface) ||
copy_in_user(&kgr->gr_group, &gr32->gr_group,
sizeof(kgr->gr_group)))
return -EFAULT;
koptval = (char __user *)kgr;
koptlen = sizeof(struct group_req);
break;
}
case MCAST_JOIN_SOURCE_GROUP:
case MCAST_LEAVE_SOURCE_GROUP:
case MCAST_BLOCK_SOURCE:
case MCAST_UNBLOCK_SOURCE:
{
struct compat_group_source_req __user *gsr32 = (void *)optval;
struct group_source_req *kgsr = compat_alloc_user_space(
sizeof(struct group_source_req));
u32 interface;

if (!access_ok(VERIFY_READ, gsr32, sizeof(*gsr32)) ||
!access_ok(VERIFY_WRITE, kgsr,
sizeof(struct group_source_req)) ||
__get_user(interface, &gsr32->gsr_interface) ||
__put_user(interface, &kgsr->gsr_interface) ||
copy_in_user(&kgsr->gsr_group, &gsr32->gsr_group,
sizeof(kgsr->gsr_group)) ||
copy_in_user(&kgsr->gsr_source, &gsr32->gsr_source,
sizeof(kgsr->gsr_source)))
return -EFAULT;
koptval = (char __user *)kgsr;
koptlen = sizeof(struct group_source_req);
break;
}
case MCAST_MSFILTER:
{
struct compat_group_filter __user *gf32 = (void *)optval;
struct group_filter *kgf;
u32 interface, fmode, numsrc;

if (!access_ok(VERIFY_READ, gf32, sizeof(*gf32)) ||
__get_user(interface, &gf32->gf_interface) ||
__get_user(fmode, &gf32->gf_fmode) ||
__get_user(numsrc, &gf32->gf_numsrc))
return -EFAULT;
koptlen = optlen + sizeof(struct group_filter) -
sizeof(struct compat_group_filter);
if (koptlen < GROUP_FILTER_SIZE(numsrc))
return -EINVAL;
kgf = compat_alloc_user_space(koptlen);
if (!access_ok(VERIFY_WRITE, kgf, koptlen) ||
__put_user(interface, &kgf->gf_interface) ||
__put_user(fmode, &kgf->gf_fmode) ||
__put_user(numsrc, &kgf->gf_numsrc) ||
copy_in_user(&kgf->gf_group, &gf32->gf_group,
sizeof(kgf->gf_group)) ||
(numsrc && copy_in_user(&kgf->gf_slist, &gf32->gf_slist,
numsrc * sizeof(kgf->gf_slist[0]))))
return -EFAULT;
koptval = (char __user *)kgf;
break;
}

default:
break;
}
return setsockopt(sock, level, optname, koptval, koptlen);
}

EXPORT_SYMBOL(compat_mc_setsockopt);


/* Argument list sizes for compat_sys_socketcall */
#define AL(x) ((x) * sizeof(u32))
static unsigned char nas[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
Expand Down
5 changes: 5 additions & 0 deletions net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/mroute.h>
#include <net/route.h>
#include <net/xfrm.h>
#include <net/compat.h>
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
#include <net/transp_v6.h>
#endif
Expand Down Expand Up @@ -923,6 +924,10 @@ int compat_ip_setsockopt(struct sock *sk, int level, int optname,
if (level != SOL_IP)
return -ENOPROTOOPT;

if (optname >= MCAST_JOIN_GROUP && optname <= MCAST_MSFILTER)
return compat_mc_setsockopt(sk, level, optname, optval, optlen,
ip_setsockopt);

err = do_ip_setsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
Expand Down
3 changes: 1 addition & 2 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -4925,8 +4925,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
tcp_data_snd_check(sk);
tcp_ack_snd_check(sk);

if (tcp_defer_accept_check(sk))
return -1;
tcp_defer_accept_check(sk);
return 0;

csum_error:
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ config IPV6_SIT
Tunneling means encapsulating data of one protocol type within
another protocol and sending it over a channel that understands the
encapsulating protocol. This driver implements encapsulation of IPv6
into IPv4 packets. This is useful if you want to connect to IPv6
into IPv4 packets. This is useful if you want to connect two IPv6
networks over an IPv4-only path.

Saying M here will produce a module called sit.ko. If unsure, say Y.
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ static int pim6_rcv(struct sk_buff *skb)
if (pim->type != ((PIM_VERSION << 4) | PIM_REGISTER) ||
(pim->flags & PIM_NULL_REGISTER) ||
(ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
(u16)csum_fold(skb_checksum(skb, 0, skb->len, 0))))
csum_fold(skb_checksum(skb, 0, skb->len, 0))))
goto drop;

/* check if the inner packet is destined to mcast group */
Expand Down
5 changes: 5 additions & 0 deletions net/ipv6/ipv6_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <net/udp.h>
#include <net/udplite.h>
#include <net/xfrm.h>
#include <net/compat.h>

#include <asm/uaccess.h>

Expand Down Expand Up @@ -779,6 +780,10 @@ int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
if (level != SOL_IPV6)
return -ENOPROTOOPT;

if (optname >= MCAST_JOIN_GROUP && optname <= MCAST_MSFILTER)
return compat_mc_setsockopt(sk, level, optname, optval, optlen,
ipv6_setsockopt);

err = do_ipv6_setsockopt(sk, level, optname, optval, optlen);
#ifdef CONFIG_NETFILTER
/* we need to exclude all possible ENOPROTOOPTs except default case */
Expand Down
4 changes: 3 additions & 1 deletion net/mac80211/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ config MAC80211_MESH

config MAC80211_LEDS
bool "Enable LED triggers"
depends on MAC80211 && LEDS_TRIGGERS
depends on MAC80211
select NEW_LEDS
select LEDS_TRIGGERS
---help---
This option enables a few LED triggers for different
packet receive/transmit events.
Expand Down
2 changes: 1 addition & 1 deletion net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ EXPORT_SYMBOL_GPL(xprt_wake_pending_tasks);
/**
* xprt_wait_for_buffer_space - wait for transport output buffer to clear
* @task: task to be put to sleep
*
* @action: function pointer to be executed after wait
*/
void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action)
{
Expand Down
7 changes: 3 additions & 4 deletions net/tipc/msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
u32 pos, u32 mask, u32 val)
{
val = (val & mask) << pos;
val = htonl(val);
mask = htonl(mask << pos);
m->hdr[w] &= ~mask;
m->hdr[w] |= val;
mask = mask << pos;
m->hdr[w] &= ~htonl(mask);
m->hdr[w] |= htonl(val);
}

/*
Expand Down
3 changes: 1 addition & 2 deletions net/xfrm/xfrm_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ static struct xfrm_algo_desc aead_list[] = {

static struct xfrm_algo_desc aalg_list[] = {
{
.name = "hmac(digest_null)",
.compat = "digest_null",
.name = "digest_null",

.uinfo = {
.auth = {
Expand Down
2 changes: 1 addition & 1 deletion net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,7 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family,
iph6 = ipv6_hdr(skb);
audit_log_format(audit_buf,
" src=" NIP6_FMT " dst=" NIP6_FMT
" flowlbl=0x%x%x%x",
" flowlbl=0x%x%02x%02x",
NIP6(iph6->saddr),
NIP6(iph6->daddr),
iph6->flow_lbl[0] & 0x0f,
Expand Down

0 comments on commit 77a50df

Please sign in to comment.