Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2c2ad54 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull networking fixes from David Miller:

 1) Fix memory leaks and other issues in mwifiex driver, from Amitkumar
    Karwar.

 2) skb_segment() can choke on packets using frag lists, fix from
    Herbert Xu with help from Eric Dumazet and others.

 3) IPv4 output cached route instantiation properly handles races
    involving two threads trying to install the same route, but we
    forgot to propagate this logic to input routes as well.  Fix from
    Alexei Starovoitov.

 4) Put protections in place to make sure that recvmsg() paths never
    accidently copy uninitialized memory back into userspace and also
    make sure that we never try to use more that sockaddr_storage for
    building the on-kernel-stack copy of a sockaddr.  Fixes from Hannes
    Frederic Sowa.

 5) R8152 driver transmit flow bug fixes from Hayes Wang.

 6) Fix some minor fallouts from genetlink changes, from Johannes Berg
    and Michael Opdenacker.

 7) AF_PACKET sendmsg path can race with netdevice unregister notifier,
    fix by using RCU to make sure the network device doesn't go away
    from under us.  Fix from Daniel Borkmann.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (43 commits)
  gso: handle new frag_list of frags GRO packets
  genetlink: fix genl_set_err() group ID
  genetlink: fix genlmsg_multicast() bug
  packet: fix use after free race in send path when dev is released
  xen-netback: stop the VIF thread before unbinding IRQs
  wimax: remove dead code
  net/phy: Add the autocross feature for forced links on VSC82x4
  net/phy: Add VSC8662 support
  net/phy: Add VSC8574 support
  net/phy: Add VSC8234 support
  net: add BUG_ON if kernel advertises msg_namelen > sizeof(struct sockaddr_storage)
  net: rework recvmsg handler msg_name and msg_namelen logic
  bridge: flush br's address entry in fdb when remove the
  net: core: Always propagate flag changes to interfaces
  ipv4: fix race in concurrent ip_route_input_slow()
  r8152: fix incorrect type in assignment
  r8152: support stopping/waking tx queue
  r8152: modify the tx flow
  r8152: fix tx/rx memory overflow
  netfilter: ebt_ip6: fix source and destination matching
  ...
parents 7fa850ab 9d8506cc
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -161,8 +161,6 @@ static int hash_recvmsg(struct kiocb *unused, struct socket *sock,
	else if (len < ds)
	else if (len < ds)
		msg->msg_flags |= MSG_TRUNC;
		msg->msg_flags |= MSG_TRUNC;


	msg->msg_namelen = 0;

	lock_sock(sk);
	lock_sock(sk);
	if (ctx->more) {
	if (ctx->more) {
		ctx->more = 0;
		ctx->more = 0;
+0 −1
Original line number Original line Diff line number Diff line
@@ -432,7 +432,6 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
	long copied = 0;
	long copied = 0;


	lock_sock(sk);
	lock_sock(sk);
	msg->msg_namelen = 0;
	for (iov = msg->msg_iov, iovlen = msg->msg_iovlen; iovlen > 0;
	for (iov = msg->msg_iov, iovlen = msg->msg_iovlen; iovlen > 0;
	     iovlen--, iov++) {
	     iovlen--, iov++) {
		unsigned long seglen = iov->iov_len;
		unsigned long seglen = iov->iov_len;
+4 −9
Original line number Original line Diff line number Diff line
@@ -117,7 +117,6 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
{
{
	struct sk_buff		*skb;
	struct sk_buff		*skb;
	struct sock		*sk = sock->sk;
	struct sock		*sk = sock->sk;
	struct sockaddr_mISDN	*maddr;


	int		copied, err;
	int		copied, err;


@@ -135,9 +134,9 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
	if (!skb)
	if (!skb)
		return err;
		return err;


	if (msg->msg_namelen >= sizeof(struct sockaddr_mISDN)) {
	if (msg->msg_name) {
		msg->msg_namelen = sizeof(struct sockaddr_mISDN);
		struct sockaddr_mISDN *maddr = msg->msg_name;
		maddr = (struct sockaddr_mISDN *)msg->msg_name;

		maddr->family = AF_ISDN;
		maddr->family = AF_ISDN;
		maddr->dev = _pms(sk)->dev->id;
		maddr->dev = _pms(sk)->dev->id;
		if ((sk->sk_protocol == ISDN_P_LAPD_TE) ||
		if ((sk->sk_protocol == ISDN_P_LAPD_TE) ||
@@ -150,11 +149,7 @@ mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
			maddr->sapi = _pms(sk)->ch.addr & 0xFF;
			maddr->sapi = _pms(sk)->ch.addr & 0xFF;
			maddr->tei =  (_pms(sk)->ch.addr >> 8) & 0xFF;
			maddr->tei =  (_pms(sk)->ch.addr >> 8) & 0xFF;
		}
		}
	} else {
		msg->msg_namelen = sizeof(*maddr);
		if (msg->msg_namelen)
			printk(KERN_WARNING "%s: too small namelen %d\n",
			       __func__, msg->msg_namelen);
		msg->msg_namelen = 0;
	}
	}


	copied = skb->len + MISDN_HEADER_LEN;
	copied = skb->len + MISDN_HEADER_LEN;
+2 −2
Original line number Original line Diff line number Diff line
@@ -697,7 +697,7 @@ static int genphy_config_advert(struct phy_device *phydev)
 *   to the values in phydev. Assumes that the values are valid.
 *   to the values in phydev. Assumes that the values are valid.
 *   Please see phy_sanitize_settings().
 *   Please see phy_sanitize_settings().
 */
 */
static int genphy_setup_forced(struct phy_device *phydev)
int genphy_setup_forced(struct phy_device *phydev)
{
{
	int err;
	int err;
	int ctl = 0;
	int ctl = 0;
@@ -716,7 +716,7 @@ static int genphy_setup_forced(struct phy_device *phydev)


	return err;
	return err;
}
}

EXPORT_SYMBOL(genphy_setup_forced);


/**
/**
 * genphy_restart_aneg - Enable and Restart Autonegotiation
 * genphy_restart_aneg - Enable and Restart Autonegotiation
+113 −4
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 *
 * Author: Kriston Carson
 * Author: Kriston Carson
 *
 *
 * Copyright (c) 2005, 2009 Freescale Semiconductor, Inc.
 * Copyright (c) 2005, 2009, 2011 Freescale Semiconductor, Inc.
 *
 *
 * This program is free software; you can redistribute  it and/or modify it
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * under  the terms of  the GNU General  Public License as published by the
@@ -18,6 +18,11 @@
#include <linux/ethtool.h>
#include <linux/ethtool.h>
#include <linux/phy.h>
#include <linux/phy.h>


/* Vitesse Extended Page Magic Register(s) */
#define MII_VSC82X4_EXT_PAGE_16E	0x10
#define MII_VSC82X4_EXT_PAGE_17E	0x11
#define MII_VSC82X4_EXT_PAGE_18E	0x12

/* Vitesse Extended Control Register 1 */
/* Vitesse Extended Control Register 1 */
#define MII_VSC8244_EXT_CON1           0x17
#define MII_VSC8244_EXT_CON1           0x17
#define MII_VSC8244_EXTCON1_INIT       0x0000
#define MII_VSC8244_EXTCON1_INIT       0x0000
@@ -54,7 +59,13 @@
#define MII_VSC8221_AUXCONSTAT_INIT	0x0004 /* need to set this bit? */
#define MII_VSC8221_AUXCONSTAT_INIT	0x0004 /* need to set this bit? */
#define MII_VSC8221_AUXCONSTAT_RESERVED	0x0004
#define MII_VSC8221_AUXCONSTAT_RESERVED	0x0004


/* Vitesse Extended Page Access Register */
#define MII_VSC82X4_EXT_PAGE_ACCESS	0x1f

#define PHY_ID_VSC8234			0x000fc620
#define PHY_ID_VSC8244			0x000fc6c0
#define PHY_ID_VSC8244			0x000fc6c0
#define PHY_ID_VSC8574			0x000704a0
#define PHY_ID_VSC8662			0x00070660
#define PHY_ID_VSC8221			0x000fc550
#define PHY_ID_VSC8221			0x000fc550
#define PHY_ID_VSC8211			0x000fc4b0
#define PHY_ID_VSC8211			0x000fc4b0


@@ -118,7 +129,9 @@ static int vsc82xx_config_intr(struct phy_device *phydev)


	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
		err = phy_write(phydev, MII_VSC8244_IMASK,
		err = phy_write(phydev, MII_VSC8244_IMASK,
			phydev->drv->phy_id == PHY_ID_VSC8244 ?
			(phydev->drv->phy_id == PHY_ID_VSC8234 ||
			 phydev->drv->phy_id == PHY_ID_VSC8244 ||
			 phydev->drv->phy_id == PHY_ID_VSC8574) ?
				MII_VSC8244_IMASK_MASK :
				MII_VSC8244_IMASK_MASK :
				MII_VSC8221_IMASK_MASK);
				MII_VSC8221_IMASK_MASK);
	else {
	else {
@@ -149,16 +162,109 @@ static int vsc8221_config_init(struct phy_device *phydev)
	 */
	 */
}
}


/* Vitesse 824x */
/* vsc82x4_config_autocross_enable - Enable auto MDI/MDI-X for forced links
 * @phydev: target phy_device struct
 *
 * Enable auto MDI/MDI-X when in 10/100 forced link speeds by writing
 * special values in the VSC8234/VSC8244 extended reserved registers
 */
static int vsc82x4_config_autocross_enable(struct phy_device *phydev)
{
	int ret;

	if (phydev->autoneg == AUTONEG_ENABLE || phydev->speed > SPEED_100)
		return 0;

	/* map extended registers set 0x10 - 0x1e */
	ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x52b5);
	if (ret >= 0)
		ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_18E, 0x0012);
	if (ret >= 0)
		ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_17E, 0x2803);
	if (ret >= 0)
		ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_16E, 0x87fa);
	/* map standard registers set 0x10 - 0x1e */
	if (ret >= 0)
		ret = phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000);
	else
		phy_write(phydev, MII_VSC82X4_EXT_PAGE_ACCESS, 0x0000);

	return ret;
}

/* vsc82x4_config_aneg - restart auto-negotiation or write BMCR
 * @phydev: target phy_device struct
 *
 * Description: If auto-negotiation is enabled, we configure the
 *   advertising, and then restart auto-negotiation.  If it is not
 *   enabled, then we write the BMCR and also start the auto
 *   MDI/MDI-X feature
 */
static int vsc82x4_config_aneg(struct phy_device *phydev)
{
	int ret;

	/* Enable auto MDI/MDI-X when in 10/100 forced link speeds by
	 * writing special values in the VSC8234 extended reserved registers
	 */
	if (phydev->autoneg != AUTONEG_ENABLE && phydev->speed <= SPEED_100) {
		ret = genphy_setup_forced(phydev);

		if (ret < 0) /* error */
			return ret;

		return vsc82x4_config_autocross_enable(phydev);
	}

	return genphy_config_aneg(phydev);
}

/* Vitesse 82xx */
static struct phy_driver vsc82xx_driver[] = {
static struct phy_driver vsc82xx_driver[] = {
{
{
	.phy_id         = PHY_ID_VSC8234,
	.name           = "Vitesse VSC8234",
	.phy_id_mask    = 0x000ffff0,
	.features       = PHY_GBIT_FEATURES,
	.flags          = PHY_HAS_INTERRUPT,
	.config_init    = &vsc824x_config_init,
	.config_aneg    = &vsc82x4_config_aneg,
	.read_status    = &genphy_read_status,
	.ack_interrupt  = &vsc824x_ack_interrupt,
	.config_intr    = &vsc82xx_config_intr,
	.driver         = { .owner = THIS_MODULE,},
}, {
	.phy_id		= PHY_ID_VSC8244,
	.phy_id		= PHY_ID_VSC8244,
	.name		= "Vitesse VSC8244",
	.name		= "Vitesse VSC8244",
	.phy_id_mask	= 0x000fffc0,
	.phy_id_mask	= 0x000fffc0,
	.features	= PHY_GBIT_FEATURES,
	.features	= PHY_GBIT_FEATURES,
	.flags		= PHY_HAS_INTERRUPT,
	.flags		= PHY_HAS_INTERRUPT,
	.config_init	= &vsc824x_config_init,
	.config_init	= &vsc824x_config_init,
	.config_aneg	= &genphy_config_aneg,
	.config_aneg	= &vsc82x4_config_aneg,
	.read_status	= &genphy_read_status,
	.ack_interrupt	= &vsc824x_ack_interrupt,
	.config_intr	= &vsc82xx_config_intr,
	.driver		= { .owner = THIS_MODULE,},
}, {
	.phy_id         = PHY_ID_VSC8574,
	.name           = "Vitesse VSC8574",
	.phy_id_mask    = 0x000ffff0,
	.features       = PHY_GBIT_FEATURES,
	.flags          = PHY_HAS_INTERRUPT,
	.config_init    = &vsc824x_config_init,
	.config_aneg    = &vsc82x4_config_aneg,
	.read_status    = &genphy_read_status,
	.ack_interrupt  = &vsc824x_ack_interrupt,
	.config_intr    = &vsc82xx_config_intr,
	.driver         = { .owner = THIS_MODULE,},
}, {
	.phy_id         = PHY_ID_VSC8662,
	.name           = "Vitesse VSC8662",
	.phy_id_mask    = 0x000ffff0,
	.features       = PHY_GBIT_FEATURES,
	.flags          = PHY_HAS_INTERRUPT,
	.config_init    = &vsc824x_config_init,
	.config_aneg    = &vsc82x4_config_aneg,
	.read_status    = &genphy_read_status,
	.read_status    = &genphy_read_status,
	.ack_interrupt  = &vsc824x_ack_interrupt,
	.ack_interrupt  = &vsc824x_ack_interrupt,
	.config_intr    = &vsc82xx_config_intr,
	.config_intr    = &vsc82xx_config_intr,
@@ -207,7 +313,10 @@ module_init(vsc82xx_init);
module_exit(vsc82xx_exit);
module_exit(vsc82xx_exit);


static struct mdio_device_id __maybe_unused vitesse_tbl[] = {
static struct mdio_device_id __maybe_unused vitesse_tbl[] = {
	{ PHY_ID_VSC8234, 0x000ffff0 },
	{ PHY_ID_VSC8244, 0x000fffc0 },
	{ PHY_ID_VSC8244, 0x000fffc0 },
	{ PHY_ID_VSC8574, 0x000ffff0 },
	{ PHY_ID_VSC8662, 0x000ffff0 },
	{ PHY_ID_VSC8221, 0x000ffff0 },
	{ PHY_ID_VSC8221, 0x000ffff0 },
	{ PHY_ID_VSC8211, 0x000ffff0 },
	{ PHY_ID_VSC8211, 0x000ffff0 },
	{ }
	{ }
Loading