Skip to content

Commit

Permalink
Merge android-4.9-q into canting-4.9-q
Browse files Browse the repository at this point in the history
* 'android-4.9-q' of https://android.googlesource.com/kernel/common:
  Linux 4.9.273
  proc: only require mm_struct for writing
  tracing: Correct the length check which causes memory corruption
  ftrace: Do not blindly read the ip address in ftrace_bug()
  scsi: core: Only put parent device if host state differs from SHOST_CREATED
  scsi: core: Fix error handling of scsi_host_alloc()
  NFSv4: nfs4_proc_set_acl needs to restore NFS_CAP_UIDGID_NOMAP on error.
  kvm: fix previous commit for 32-bit builds
  perf session: Correct buffer copying when peeking events
  NFS: Fix a potential NULL dereference in nfs_get_client()
  perf: Fix data race between pin_count increment/decrement
  usb: fix various gadget panics on 10gbps cabling
  usb: fix various gadgets null ptr deref on 10gbps cabling.
  usb: gadget: eem: fix wrong eem header operation
  USB: serial: quatech2: fix control-request directions
  USB: serial: omninet: add device id for Zyxel Omni 56K Plus
  USB: serial: ftdi_sio: add NovaTech OrionMX product ID
  usb: dwc3: ep0: fix NULL pointer exception
  USB: f_ncm: ncm_bitrate (speed) is unsigned
  cgroup1: don't allow '\n' in renaming
  btrfs: return value from btrfs_mark_extent_written() in case of error
  kvm: avoid speculation-based attacks from out-of-range memslot accesses
  drm: Lock pointer access in drm_master_release()
  i2c: mpc: implement erratum A-004447 workaround
  i2c: mpc: Make use of i2c_recover_bus()
  powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllers
  powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers
  bnx2x: Fix missing error code in bnx2x_iov_init_one()
  MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER
  net: appletalk: cops: Fix data race in cops_probe1
  net: macb: ensure the device is available before accessing GEMGXL control registers
  scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal
  scsi: vmw_pvscsi: Set correct residual data length
  net/qla3xxx: fix schedule while atomic in ql_sem_spinlock
  wq: handle VM suspension in stall detection
  cgroup: disable controllers at parse time
  net: mdiobus: get rid of a BUG_ON()
  netlink: disable IRQs for netlink_lock_table()
  bonding: init notify_work earlier to avoid uninitialized use
  isdn: mISDN: netjet: Fix crash in nj_probe:
  ASoC: sti-sas: add missing MODULE_DEVICE_TABLE
  net/nfc/rawsock.c: fix a permission check bug
  proc: Track /proc/$pid/attr/ opener mm_struct

Signed-off-by: Khusika Dhamar Gusti <mail@khusika.com>
  • Loading branch information
Khusika Dhamar Gusti committed Jun 17, 2021
2 parents e9ad28b + b3bf822 commit 1f986a8
Show file tree
Hide file tree
Showing 46 changed files with 261 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 272
SUBLEVEL = 273
EXTRAVERSION =
NAME = Roaring Lionus

Expand Down
12 changes: 6 additions & 6 deletions arch/mips/lib/mips-atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
notrace void arch_local_irq_disable(void)
{
preempt_disable();
preempt_disable_notrace();

__asm__ __volatile__(
" .set push \n"
Expand All @@ -53,15 +53,15 @@ notrace void arch_local_irq_disable(void)
: /* no inputs */
: "memory");

preempt_enable();
preempt_enable_notrace();
}
EXPORT_SYMBOL(arch_local_irq_disable);

notrace unsigned long arch_local_irq_save(void)
{
unsigned long flags;

preempt_disable();
preempt_disable_notrace();

__asm__ __volatile__(
" .set push \n"
Expand All @@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void)
: /* no inputs */
: "memory");

preempt_enable();
preempt_enable_notrace();

return flags;
}
Expand All @@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags)
{
unsigned long __tmp1;

preempt_disable();
preempt_disable_notrace();

__asm__ __volatile__(
" .set push \n"
Expand All @@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags)
: "0" (flags)
: "memory");

preempt_enable();
preempt_enable_notrace();
}
EXPORT_SYMBOL(arch_local_irq_restore);

Expand Down
8 changes: 8 additions & 0 deletions arch/powerpc/boot/dts/fsl/p1010si-post.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,15 @@
};

/include/ "pq3-i2c-0.dtsi"
i2c@3000 {
fsl,i2c-erratum-a004447;
};

/include/ "pq3-i2c-1.dtsi"
i2c@3100 {
fsl,i2c-erratum-a004447;
};

/include/ "pq3-duart-0.dtsi"
/include/ "pq3-espi-0.dtsi"
spi0: spi@7000 {
Expand Down
16 changes: 16 additions & 0 deletions arch/powerpc/boot/dts/fsl/p2041si-post.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,23 @@
};

/include/ "qoriq-i2c-0.dtsi"
i2c@118000 {
fsl,i2c-erratum-a004447;
};

i2c@118100 {
fsl,i2c-erratum-a004447;
};

/include/ "qoriq-i2c-1.dtsi"
i2c@119000 {
fsl,i2c-erratum-a004447;
};

i2c@119100 {
fsl,i2c-erratum-a004447;
};

/include/ "qoriq-duart-0.dtsi"
/include/ "qoriq-duart-1.dtsi"
/include/ "qoriq-gpio-0.dtsi"
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/drm_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,10 @@ int drm_master_open(struct drm_file *file_priv)
void drm_master_release(struct drm_file *file_priv)
{
struct drm_device *dev = file_priv->minor->dev;
struct drm_master *master = file_priv->master;
struct drm_master *master;

mutex_lock(&dev->master_mutex);
master = file_priv->master;
if (file_priv->magic)
idr_remove(&file_priv->master->magic_map, file_priv->magic);

Expand Down
95 changes: 93 additions & 2 deletions drivers/i2c/busses/i2c-mpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <linux/clk.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/fsl_devices.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
Expand All @@ -49,6 +50,7 @@
#define CCR_MTX 0x10
#define CCR_TXAK 0x08
#define CCR_RSTA 0x04
#define CCR_RSVD 0x02

#define CSR_MCF 0x80
#define CSR_MAAS 0x40
Expand All @@ -70,6 +72,7 @@ struct mpc_i2c {
u8 fdr, dfsrr;
#endif
struct clk *clk_per;
bool has_errata_A004447;
};

struct mpc_i2c_divider {
Expand Down Expand Up @@ -178,6 +181,75 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
return 0;
}

static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask)
{
void __iomem *addr = i2c->base + MPC_I2C_SR;
u8 val;

return readb_poll_timeout(addr, val, val & mask, 0, 100);
}

/*
* Workaround for Erratum A004447. From the P2040CE Rev Q
*
* 1. Set up the frequency divider and sampling rate.
* 2. I2CCR - a0h
* 3. Poll for I2CSR[MBB] to get set.
* 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to
* step 5. If MAL is not set, then go to step 13.
* 5. I2CCR - 00h
* 6. I2CCR - 22h
* 7. I2CCR - a2h
* 8. Poll for I2CSR[MBB] to get set.
* 9. Issue read to I2CDR.
* 10. Poll for I2CSR[MIF] to be set.
* 11. I2CCR - 82h
* 12. Workaround complete. Skip the next steps.
* 13. Issue read to I2CDR.
* 14. Poll for I2CSR[MIF] to be set.
* 15. I2CCR - 80h
*/
static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c)
{
int ret;
u32 val;

writeccr(i2c, CCR_MEN | CCR_MSTA);
ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
if (ret) {
dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
return;
}

val = readb(i2c->base + MPC_I2C_SR);

if (val & CSR_MAL) {
writeccr(i2c, 0x00);
writeccr(i2c, CCR_MSTA | CCR_RSVD);
writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD);
ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
if (ret) {
dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
return;
}
val = readb(i2c->base + MPC_I2C_DR);
ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
if (ret) {
dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
return;
}
writeccr(i2c, CCR_MEN | CCR_RSVD);
} else {
val = readb(i2c->base + MPC_I2C_DR);
ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
if (ret) {
dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
return;
}
writeccr(i2c, CCR_MEN);
}
}

#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
{20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
Expand Down Expand Up @@ -581,7 +653,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) {
writeb(status & ~CSR_MAL,
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
i2c_recover_bus(&i2c->adap);
}
return -EIO;
}
Expand Down Expand Up @@ -617,7 +689,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) {
writeb(status & ~CSR_MAL,
i2c->base + MPC_I2C_SR);
mpc_i2c_fixup(i2c);
i2c_recover_bus(&i2c->adap);
}
return -EIO;
}
Expand All @@ -632,6 +704,18 @@ static u32 mpc_functionality(struct i2c_adapter *adap)
| I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL;
}

static int fsl_i2c_bus_recovery(struct i2c_adapter *adap)
{
struct mpc_i2c *i2c = i2c_get_adapdata(adap);

if (i2c->has_errata_A004447)
mpc_i2c_fixup_A004447(i2c);
else
mpc_i2c_fixup(i2c);

return 0;
}

static const struct i2c_algorithm mpc_algo = {
.master_xfer = mpc_xfer,
.functionality = mpc_functionality,
Expand All @@ -643,6 +727,10 @@ static struct i2c_adapter mpc_ops = {
.timeout = HZ,
};

static struct i2c_bus_recovery_info fsl_i2c_recovery_info = {
.recover_bus = fsl_i2c_bus_recovery,
};

static const struct of_device_id mpc_i2c_of_match[];
static int fsl_i2c_probe(struct platform_device *op)
{
Expand Down Expand Up @@ -727,6 +815,8 @@ static int fsl_i2c_probe(struct platform_device *op)
dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ);

platform_set_drvdata(op, i2c);
if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447"))
i2c->has_errata_A004447 = true;

i2c->adap = mpc_ops;
of_address_to_resource(op->dev.of_node, 0, &res);
Expand All @@ -735,6 +825,7 @@ static int fsl_i2c_probe(struct platform_device *op)
i2c_set_adapdata(&i2c->adap, i2c);
i2c->adap.dev.parent = &op->dev;
i2c->adap.dev.of_node = of_node_get(op->dev.of_node);
i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info;

result = i2c_add_adapter(&i2c->adap);
if (result < 0)
Expand Down
1 change: 0 additions & 1 deletion drivers/isdn/hardware/mISDN/netjet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
card->typ = NETJET_S_TJ300;

card->base = pci_resource_start(pdev, 0);
card->irq = pdev->irq;
pci_set_drvdata(pdev, card);
err = setup_instance(card);
if (err)
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/appletalk/cops.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,15 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
break;
}

dev->base_addr = ioaddr;

/* Reserve any actual interrupt. */
if (dev->irq) {
retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev);
if (retval)
goto err_out;
}

dev->base_addr = ioaddr;

lp = netdev_priv(dev);
spin_lock_init(&lp->lock);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond,

slave->bond = bond;
slave->dev = slave_dev;
INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);

if (bond_kobj_init(slave))
return NULL;
Expand All @@ -1292,7 +1293,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond,
return NULL;
}
}
INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);

return slave;
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,8 +1240,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
goto failed;

/* SR-IOV capability was enabled but there are no VFs*/
if (iov->total == 0)
if (iov->total == 0) {
err = -EINVAL;
goto failed;
}

iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param);

Expand Down
3 changes: 3 additions & 0 deletions drivers/net/ethernet/cadence/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp)
struct gem_stats *hwstat = &bp->hw_stats.gem;
struct net_device_stats *nstat = &bp->stats;

if (!netif_running(bp->dev))
return nstat;

gem_update_stats(bp);

nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/qlogic/qla3xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev,
value = readl(&port_regs->CommonRegs.semaphoreReg);
if ((value & (sem_mask >> 16)) == sem_bits)
return 0;
ssleep(1);
mdelay(1000);
} while (--seconds);
return -1;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/phy/mdio_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,8 @@ void mdiobus_unregister(struct mii_bus *bus)
struct mdio_device *mdiodev;
int i;

BUG_ON(bus->state != MDIOBUS_REGISTERED);
if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED))
return;
bus->state = MDIOBUS_UNREGISTERED;

for (i = 0; i < PHY_MAX_ADDR; i++) {
Expand Down

0 comments on commit 1f986a8

Please sign in to comment.