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

Commit 45d80f16 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull media fixes from Mauro Carvalho Chehab:
 "Some regression fixes and potential security issues:

   - netup_unidvb: fix potential crash when spi is NULL
   - rtl28xxu: fix control message flaws
   - m88ds3103: fix a regression on Kernel 4.2
   - c8sectpfe: fix some issues on this new driver
   - v4l2-flash-led-class: fix a Kbuild dependency
   - si2157 and si2158: check for array boundary when uploading firmware
     files
   - horus3a and lnbh25: fix some building troubles when some options
     aren't selected
   - ir-hix5hd2: drop the use of IRQF_NO_SUSPEND"

* tag 'media/v4.3-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] m88ds3103: use own reg update_bits() implementation
  [media] rtl28xxu: fix control message flaws
  [media] v4l2-flash-led-class: Add missing VIDEO_V4L2 Kconfig dependency
  [media] netup_unidvb: fix potential crash when spi is NULL
  [media] si2168: Bounds check firmware
  [media] si2157: Bounds check firmware
  [media] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
  [media] c8sectpfe: fix return of garbage
  [media] c8sectpfe: fix ininitialized error return on firmware load failure
  [media] lnbh25: Fix lnbh25_attach() function return type
  [media] horus3a: Fix horus3a_attach() function parameters
parents a67b20d2 56ea37da
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ extern struct dvb_frontend *horus3a_attach(struct dvb_frontend *fe,
					const struct horus3a_config *config,
					struct i2c_adapter *i2c);
#else
static inline struct dvb_frontend *horus3a_attach(
					const struct cxd2820r_config *config,
static inline struct dvb_frontend *horus3a_attach(struct dvb_frontend *fe,
					const struct horus3a_config *config,
					struct i2c_adapter *i2c)
{
	printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ struct dvb_frontend *lnbh25_attach(
	struct lnbh25_config *cfg,
	struct i2c_adapter *i2c);
#else
static inline dvb_frontend *lnbh25_attach(
static inline struct dvb_frontend *lnbh25_attach(
	struct dvb_frontend *fe,
	struct lnbh25_config *cfg,
	struct i2c_adapter *i2c)
+47 −26
Original line number Diff line number Diff line
@@ -18,6 +18,27 @@

static struct dvb_frontend_ops m88ds3103_ops;

/* write single register with mask */
static int m88ds3103_update_bits(struct m88ds3103_dev *dev,
				u8 reg, u8 mask, u8 val)
{
	int ret;
	u8 tmp;

	/* no need for read if whole reg is written */
	if (mask != 0xff) {
		ret = regmap_bulk_read(dev->regmap, reg, &tmp, 1);
		if (ret)
			return ret;

		val &= mask;
		tmp &= ~mask;
		val |= tmp;
	}

	return regmap_bulk_write(dev->regmap, reg, &val, 1);
}

/* write reg val table using reg addr auto increment */
static int m88ds3103_wr_reg_val_tab(struct m88ds3103_dev *dev,
		const struct m88ds3103_reg_val *tab, int tab_len)
@@ -394,10 +415,10 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
			u8tmp2 = 0x00; /* 0b00 */
			break;
		}
		ret = regmap_update_bits(dev->regmap, 0x22, 0xc0, u8tmp1 << 6);
		ret = m88ds3103_update_bits(dev, 0x22, 0xc0, u8tmp1 << 6);
		if (ret)
			goto err;
		ret = regmap_update_bits(dev->regmap, 0x24, 0xc0, u8tmp2 << 6);
		ret = m88ds3103_update_bits(dev, 0x24, 0xc0, u8tmp2 << 6);
		if (ret)
			goto err;
	}
@@ -455,13 +476,13 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
			if (ret)
				goto err;
		}
		ret = regmap_update_bits(dev->regmap, 0x9d, 0x08, 0x08);
		ret = m88ds3103_update_bits(dev, 0x9d, 0x08, 0x08);
		if (ret)
			goto err;
		ret = regmap_write(dev->regmap, 0xf1, 0x01);
		if (ret)
			goto err;
		ret = regmap_update_bits(dev->regmap, 0x30, 0x80, 0x80);
		ret = m88ds3103_update_bits(dev, 0x30, 0x80, 0x80);
		if (ret)
			goto err;
	}
@@ -498,7 +519,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
	switch (dev->cfg->ts_mode) {
	case M88DS3103_TS_SERIAL:
	case M88DS3103_TS_SERIAL_D7:
		ret = regmap_update_bits(dev->regmap, 0x29, 0x20, u8tmp1);
		ret = m88ds3103_update_bits(dev, 0x29, 0x20, u8tmp1);
		if (ret)
			goto err;
		u8tmp1 = 0;
@@ -567,11 +588,11 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
	if (ret)
		goto err;

	ret = regmap_update_bits(dev->regmap, 0x4d, 0x02, dev->cfg->spec_inv << 1);
	ret = m88ds3103_update_bits(dev, 0x4d, 0x02, dev->cfg->spec_inv << 1);
	if (ret)
		goto err;

	ret = regmap_update_bits(dev->regmap, 0x30, 0x10, dev->cfg->agc_inv << 4);
	ret = m88ds3103_update_bits(dev, 0x30, 0x10, dev->cfg->agc_inv << 4);
	if (ret)
		goto err;

@@ -625,13 +646,13 @@ static int m88ds3103_init(struct dvb_frontend *fe)
	dev->warm = false;

	/* wake up device from sleep */
	ret = regmap_update_bits(dev->regmap, 0x08, 0x01, 0x01);
	ret = m88ds3103_update_bits(dev, 0x08, 0x01, 0x01);
	if (ret)
		goto err;
	ret = regmap_update_bits(dev->regmap, 0x04, 0x01, 0x00);
	ret = m88ds3103_update_bits(dev, 0x04, 0x01, 0x00);
	if (ret)
		goto err;
	ret = regmap_update_bits(dev->regmap, 0x23, 0x10, 0x00);
	ret = m88ds3103_update_bits(dev, 0x23, 0x10, 0x00);
	if (ret)
		goto err;

@@ -749,18 +770,18 @@ static int m88ds3103_sleep(struct dvb_frontend *fe)
		utmp = 0x29;
	else
		utmp = 0x27;
	ret = regmap_update_bits(dev->regmap, utmp, 0x01, 0x00);
	ret = m88ds3103_update_bits(dev, utmp, 0x01, 0x00);
	if (ret)
		goto err;

	/* sleep */
	ret = regmap_update_bits(dev->regmap, 0x08, 0x01, 0x00);
	ret = m88ds3103_update_bits(dev, 0x08, 0x01, 0x00);
	if (ret)
		goto err;
	ret = regmap_update_bits(dev->regmap, 0x04, 0x01, 0x01);
	ret = m88ds3103_update_bits(dev, 0x04, 0x01, 0x01);
	if (ret)
		goto err;
	ret = regmap_update_bits(dev->regmap, 0x23, 0x10, 0x10);
	ret = m88ds3103_update_bits(dev, 0x23, 0x10, 0x10);
	if (ret)
		goto err;

@@ -992,12 +1013,12 @@ static int m88ds3103_set_tone(struct dvb_frontend *fe,
	}

	utmp = tone << 7 | dev->cfg->envelope_mode << 5;
	ret = regmap_update_bits(dev->regmap, 0xa2, 0xe0, utmp);
	ret = m88ds3103_update_bits(dev, 0xa2, 0xe0, utmp);
	if (ret)
		goto err;

	utmp = 1 << 2;
	ret = regmap_update_bits(dev->regmap, 0xa1, reg_a1_mask, utmp);
	ret = m88ds3103_update_bits(dev, 0xa1, reg_a1_mask, utmp);
	if (ret)
		goto err;

@@ -1047,7 +1068,7 @@ static int m88ds3103_set_voltage(struct dvb_frontend *fe,
	voltage_dis ^= dev->cfg->lnb_en_pol;

	utmp = voltage_dis << 1 | voltage_sel << 0;
	ret = regmap_update_bits(dev->regmap, 0xa2, 0x03, utmp);
	ret = m88ds3103_update_bits(dev, 0xa2, 0x03, utmp);
	if (ret)
		goto err;

@@ -1080,7 +1101,7 @@ static int m88ds3103_diseqc_send_master_cmd(struct dvb_frontend *fe,
	}

	utmp = dev->cfg->envelope_mode << 5;
	ret = regmap_update_bits(dev->regmap, 0xa2, 0xe0, utmp);
	ret = m88ds3103_update_bits(dev, 0xa2, 0xe0, utmp);
	if (ret)
		goto err;

@@ -1115,12 +1136,12 @@ static int m88ds3103_diseqc_send_master_cmd(struct dvb_frontend *fe,
	} else {
		dev_dbg(&client->dev, "diseqc tx timeout\n");

		ret = regmap_update_bits(dev->regmap, 0xa1, 0xc0, 0x40);
		ret = m88ds3103_update_bits(dev, 0xa1, 0xc0, 0x40);
		if (ret)
			goto err;
	}

	ret = regmap_update_bits(dev->regmap, 0xa2, 0xc0, 0x80);
	ret = m88ds3103_update_bits(dev, 0xa2, 0xc0, 0x80);
	if (ret)
		goto err;

@@ -1152,7 +1173,7 @@ static int m88ds3103_diseqc_send_burst(struct dvb_frontend *fe,
	}

	utmp = dev->cfg->envelope_mode << 5;
	ret = regmap_update_bits(dev->regmap, 0xa2, 0xe0, utmp);
	ret = m88ds3103_update_bits(dev, 0xa2, 0xe0, utmp);
	if (ret)
		goto err;

@@ -1194,12 +1215,12 @@ static int m88ds3103_diseqc_send_burst(struct dvb_frontend *fe,
	} else {
		dev_dbg(&client->dev, "diseqc tx timeout\n");

		ret = regmap_update_bits(dev->regmap, 0xa1, 0xc0, 0x40);
		ret = m88ds3103_update_bits(dev, 0xa1, 0xc0, 0x40);
		if (ret)
			goto err;
	}

	ret = regmap_update_bits(dev->regmap, 0xa2, 0xc0, 0x80);
	ret = m88ds3103_update_bits(dev, 0xa2, 0xc0, 0x80);
	if (ret)
		goto err;

@@ -1435,13 +1456,13 @@ static int m88ds3103_probe(struct i2c_client *client,
		goto err_kfree;

	/* sleep */
	ret = regmap_update_bits(dev->regmap, 0x08, 0x01, 0x00);
	ret = m88ds3103_update_bits(dev, 0x08, 0x01, 0x00);
	if (ret)
		goto err_kfree;
	ret = regmap_update_bits(dev->regmap, 0x04, 0x01, 0x01);
	ret = m88ds3103_update_bits(dev, 0x04, 0x01, 0x01);
	if (ret)
		goto err_kfree;
	ret = regmap_update_bits(dev->regmap, 0x23, 0x10, 0x10);
	ret = m88ds3103_update_bits(dev, 0x23, 0x10, 0x10);
	if (ret)
		goto err_kfree;

+4 −0
Original line number Diff line number Diff line
@@ -502,6 +502,10 @@ static int si2168_init(struct dvb_frontend *fe)
		/* firmware is in the new format */
		for (remaining = fw->size; remaining > 0; remaining -= 17) {
			len = fw->data[fw->size - remaining];
			if (len > SI2168_ARGLEN) {
				ret = -EINVAL;
				break;
			}
			memcpy(cmd.args, &fw->data[(fw->size - remaining) + 1], len);
			cmd.wlen = len;
			cmd.rlen = 1;
+4 −8
Original line number Diff line number Diff line
@@ -80,11 +80,9 @@ irqreturn_t netup_spi_interrupt(struct netup_spi *spi)
	u16 reg;
	unsigned long flags;

	if (!spi) {
		dev_dbg(&spi->master->dev,
			"%s(): SPI not initialized\n", __func__);
	if (!spi)
		return IRQ_NONE;
	}

	spin_lock_irqsave(&spi->lock, flags);
	reg = readw(&spi->regs->control_stat);
	if (!(reg & NETUP_SPI_CTRL_IRQ)) {
@@ -234,11 +232,9 @@ void netup_spi_release(struct netup_unidvb_dev *ndev)
	unsigned long flags;
	struct netup_spi *spi = ndev->spi;

	if (!spi) {
		dev_dbg(&spi->master->dev,
			"%s(): SPI not initialized\n", __func__);
	if (!spi)
		return;
	}

	spin_lock_irqsave(&spi->lock, flags);
	reg = readw(&spi->regs->control_stat);
	writew(reg | NETUP_SPI_CTRL_IRQ, &spi->regs->control_stat);
Loading