Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
34c86f4
crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock…
herbertx Jun 8, 2020
e04ec0d
padata: upgrade smp_mb__after_atomic to smp_mb in padata_do_serial
danieljordan10 Jun 8, 2020
7684580
spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer
krzk Jun 22, 2020
3c525b6
spi: spi-fsl-dspi: Fix lockup if device is shutdown during SPI transfer
krzk Jun 22, 2020
3d87b61
spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit …
krzk Jun 22, 2020
f148915
spi: spi-fsl-dspi: Initialize completion before possible interrupt
krzk Jun 22, 2020
cf961fc
spi: pxa2xx: Add support for Intel Tiger Lake PCH-H
jhnikula Jun 25, 2020
b45fd13
thermal/drivers: imx: Fix missing of_node_put() at probe time
Anson-Huang Mar 26, 2020
14533a5
thermal/drivers/mediatek: Fix bank number settings on mt8183
Mar 23, 2020
b414791
thermal/drivers/sprd: Fix return value of sprd_thm_probe()
seehearfeel May 25, 2020
3ecc829
thermal/drivers/tsens: Fix compilation warnings by making functions s…
May 27, 2020
371a3bc
thermal/drivers/cpufreq_cooling: Fix wrong frequency converted from p…
finley1226 Jun 19, 2020
5f8f064
thermal/drivers/rcar_gen3: Fix undefined temperature if negative
DienPhamM Jun 25, 2020
b6509f6
Revert "fs: Do not check if there is a fsnotify watcher on pseudo ino…
gormanm Jun 29, 2020
2cfa46d
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git…
torvalds Jun 29, 2020
be88fef
Merge tag 'thermal-v5.8-rc4' of git://git.kernel.org/pub/scm/linux/ke…
torvalds Jun 29, 2020
7c30b85
Merge tag 'spi-fix-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/ke…
torvalds Jun 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,15 @@ EXPORT_SYMBOL_GPL(af_alg_release);
void af_alg_release_parent(struct sock *sk)
{
struct alg_sock *ask = alg_sk(sk);
unsigned int nokey = ask->nokey_refcnt;
bool last = nokey && !ask->refcnt;
unsigned int nokey = atomic_read(&ask->nokey_refcnt);

sk = ask->parent;
ask = alg_sk(sk);

local_bh_disable();
bh_lock_sock(sk);
ask->nokey_refcnt -= nokey;
if (!last)
last = !--ask->refcnt;
bh_unlock_sock(sk);
local_bh_enable();
if (nokey)
atomic_dec(&ask->nokey_refcnt);

if (last)
if (atomic_dec_and_test(&ask->refcnt))
sock_put(sk);
}
EXPORT_SYMBOL_GPL(af_alg_release_parent);
Expand Down Expand Up @@ -187,7 +181,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)

err = -EBUSY;
lock_sock(sk);
if (ask->refcnt | ask->nokey_refcnt)
if (atomic_read(&ask->refcnt))
goto unlock;

swap(ask->type, type);
Expand Down Expand Up @@ -236,7 +230,7 @@ static int alg_setsockopt(struct socket *sock, int level, int optname,
int err = -EBUSY;

lock_sock(sk);
if (ask->refcnt)
if (atomic_read(&ask->refcnt) != atomic_read(&ask->nokey_refcnt))
goto unlock;

type = ask->type;
Expand Down Expand Up @@ -301,12 +295,14 @@ int af_alg_accept(struct sock *sk, struct socket *newsock, bool kern)
if (err)
goto unlock;

if (nokey || !ask->refcnt++)
if (atomic_inc_return_relaxed(&ask->refcnt) == 1)
sock_hold(sk);
ask->nokey_refcnt += nokey;
if (nokey) {
atomic_inc(&ask->nokey_refcnt);
atomic_set(&alg_sk(sk2)->nokey_refcnt, 1);
}
alg_sk(sk2)->parent = sk;
alg_sk(sk2)->type = type;
alg_sk(sk2)->nokey_refcnt = nokey;

newsock->ops = type->ops;
newsock->state = SS_CONNECTED;
Expand Down
9 changes: 3 additions & 6 deletions crypto/algif_aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ static int aead_check_key(struct socket *sock)
struct alg_sock *ask = alg_sk(sk);

lock_sock(sk);
if (ask->refcnt)
if (!atomic_read(&ask->nokey_refcnt))
goto unlock_child;

psk = ask->parent;
Expand All @@ -396,11 +396,8 @@ static int aead_check_key(struct socket *sock)
if (crypto_aead_get_flags(tfm->aead) & CRYPTO_TFM_NEED_KEY)
goto unlock;

if (!pask->refcnt++)
sock_hold(psk);

ask->refcnt = 1;
sock_put(psk);
atomic_dec(&pask->nokey_refcnt);
atomic_set(&ask->nokey_refcnt, 0);

err = 0;

Expand Down
9 changes: 3 additions & 6 deletions crypto/algif_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ static int hash_check_key(struct socket *sock)
struct alg_sock *ask = alg_sk(sk);

lock_sock(sk);
if (ask->refcnt)
if (!atomic_read(&ask->nokey_refcnt))
goto unlock_child;

psk = ask->parent;
Expand All @@ -313,11 +313,8 @@ static int hash_check_key(struct socket *sock)
if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
goto unlock;

if (!pask->refcnt++)
sock_hold(psk);

ask->refcnt = 1;
sock_put(psk);
atomic_dec(&pask->nokey_refcnt);
atomic_set(&ask->nokey_refcnt, 0);

err = 0;

Expand Down
9 changes: 3 additions & 6 deletions crypto/algif_skcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int skcipher_check_key(struct socket *sock)
struct alg_sock *ask = alg_sk(sk);

lock_sock(sk);
if (ask->refcnt)
if (!atomic_read(&ask->nokey_refcnt))
goto unlock_child;

psk = ask->parent;
Expand All @@ -223,11 +223,8 @@ static int skcipher_check_key(struct socket *sock)
if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
goto unlock;

if (!pask->refcnt++)
sock_hold(psk);

ask->refcnt = 1;
sock_put(psk);
atomic_dec(&pask->nokey_refcnt);
atomic_set(&ask->nokey_refcnt, 0);

err = 0;

Expand Down
39 changes: 22 additions & 17 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,8 @@ static int dspi_suspend(struct device *dev)
struct spi_controller *ctlr = dev_get_drvdata(dev);
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);

if (dspi->irq)
disable_irq(dspi->irq);
spi_controller_suspend(ctlr);
clk_disable_unprepare(dspi->clk);

Expand All @@ -1129,6 +1131,8 @@ static int dspi_resume(struct device *dev)
if (ret)
return ret;
spi_controller_resume(ctlr);
if (dspi->irq)
enable_irq(dspi->irq);

return 0;
}
Expand Down Expand Up @@ -1385,22 +1389,22 @@ static int dspi_probe(struct platform_device *pdev)
goto poll_mode;
}

ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt,
IRQF_SHARED, pdev->name, dspi);
init_completion(&dspi->xfer_done);

ret = request_threaded_irq(dspi->irq, dspi_interrupt, NULL,
IRQF_SHARED, pdev->name, dspi);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n");
goto out_clk_put;
}

init_completion(&dspi->xfer_done);

poll_mode:

if (dspi->devtype_data->trans_mode == DSPI_DMA_MODE) {
ret = dspi_request_dma(dspi, res->start);
if (ret < 0) {
dev_err(&pdev->dev, "can't get dma channels\n");
goto out_clk_put;
goto out_free_irq;
}
}

Expand All @@ -1415,11 +1419,14 @@ static int dspi_probe(struct platform_device *pdev)
ret = spi_register_controller(ctlr);
if (ret != 0) {
dev_err(&pdev->dev, "Problem registering DSPI ctlr\n");
goto out_clk_put;
goto out_free_irq;
}

return ret;

out_free_irq:
if (dspi->irq)
free_irq(dspi->irq, dspi);
out_clk_put:
clk_disable_unprepare(dspi->clk);
out_ctlr_put:
Expand All @@ -1434,18 +1441,8 @@ static int dspi_remove(struct platform_device *pdev)
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);

/* Disconnect from the SPI framework */
dspi_release_dma(dspi);
clk_disable_unprepare(dspi->clk);
spi_unregister_controller(dspi->ctlr);

return 0;
}

static void dspi_shutdown(struct platform_device *pdev)
{
struct spi_controller *ctlr = platform_get_drvdata(pdev);
struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);

/* Disable RX and TX */
regmap_update_bits(dspi->regmap, SPI_MCR,
SPI_MCR_DIS_TXF | SPI_MCR_DIS_RXF,
Expand All @@ -1455,8 +1452,16 @@ static void dspi_shutdown(struct platform_device *pdev)
regmap_update_bits(dspi->regmap, SPI_MCR, SPI_MCR_HALT, SPI_MCR_HALT);

dspi_release_dma(dspi);
if (dspi->irq)
free_irq(dspi->irq, dspi);
clk_disable_unprepare(dspi->clk);
spi_unregister_controller(dspi->ctlr);

return 0;
}

static void dspi_shutdown(struct platform_device *pdev)
{
dspi_remove(pdev);
}

static struct platform_driver fsl_dspi_driver = {
Expand Down
5 changes: 5 additions & 0 deletions drivers/spi/spi-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,11 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
{ PCI_VDEVICE(INTEL, 0x4daa), LPSS_CNL_SSP },
{ PCI_VDEVICE(INTEL, 0x4dab), LPSS_CNL_SSP },
{ PCI_VDEVICE(INTEL, 0x4dfb), LPSS_CNL_SSP },
/* TGL-H */
{ PCI_VDEVICE(INTEL, 0x43aa), LPSS_CNL_SSP },
{ PCI_VDEVICE(INTEL, 0x43ab), LPSS_CNL_SSP },
{ PCI_VDEVICE(INTEL, 0x43fb), LPSS_CNL_SSP },
{ PCI_VDEVICE(INTEL, 0x43fd), LPSS_CNL_SSP },
/* APL */
{ PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP },
{ PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP },
Expand Down
6 changes: 3 additions & 3 deletions drivers/thermal/cpufreq_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ static u32 cpu_power_to_freq(struct cpufreq_cooling_device *cpufreq_cdev,
{
int i;

for (i = cpufreq_cdev->max_level - 1; i >= 0; i--) {
if (power > cpufreq_cdev->em->table[i].power)
for (i = cpufreq_cdev->max_level; i >= 0; i--) {
if (power >= cpufreq_cdev->em->table[i].power)
break;
}

return cpufreq_cdev->em->table[i + 1].frequency;
return cpufreq_cdev->em->table[i].frequency;
}

/**
Expand Down
7 changes: 4 additions & 3 deletions drivers/thermal/imx_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
{
struct device_node *np;
int ret;
int ret = 0;

data->policy = cpufreq_cpu_get(0);
if (!data->policy) {
Expand All @@ -664,11 +664,12 @@ static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
if (IS_ERR(data->cdev)) {
ret = PTR_ERR(data->cdev);
cpufreq_cpu_put(data->policy);
return ret;
}
}

return 0;
of_node_put(np);

return ret;
}

static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
Expand Down
5 changes: 4 additions & 1 deletion drivers/thermal/mtk_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ enum {
/* The total number of temperature sensors in the MT8183 */
#define MT8183_NUM_SENSORS 6

/* The number of banks in the MT8183 */
#define MT8183_NUM_ZONES 1

/* The number of sensing points per bank */
#define MT8183_NUM_SENSORS_PER_ZONE 6

Expand Down Expand Up @@ -497,7 +500,7 @@ static const struct mtk_thermal_data mt7622_thermal_data = {
*/
static const struct mtk_thermal_data mt8183_thermal_data = {
.auxadc_channel = MT8183_TEMP_AUXADC_CHANNEL,
.num_banks = MT8183_NUM_SENSORS_PER_ZONE,
.num_banks = MT8183_NUM_ZONES,
.num_sensors = MT8183_NUM_SENSORS,
.vts_index = mt8183_vts_index,
.cali_val = MT8183_CALIBRATION,
Expand Down
10 changes: 5 additions & 5 deletions drivers/thermal/qcom/tsens.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static inline u32 masked_irq(u32 hw_id, u32 mask, enum tsens_ver ver)
*
* Return: IRQ_HANDLED
*/
irqreturn_t tsens_critical_irq_thread(int irq, void *data)
static irqreturn_t tsens_critical_irq_thread(int irq, void *data)
{
struct tsens_priv *priv = data;
struct tsens_irq_data d;
Expand Down Expand Up @@ -452,7 +452,7 @@ irqreturn_t tsens_critical_irq_thread(int irq, void *data)
*
* Return: IRQ_HANDLED
*/
irqreturn_t tsens_irq_thread(int irq, void *data)
static irqreturn_t tsens_irq_thread(int irq, void *data)
{
struct tsens_priv *priv = data;
struct tsens_irq_data d;
Expand Down Expand Up @@ -520,7 +520,7 @@ irqreturn_t tsens_irq_thread(int irq, void *data)
return IRQ_HANDLED;
}

int tsens_set_trips(void *_sensor, int low, int high)
static int tsens_set_trips(void *_sensor, int low, int high)
{
struct tsens_sensor *s = _sensor;
struct tsens_priv *priv = s->priv;
Expand Down Expand Up @@ -557,7 +557,7 @@ int tsens_set_trips(void *_sensor, int low, int high)
return 0;
}

int tsens_enable_irq(struct tsens_priv *priv)
static int tsens_enable_irq(struct tsens_priv *priv)
{
int ret;
int val = tsens_version(priv) > VER_1_X ? 7 : 1;
Expand All @@ -570,7 +570,7 @@ int tsens_enable_irq(struct tsens_priv *priv)
return ret;
}

void tsens_disable_irq(struct tsens_priv *priv)
static void tsens_disable_irq(struct tsens_priv *priv)
{
regmap_field_write(priv->rf[INT_EN], 0);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/rcar_gen3_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static int rcar_gen3_thermal_get_temp(void *devdata, int *temp)
{
struct rcar_gen3_thermal_tsc *tsc = devdata;
int mcelsius, val;
u32 reg;
int reg;

/* Read register and convert to mili Celsius */
reg = rcar_gen3_thermal_read(tsc, REG_GEN3_TEMP) & CTEMP_MASK;
Expand Down
4 changes: 2 additions & 2 deletions drivers/thermal/sprd_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@ static int sprd_thm_probe(struct platform_device *pdev)

thm->var_data = pdata;
thm->base = devm_platform_ioremap_resource(pdev, 0);
if (!thm->base)
return -ENOMEM;
if (IS_ERR(thm->base))
return PTR_ERR(thm->base);

thm->nr_sensors = of_get_child_count(np);
if (thm->nr_sensors == 0 || thm->nr_sensors > SPRD_THM_MAX_SENSOR) {
Expand Down
2 changes: 1 addition & 1 deletion fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ struct file *alloc_file_pseudo(struct inode *inode, struct vfsmount *mnt,
d_set_d_op(path.dentry, &anon_ops);
path.mnt = mntget(mnt);
d_instantiate(path.dentry, inode);
file = alloc_file(&path, flags | FMODE_NONOTIFY, fops);
file = alloc_file(&path, flags, fops);
if (IS_ERR(file)) {
ihold(inode);
path_put(&path);
Expand Down
4 changes: 2 additions & 2 deletions include/crypto/if_alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ struct alg_sock {

struct sock *parent;

unsigned int refcnt;
unsigned int nokey_refcnt;
atomic_t refcnt;
atomic_t nokey_refcnt;

const struct af_alg_type *type;
void *private;
Expand Down
Loading