From: Sasha Levin Date: Thu, 7 Sep 2023 00:08:07 +0000 (-0400) Subject: Fixes for 5.4 X-Git-Tag: v6.1.53~156 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7085c0d58aa47a19a2032e3744a8516bae958c1;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/9p-virtio-make-sure-offs-is-initialized-in-zc_reques.patch b/queue-5.4/9p-virtio-make-sure-offs-is-initialized-in-zc_reques.patch new file mode 100644 index 00000000000..d9aeb7338e8 --- /dev/null +++ b/queue-5.4/9p-virtio-make-sure-offs-is-initialized-in-zc_reques.patch @@ -0,0 +1,43 @@ +From 6012c402a447d54894597124efb03ae8a0e7bbb8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 16:49:27 +0900 +Subject: 9p: virtio: make sure 'offs' is initialized in zc_request + +From: Dominique Martinet + +[ Upstream commit 4a73edab69d3a6623f03817fe950a2d9585f80e4 ] + +Similarly to the previous patch: offs can be used in handle_rerrors +without initializing on small payloads; in this case handle_rerrors will +not use it because of the size check, but it doesn't hurt to make sure +it is zero to please scan-build. + +This fixes the following warning: +net/9p/trans_virtio.c:539:3: warning: 3rd function call argument is an uninitialized value [core.CallAndMessage] + handle_rerror(req, in_hdr_len, offs, in_pages); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Reviewed-by: Simon Horman +Signed-off-by: Dominique Martinet +Signed-off-by: Eric Van Hensbergen +Signed-off-by: Sasha Levin +--- + net/9p/trans_virtio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c +index f582351d84ecb..36b5f72e2165c 100644 +--- a/net/9p/trans_virtio.c ++++ b/net/9p/trans_virtio.c +@@ -394,7 +394,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, + struct page **in_pages = NULL, **out_pages = NULL; + struct virtio_chan *chan = client->trans; + struct scatterlist *sgs[4]; +- size_t offs; ++ size_t offs = 0; + int need_drop = 0; + int kicked = 0; + +-- +2.40.1 + diff --git a/queue-5.4/alsa-seq-oss-fix-racy-open-close-of-midi-devices.patch b/queue-5.4/alsa-seq-oss-fix-racy-open-close-of-midi-devices.patch new file mode 100644 index 00000000000..75a03ecf334 --- /dev/null +++ b/queue-5.4/alsa-seq-oss-fix-racy-open-close-of-midi-devices.patch @@ -0,0 +1,128 @@ +From 069bf67c7d427cf3a97253340b41b7e73b71ffa3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Jun 2023 14:55:33 +0200 +Subject: ALSA: seq: oss: Fix racy open/close of MIDI devices + +From: Takashi Iwai + +[ Upstream commit 297224fc0922e7385573a30c29ffdabb67f27b7d ] + +Although snd_seq_oss_midi_open() and snd_seq_oss_midi_close() can be +called concurrently from different code paths, we have no proper data +protection against races. Introduce open_mutex to each seq_oss_midi +object for avoiding the races. + +Reported-by: "Gong, Sishuai" +Closes: https://lore.kernel.org/r/7DC9AF71-F481-4ABA-955F-76C535661E33@purdue.edu +Link: https://lore.kernel.org/r/20230612125533.27461-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/seq/oss/seq_oss_midi.c | 35 +++++++++++++++++++------------ + 1 file changed, 22 insertions(+), 13 deletions(-) + +diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c +index f73ee0798aeab..be80ce72e0c72 100644 +--- a/sound/core/seq/oss/seq_oss_midi.c ++++ b/sound/core/seq/oss/seq_oss_midi.c +@@ -37,6 +37,7 @@ struct seq_oss_midi { + struct snd_midi_event *coder; /* MIDI event coder */ + struct seq_oss_devinfo *devinfo; /* assigned OSSseq device */ + snd_use_lock_t use_lock; ++ struct mutex open_mutex; + }; + + +@@ -171,6 +172,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo) + mdev->flags = pinfo->capability; + mdev->opened = 0; + snd_use_lock_init(&mdev->use_lock); ++ mutex_init(&mdev->open_mutex); + + /* copy and truncate the name of synth device */ + strlcpy(mdev->name, pinfo->name, sizeof(mdev->name)); +@@ -319,14 +321,16 @@ snd_seq_oss_midi_open(struct seq_oss_devinfo *dp, int dev, int fmode) + int perm; + struct seq_oss_midi *mdev; + struct snd_seq_port_subscribe subs; ++ int err; + + if ((mdev = get_mididev(dp, dev)) == NULL) + return -ENODEV; + ++ mutex_lock(&mdev->open_mutex); + /* already used? */ + if (mdev->opened && mdev->devinfo != dp) { +- snd_use_lock_free(&mdev->use_lock); +- return -EBUSY; ++ err = -EBUSY; ++ goto unlock; + } + + perm = 0; +@@ -336,14 +340,14 @@ snd_seq_oss_midi_open(struct seq_oss_devinfo *dp, int dev, int fmode) + perm |= PERM_READ; + perm &= mdev->flags; + if (perm == 0) { +- snd_use_lock_free(&mdev->use_lock); +- return -ENXIO; ++ err = -ENXIO; ++ goto unlock; + } + + /* already opened? */ + if ((mdev->opened & perm) == perm) { +- snd_use_lock_free(&mdev->use_lock); +- return 0; ++ err = 0; ++ goto unlock; + } + + perm &= ~mdev->opened; +@@ -368,13 +372,17 @@ snd_seq_oss_midi_open(struct seq_oss_devinfo *dp, int dev, int fmode) + } + + if (! mdev->opened) { +- snd_use_lock_free(&mdev->use_lock); +- return -ENXIO; ++ err = -ENXIO; ++ goto unlock; + } + + mdev->devinfo = dp; ++ err = 0; ++ ++ unlock: ++ mutex_unlock(&mdev->open_mutex); + snd_use_lock_free(&mdev->use_lock); +- return 0; ++ return err; + } + + /* +@@ -388,10 +396,9 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev) + + if ((mdev = get_mididev(dp, dev)) == NULL) + return -ENODEV; +- if (! mdev->opened || mdev->devinfo != dp) { +- snd_use_lock_free(&mdev->use_lock); +- return 0; +- } ++ mutex_lock(&mdev->open_mutex); ++ if (!mdev->opened || mdev->devinfo != dp) ++ goto unlock; + + memset(&subs, 0, sizeof(subs)); + if (mdev->opened & PERM_WRITE) { +@@ -410,6 +417,8 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev) + mdev->opened = 0; + mdev->devinfo = NULL; + ++ unlock: ++ mutex_unlock(&mdev->open_mutex); + snd_use_lock_free(&mdev->use_lock); + return 0; + } +-- +2.40.1 + diff --git a/queue-5.4/asoc-atmel-fix-the-8k-sample-parameter-in-i2sc-maste.patch b/queue-5.4/asoc-atmel-fix-the-8k-sample-parameter-in-i2sc-maste.patch new file mode 100644 index 00000000000..5bf4ae171f2 --- /dev/null +++ b/queue-5.4/asoc-atmel-fix-the-8k-sample-parameter-in-i2sc-maste.patch @@ -0,0 +1,46 @@ +From edf1eb93152424f888b00212e1caba0113c95fe5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Jul 2023 11:06:20 +0800 +Subject: ASoC: atmel: Fix the 8K sample parameter in I2SC master + +From: Guiting Shen + +[ Upstream commit f85739c0b2b0d98a32f5ca4fcc5501d2b76df4f6 ] + +The 8K sample parameter of 12.288Mhz main system bus clock doesn't work +because the I2SC_MR.IMCKDIV must not be 0 according to the sama5d2 +series datasheet(I2SC Mode Register of Register Summary). + +So use the 6.144Mhz instead of 12.288Mhz to support 8K sample. + +Signed-off-by: Guiting Shen +Link: https://lore.kernel.org/r/20230715030620.62328-1-aarongt.shen@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/atmel/atmel-i2s.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/sound/soc/atmel/atmel-i2s.c b/sound/soc/atmel/atmel-i2s.c +index d870f56c44cfc..0341b31197670 100644 +--- a/sound/soc/atmel/atmel-i2s.c ++++ b/sound/soc/atmel/atmel-i2s.c +@@ -163,11 +163,14 @@ struct atmel_i2s_gck_param { + + #define I2S_MCK_12M288 12288000UL + #define I2S_MCK_11M2896 11289600UL ++#define I2S_MCK_6M144 6144000UL + + /* mck = (32 * (imckfs+1) / (imckdiv+1)) * fs */ + static const struct atmel_i2s_gck_param gck_params[] = { ++ /* mck = 6.144Mhz */ ++ { 8000, I2S_MCK_6M144, 1, 47}, /* mck = 768 fs */ ++ + /* mck = 12.288MHz */ +- { 8000, I2S_MCK_12M288, 0, 47}, /* mck = 1536 fs */ + { 16000, I2S_MCK_12M288, 1, 47}, /* mck = 768 fs */ + { 24000, I2S_MCK_12M288, 3, 63}, /* mck = 512 fs */ + { 32000, I2S_MCK_12M288, 3, 47}, /* mck = 384 fs */ +-- +2.40.1 + diff --git a/queue-5.4/asoc-codecs-es8316-fix-dmic-config.patch b/queue-5.4/asoc-codecs-es8316-fix-dmic-config.patch new file mode 100644 index 00000000000..2cc5dc9e24a --- /dev/null +++ b/queue-5.4/asoc-codecs-es8316-fix-dmic-config.patch @@ -0,0 +1,36 @@ +From a5ef4eeffd760ddd2e04d71b57612cbd2559fcc0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 19 Jul 2023 13:47:22 +0800 +Subject: ASoc: codecs: ES8316: Fix DMIC config + +From: Edgar + +[ Upstream commit d20d35d1ad62c6cca36368c1e8f29335a068659e ] + +According to the datasheet, the DMIC config should +be changed to { 0, 2 ,3 } + +Signed-off-by: Edgar +Link: https://lore.kernel.org/r/20230719054722.401954-1-ljijcj@163.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/es8316.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c +index 131f41cccbe65..dd2df9a903e05 100644 +--- a/sound/soc/codecs/es8316.c ++++ b/sound/soc/codecs/es8316.c +@@ -153,7 +153,7 @@ static const char * const es8316_dmic_txt[] = { + "dmic data at high level", + "dmic data at low level", + }; +-static const unsigned int es8316_dmic_values[] = { 0, 1, 2 }; ++static const unsigned int es8316_dmic_values[] = { 0, 2, 3 }; + static const struct soc_enum es8316_dmic_src_enum = + SOC_VALUE_ENUM_SINGLE(ES8316_ADC_DMIC, 0, 3, + ARRAY_SIZE(es8316_dmic_txt), +-- +2.40.1 + diff --git a/queue-5.4/asoc-da7219-check-for-failure-reading-aad-irq-events.patch b/queue-5.4/asoc-da7219-check-for-failure-reading-aad-irq-events.patch new file mode 100644 index 00000000000..395c5fccbfe --- /dev/null +++ b/queue-5.4/asoc-da7219-check-for-failure-reading-aad-irq-events.patch @@ -0,0 +1,51 @@ +From c240418a48714be88af4392ada1f2f58fe09b423 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jul 2023 21:37:37 +0200 +Subject: ASoC: da7219: Check for failure reading AAD IRQ events + +From: Dmytro Maluka + +[ Upstream commit f0691dc16206f21b13c464434366e2cd632b8ed7 ] + +When handling an AAD interrupt, if IRQ events read failed (for example, +due to i2c "Transfer while suspended" failure, i.e. when attempting to +read it while DA7219 is suspended, which may happen due to a spurious +AAD interrupt), the events array contains garbage uninitialized values. +So instead of trying to interprete those values and doing any actions +based on them (potentially resulting in misbehavior, e.g. reporting +bogus events), refuse to handle the interrupt. + +Signed-off-by: Dmytro Maluka +Link: https://lore.kernel.org/r/20230717193737.161784-3-dmy@semihalf.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/da7219-aad.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c +index a652f154d8e52..befe26749bc2b 100644 +--- a/sound/soc/codecs/da7219-aad.c ++++ b/sound/soc/codecs/da7219-aad.c +@@ -347,11 +347,15 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) + struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); + u8 events[DA7219_AAD_IRQ_REG_MAX]; + u8 statusa; +- int i, report = 0, mask = 0; ++ int i, ret, report = 0, mask = 0; + + /* Read current IRQ events */ +- regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A, +- events, DA7219_AAD_IRQ_REG_MAX); ++ ret = regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A, ++ events, DA7219_AAD_IRQ_REG_MAX); ++ if (ret) { ++ dev_warn_ratelimited(component->dev, "Failed to read IRQ events: %d\n", ret); ++ return IRQ_NONE; ++ } + + if (!events[DA7219_AAD_IRQ_REG_A] && !events[DA7219_AAD_IRQ_REG_B]) + return IRQ_NONE; +-- +2.40.1 + diff --git a/queue-5.4/asoc-da7219-flush-pending-aad-irq-when-suspending.patch b/queue-5.4/asoc-da7219-flush-pending-aad-irq-when-suspending.patch new file mode 100644 index 00000000000..f473d3be2ff --- /dev/null +++ b/queue-5.4/asoc-da7219-flush-pending-aad-irq-when-suspending.patch @@ -0,0 +1,77 @@ +From 463069fdfdb4277864810fd92dcd7f2ffbf196b5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jul 2023 21:37:36 +0200 +Subject: ASoC: da7219: Flush pending AAD IRQ when suspending + +From: Dmytro Maluka + +[ Upstream commit 91e292917dad64ab8d1d5ca2ab3069ad9dac6f72 ] + +da7219_aad_suspend() disables jack detection, which should prevent +generating new interrupts by DA7219 while suspended. However, there is a +theoretical possibility that there is a pending interrupt generated just +before suspending DA7219 and not handled yet, so the IRQ handler may +still run after DA7219 is suspended. To prevent that, wait until the +pending IRQ handling is done. + +This patch arose as an attempt to fix the following I2C failure +occurring sometimes during system suspend or resume: + +[ 355.876211] i2c_designware i2c_designware.3: Transfer while suspended +[ 355.876245] WARNING: CPU: 2 PID: 3576 at drivers/i2c/busses/i2c-designware-master.c:570 i2c_dw_xfer+0x411/0x440 +... +[ 355.876462] Call Trace: +[ 355.876468] +[ 355.876475] ? update_load_avg+0x1b3/0x615 +[ 355.876484] __i2c_transfer+0x101/0x1d8 +[ 355.876494] i2c_transfer+0x74/0x10d +[ 355.876504] regmap_i2c_read+0x6a/0x9c +[ 355.876513] _regmap_raw_read+0x179/0x223 +[ 355.876521] regmap_raw_read+0x1e1/0x28e +[ 355.876527] regmap_bulk_read+0x17d/0x1ba +[ 355.876532] ? __wake_up+0xed/0x1bb +[ 355.876542] da7219_aad_irq_thread+0x54/0x2c9 [snd_soc_da7219 5fb8ebb2179cf2fea29af090f3145d68ed8e2184] +[ 355.876556] irq_thread+0x13c/0x231 +[ 355.876563] ? irq_forced_thread_fn+0x5f/0x5f +[ 355.876570] ? irq_thread_fn+0x4d/0x4d +[ 355.876576] kthread+0x13a/0x152 +[ 355.876581] ? synchronize_irq+0xc3/0xc3 +[ 355.876587] ? kthread_blkcg+0x31/0x31 +[ 355.876592] ret_from_fork+0x1f/0x30 +[ 355.876601] + +which indicates that the AAD IRQ handler is unexpectedly running when +DA7219 is suspended, and as a result, is trying to read data from DA7219 +over I2C and is hitting the I2C driver "Transfer while suspended" +failure. + +However, with this patch the above failure is still reproducible. So +this patch does not fix any real observed issue so far, but at least is +useful for confirming that the above issue is not caused by a pending +IRQ but rather looks like a DA7219 hardware issue with an IRQ +unexpectedly generated after jack detection is already disabled. + +Signed-off-by: Dmytro Maluka +Link: https://lore.kernel.org/r/20230717193737.161784-2-dmy@semihalf.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/da7219-aad.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sound/soc/codecs/da7219-aad.c b/sound/soc/codecs/da7219-aad.c +index 4f2a96e9fd45b..a652f154d8e52 100644 +--- a/sound/soc/codecs/da7219-aad.c ++++ b/sound/soc/codecs/da7219-aad.c +@@ -855,6 +855,8 @@ void da7219_aad_suspend(struct snd_soc_component *component) + } + } + } ++ ++ synchronize_irq(da7219_aad->irq); + } + + void da7219_aad_resume(struct snd_soc_component *component) +-- +2.40.1 + diff --git a/queue-5.4/bnx2x-fix-page-fault-following-eeh-recovery.patch b/queue-5.4/bnx2x-fix-page-fault-following-eeh-recovery.patch new file mode 100644 index 00000000000..2cfad7080b7 --- /dev/null +++ b/queue-5.4/bnx2x-fix-page-fault-following-eeh-recovery.patch @@ -0,0 +1,55 @@ +From 33253f649580a1e8149cf081b9fb37734dfea774 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Jun 2023 16:01:43 -0400 +Subject: bnx2x: fix page fault following EEH recovery + +From: David Christensen + +[ Upstream commit 7ebe4eda4265642859507d1b3ca330d8c196cfe5 ] + +In the last step of the EEH recovery process, the EEH driver calls into +bnx2x_io_resume() to re-initialize the NIC hardware via the function +bnx2x_nic_load(). If an error occurs during bnx2x_nic_load(), OS and +hardware resources are released and an error code is returned to the +caller. When called from bnx2x_io_resume(), the return code is ignored +and the network interface is brought up unconditionally. Later attempts +to send a packet via this interface result in a page fault due to a null +pointer reference. + +This patch checks the return code of bnx2x_nic_load(), prints an error +message if necessary, and does not enable the interface. + +Signed-off-by: David Christensen +Reviewed-by: Sridhar Samudrala +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +index b5f58c62e7d20..211fbc8f75712 100644 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +@@ -14426,11 +14426,16 @@ static void bnx2x_io_resume(struct pci_dev *pdev) + bp->fw_seq = SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & + DRV_MSG_SEQ_NUMBER_MASK; + +- if (netif_running(dev)) +- bnx2x_nic_load(bp, LOAD_NORMAL); ++ if (netif_running(dev)) { ++ if (bnx2x_nic_load(bp, LOAD_NORMAL)) { ++ netdev_err(bp->dev, "Error during driver initialization, try unloading/reloading the driver\n"); ++ goto done; ++ } ++ } + + netif_device_attach(dev); + ++done: + rtnl_unlock(); + } + +-- +2.40.1 + diff --git a/queue-5.4/cifs-add-a-warning-when-the-in-flight-count-goes-neg.patch b/queue-5.4/cifs-add-a-warning-when-the-in-flight-count-goes-neg.patch new file mode 100644 index 00000000000..1147a7f17cf --- /dev/null +++ b/queue-5.4/cifs-add-a-warning-when-the-in-flight-count-goes-neg.patch @@ -0,0 +1,38 @@ +From 083ec61a335e390460009dc47773816da54b202f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Jun 2023 17:46:56 +0000 +Subject: cifs: add a warning when the in-flight count goes negative + +From: Shyam Prasad N + +[ Upstream commit e4645cc2f1e2d6f268bb8dcfac40997c52432aed ] + +We've seen the in-flight count go into negative with some +internal stress testing in Microsoft. + +Adding a WARN when this happens, in hope of understanding +why this happens when it happens. + +Signed-off-by: Shyam Prasad N +Reviewed-by: Bharath SM +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/cifs/smb2ops.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c +index cd0030533bf7a..ad9b207432e10 100644 +--- a/fs/cifs/smb2ops.c ++++ b/fs/cifs/smb2ops.c +@@ -79,6 +79,7 @@ smb2_add_credits(struct TCP_Server_Info *server, + *val = 65000; /* Don't get near 64K credits, avoid srv bugs */ + printk_once(KERN_WARNING "server overflowed SMB3 credits\n"); + } ++ WARN_ON_ONCE(server->in_flight == 0); + server->in_flight--; + if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP) + rc = change_conf(server); +-- +2.40.1 + diff --git a/queue-5.4/clk-fixed-mmio-make-common_clk_fixed_mmio-depend-on-.patch b/queue-5.4/clk-fixed-mmio-make-common_clk_fixed_mmio-depend-on-.patch new file mode 100644 index 00000000000..96a2bb40672 --- /dev/null +++ b/queue-5.4/clk-fixed-mmio-make-common_clk_fixed_mmio-depend-on-.patch @@ -0,0 +1,52 @@ +From 6d1982b4130ffa9e8f5517b16801701648fc5a3e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Jul 2023 21:58:51 +0800 +Subject: clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM + +From: Baoquan He + +[ Upstream commit e7dd44f4f3166db45248414f5df8f615392de47a ] + +On s390 systems (aka mainframes), it has classic channel devices for +networking and permanent storage that are currently even more common +than PCI devices. Hence it could have a fully functional s390 kernel +with CONFIG_PCI=n, then the relevant iomem mapping functions +[including ioremap(), devm_ioremap(), etc.] are not available. + +Here let COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM so that it won't +be built to cause below compiling error if PCI is unset: + +------ +ld: drivers/clk/clk-fixed-mmio.o: in function `fixed_mmio_clk_setup': +clk-fixed-mmio.c:(.text+0x5e): undefined reference to `of_iomap' +ld: clk-fixed-mmio.c:(.text+0xba): undefined reference to `iounmap' +------ + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202306211329.ticOJCSv-lkp@intel.com/ +Signed-off-by: Baoquan He +Cc: Michael Turquette +Cc: Stephen Boyd +Cc: linux-clk@vger.kernel.org +Link: https://lore.kernel.org/r/20230707135852.24292-8-bhe@redhat.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig +index cc871ae3a1792..5b34dbc830ee4 100644 +--- a/drivers/clk/Kconfig ++++ b/drivers/clk/Kconfig +@@ -302,6 +302,7 @@ config COMMON_CLK_BD718XX + config COMMON_CLK_FIXED_MMIO + bool "Clock driver for Memory Mapped Fixed values" + depends on COMMON_CLK && OF ++ depends on HAS_IOMEM + help + Support for Memory Mapped IO Fixed clocks + +-- +2.40.1 + diff --git a/queue-5.4/ethernet-atheros-fix-return-value-check-in-atl1c_tso.patch b/queue-5.4/ethernet-atheros-fix-return-value-check-in-atl1c_tso.patch new file mode 100644 index 00000000000..7476b4a4cac --- /dev/null +++ b/queue-5.4/ethernet-atheros-fix-return-value-check-in-atl1c_tso.patch @@ -0,0 +1,42 @@ +From 7e5f8c7036f5df1cf8a20486fe73e4a6dd8cf49a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Jul 2023 22:42:08 +0800 +Subject: ethernet: atheros: fix return value check in atl1c_tso_csum() + +From: Yuanjun Gong + +[ Upstream commit 8d01da0a1db237c44c92859ce3612df7af8d3a53 ] + +in atl1c_tso_csum, it should check the return value of pskb_trim(), +and return an error code if an unexpected value is returned +by pskb_trim(). + +Signed-off-by: Yuanjun Gong +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +index 2b239ecea05f2..ff28dbf515747 100644 +--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c ++++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +@@ -1989,8 +1989,11 @@ static int atl1c_tso_csum(struct atl1c_adapter *adapter, + real_len = (((unsigned char *)ip_hdr(skb) - skb->data) + + ntohs(ip_hdr(skb)->tot_len)); + +- if (real_len < skb->len) +- pskb_trim(skb, real_len); ++ if (real_len < skb->len) { ++ err = pskb_trim(skb, real_len); ++ if (err) ++ return err; ++ } + + hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb)); + if (unlikely(skb->len == hdr_len)) { +-- +2.40.1 + diff --git a/queue-5.4/fs-nls-make-load_nls-take-a-const-parameter.patch b/queue-5.4/fs-nls-make-load_nls-take-a-const-parameter.patch new file mode 100644 index 00000000000..37d7ac5f7c1 --- /dev/null +++ b/queue-5.4/fs-nls-make-load_nls-take-a-const-parameter.patch @@ -0,0 +1,66 @@ +From aba7fc852f90b5cab78e2ff654721ada7b626a3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Jul 2023 10:10:56 +0800 +Subject: fs/nls: make load_nls() take a const parameter + +From: Winston Wen + +[ Upstream commit c1ed39ec116272935528ca9b348b8ee79b0791da ] + +load_nls() take a char * parameter, use it to find nls module in list or +construct the module name to load it. + +This change make load_nls() take a const parameter, so we don't need do +some cast like this: + + ses->local_nls = load_nls((char *)ctx->local_nls->charset); + +Suggested-by: Stephen Rothwell +Signed-off-by: Winston Wen +Reviewed-by: Paulo Alcantara +Reviewed-by: Christian Brauner +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/nls/nls_base.c | 4 ++-- + include/linux/nls.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c +index 52ccd34b1e792..a026dbd3593f6 100644 +--- a/fs/nls/nls_base.c ++++ b/fs/nls/nls_base.c +@@ -272,7 +272,7 @@ int unregister_nls(struct nls_table * nls) + return -EINVAL; + } + +-static struct nls_table *find_nls(char *charset) ++static struct nls_table *find_nls(const char *charset) + { + struct nls_table *nls; + spin_lock(&nls_lock); +@@ -288,7 +288,7 @@ static struct nls_table *find_nls(char *charset) + return nls; + } + +-struct nls_table *load_nls(char *charset) ++struct nls_table *load_nls(const char *charset) + { + return try_then_request_module(find_nls(charset), "nls_%s", charset); + } +diff --git a/include/linux/nls.h b/include/linux/nls.h +index 499e486b3722d..e0bf8367b274a 100644 +--- a/include/linux/nls.h ++++ b/include/linux/nls.h +@@ -47,7 +47,7 @@ enum utf16_endian { + /* nls_base.c */ + extern int __register_nls(struct nls_table *, struct module *); + extern int unregister_nls(struct nls_table *); +-extern struct nls_table *load_nls(char *); ++extern struct nls_table *load_nls(const char *charset); + extern void unload_nls(struct nls_table *); + extern struct nls_table *load_nls_default(void); + #define register_nls(nls) __register_nls((nls), THIS_MODULE) +-- +2.40.1 + diff --git a/queue-5.4/idmaengine-make-fsl_edma-and-intel_idma64-depends-on.patch b/queue-5.4/idmaengine-make-fsl_edma-and-intel_idma64-depends-on.patch new file mode 100644 index 00000000000..05508631a6c --- /dev/null +++ b/queue-5.4/idmaengine-make-fsl_edma-and-intel_idma64-depends-on.patch @@ -0,0 +1,58 @@ +From 87c98a11b26cad456bbeab1df6de3c8048a0c30f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Jul 2023 21:58:45 +0800 +Subject: idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM + +From: Baoquan He + +[ Upstream commit b1e213a9e31c20206f111ec664afcf31cbfe0dbb ] + +On s390 systems (aka mainframes), it has classic channel devices for +networking and permanent storage that are currently even more common +than PCI devices. Hence it could have a fully functional s390 kernel +with CONFIG_PCI=n, then the relevant iomem mapping functions +[including ioremap(), devm_ioremap(), etc.] are not available. + +Here let FSL_EDMA and INTEL_IDMA64 depend on HAS_IOMEM so that it +won't be built to cause below compiling error if PCI is unset. + +-------- +ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/fsl-edma.ko] undefined! +ERROR: modpost: "devm_platform_ioremap_resource" [drivers/dma/idma64.ko] undefined! +-------- + +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202306211329.ticOJCSv-lkp@intel.com/ +Signed-off-by: Baoquan He +Cc: Vinod Koul +Cc: dmaengine@vger.kernel.org +Link: https://lore.kernel.org/r/20230707135852.24292-2-bhe@redhat.com +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/Kconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig +index 1322461f1f3c5..66aad9dbd58c5 100644 +--- a/drivers/dma/Kconfig ++++ b/drivers/dma/Kconfig +@@ -208,6 +208,7 @@ config FSL_DMA + config FSL_EDMA + tristate "Freescale eDMA engine support" + depends on OF ++ depends on HAS_IOMEM + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help +@@ -268,6 +269,7 @@ config IMX_SDMA + + config INTEL_IDMA64 + tristate "Intel integrated DMA 64-bit support" ++ depends on HAS_IOMEM + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + help +-- +2.40.1 + diff --git a/queue-5.4/m68k-fix-invalid-.section-syntax.patch b/queue-5.4/m68k-fix-invalid-.section-syntax.patch new file mode 100644 index 00000000000..3602dbe43c7 --- /dev/null +++ b/queue-5.4/m68k-fix-invalid-.section-syntax.patch @@ -0,0 +1,99 @@ +From 5d57e497c741f3a5666a4e534bbcf2c274e75200 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Jun 2023 17:36:10 +0200 +Subject: m68k: Fix invalid .section syntax + +From: Ben Hutchings + +[ Upstream commit 922a9bd138101e3e5718f0f4d40dba68ef89bb43 ] + +gas supports several different forms for .section for ELF targets, +including: + .section NAME [, "FLAGS"[, @TYPE[,FLAG_SPECIFIC_ARGUMENTS]]] +and: + .section "NAME"[, #FLAGS...] + +In several places we use a mix of these two forms: + .section NAME, #FLAGS... + +A current development snapshot of binutils (2.40.50.20230611) treats +this mixed syntax as an error. + +Change to consistently use: + .section NAME, "FLAGS" +as is used elsewhere in the kernel. + +Link: https://buildd.debian.org/status/fetch.php?pkg=linux&arch=m68k&ver=6.4%7Erc6-1%7Eexp1&stamp=1686907300&raw=1 +Signed-off-by: Ben Hutchings +Tested-by: Jan-Benedict Glaw +Link: https://lore.kernel.org/r/ZIyBaueWT9jnTwRC@decadent.org.uk +Signed-off-by: Geert Uytterhoeven +Signed-off-by: Sasha Levin +--- + arch/m68k/fpsp040/skeleton.S | 4 ++-- + arch/m68k/ifpsp060/os.S | 4 ++-- + arch/m68k/kernel/relocate_kernel.S | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/arch/m68k/fpsp040/skeleton.S b/arch/m68k/fpsp040/skeleton.S +index a8f41615d94a7..31a9c634c81ed 100644 +--- a/arch/m68k/fpsp040/skeleton.S ++++ b/arch/m68k/fpsp040/skeleton.S +@@ -499,12 +499,12 @@ in_ea: + dbf %d0,morein + rts + +- .section .fixup,#alloc,#execinstr ++ .section .fixup,"ax" + .even + 1: + jbra fpsp040_die + +- .section __ex_table,#alloc ++ .section __ex_table,"a" + .align 4 + + .long in_ea,1b +diff --git a/arch/m68k/ifpsp060/os.S b/arch/m68k/ifpsp060/os.S +index 7a0d6e4280665..89e2ec224ab6c 100644 +--- a/arch/m68k/ifpsp060/os.S ++++ b/arch/m68k/ifpsp060/os.S +@@ -379,11 +379,11 @@ _060_real_access: + + + | Execption handling for movs access to illegal memory +- .section .fixup,#alloc,#execinstr ++ .section .fixup,"ax" + .even + 1: moveq #-1,%d1 + rts +-.section __ex_table,#alloc ++.section __ex_table,"a" + .align 4 + .long dmrbuae,1b + .long dmrwuae,1b +diff --git a/arch/m68k/kernel/relocate_kernel.S b/arch/m68k/kernel/relocate_kernel.S +index ab0f1e7d46535..f7667079e08e9 100644 +--- a/arch/m68k/kernel/relocate_kernel.S ++++ b/arch/m68k/kernel/relocate_kernel.S +@@ -26,7 +26,7 @@ ENTRY(relocate_new_kernel) + lea %pc@(.Lcopy),%a4 + 2: addl #0x00000000,%a4 /* virt_to_phys() */ + +- .section ".m68k_fixup","aw" ++ .section .m68k_fixup,"aw" + .long M68K_FIXUP_MEMOFFSET, 2b+2 + .previous + +@@ -49,7 +49,7 @@ ENTRY(relocate_new_kernel) + lea %pc@(.Lcont040),%a4 + 5: addl #0x00000000,%a4 /* virt_to_phys() */ + +- .section ".m68k_fixup","aw" ++ .section .m68k_fixup,"aw" + .long M68K_FIXUP_MEMOFFSET, 5b+2 + .previous + +-- +2.40.1 + diff --git a/queue-5.4/net-usb-qmi_wwan-add-quectel-em05gv2.patch b/queue-5.4/net-usb-qmi_wwan-add-quectel-em05gv2.patch new file mode 100644 index 00000000000..e331ad6af93 --- /dev/null +++ b/queue-5.4/net-usb-qmi_wwan-add-quectel-em05gv2.patch @@ -0,0 +1,64 @@ +From fedc338987c1e1da0e0a5551bc71c3352cb779bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jul 2023 20:00:43 +0000 +Subject: net: usb: qmi_wwan: add Quectel EM05GV2 + +From: Martin Kohn + +[ Upstream commit d4480c9bb9258db9ddf2e632f6ef81e96b41089c ] + +Add support for Quectel EM05GV2 (G=global) with vendor ID +0x2c7c and product ID 0x030e + +Enabling DTR on this modem was necessary to ensure stable operation. +Patch for usb: serial: option: is also in progress. + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=2c7c ProdID=030e Rev= 3.18 +S: Manufacturer=Quectel +S: Product=Quectel EM05-G +C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option +E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Signed-off-by: Martin Kohn +Link: https://lore.kernel.org/r/AM0PR04MB57648219DE893EE04FA6CC759701A@AM0PR04MB5764.eurprd04.prod.outlook.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c +index a4be176fdd249..ebc1f01d5ea27 100644 +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1373,6 +1373,7 @@ static const struct usb_device_id products[] = { + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */ + {QMI_QUIRK_SET_DTR(0x2c7c, 0x0195, 4)}, /* Quectel EG95 */ + {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ ++ {QMI_QUIRK_SET_DTR(0x2c7c, 0x030e, 4)}, /* Quectel EM05GV2 */ + {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */ + {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ + {QMI_FIXED_INTF(0x0489, 0xe0b5, 0)}, /* Foxconn T77W968 LTE with eSIM support*/ +-- +2.40.1 + diff --git a/queue-5.4/netlabel-fix-shift-wrapping-bug-in-netlbl_catmap_set.patch b/queue-5.4/netlabel-fix-shift-wrapping-bug-in-netlbl_catmap_set.patch new file mode 100644 index 00000000000..4fbe6b32e02 --- /dev/null +++ b/queue-5.4/netlabel-fix-shift-wrapping-bug-in-netlbl_catmap_set.patch @@ -0,0 +1,38 @@ +From 957b2d12cf9efe398aa282e8d4b0f927a32d65c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Jun 2023 16:57:54 +0300 +Subject: netlabel: fix shift wrapping bug in netlbl_catmap_setlong() + +From: Dmitry Mastykin + +[ Upstream commit b403643d154d15176b060b82f7fc605210033edd ] + +There is a shift wrapping bug in this code on 32-bit architectures. +NETLBL_CATMAP_MAPTYPE is u64, bitmap is unsigned long. +Every second 32-bit word of catmap becomes corrupted. + +Signed-off-by: Dmitry Mastykin +Acked-by: Paul Moore +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/netlabel/netlabel_kapi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c +index 91b35b7c80d82..96059c99b915e 100644 +--- a/net/netlabel/netlabel_kapi.c ++++ b/net/netlabel/netlabel_kapi.c +@@ -857,7 +857,8 @@ int netlbl_catmap_setlong(struct netlbl_lsm_catmap **catmap, + + offset -= iter->startbit; + idx = offset / NETLBL_CATMAP_MAPSIZE; +- iter->bitmap[idx] |= bitmap << (offset % NETLBL_CATMAP_MAPSIZE); ++ iter->bitmap[idx] |= (NETLBL_CATMAP_MAPTYPE)bitmap ++ << (offset % NETLBL_CATMAP_MAPSIZE); + + return 0; + } +-- +2.40.1 + diff --git a/queue-5.4/platform-mellanox-fix-mlxbf-tmfifo-not-handling-all-.patch b/queue-5.4/platform-mellanox-fix-mlxbf-tmfifo-not-handling-all-.patch new file mode 100644 index 00000000000..62f298c0bf1 --- /dev/null +++ b/queue-5.4/platform-mellanox-fix-mlxbf-tmfifo-not-handling-all-.patch @@ -0,0 +1,40 @@ +From 5291419b8a61117fb96469d2003fd18bf6ba1268 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 21 Aug 2023 11:06:27 -0400 +Subject: platform/mellanox: Fix mlxbf-tmfifo not handling all virtio CONSOLE + notifications + +From: Shih-Yi Chen + +[ Upstream commit 0848cab765c634597636810bf76d0934003cce28 ] + +rshim console does not show all entries of dmesg. + +Fixed by setting MLXBF_TM_TX_LWM_IRQ for every CONSOLE notification. + +Signed-off-by: Shih-Yi Chen +Reviewed-by: Liming Sung +Reviewed-by: David Thompson +Link: https://lore.kernel.org/r/20230821150627.26075-1-shihyic@nvidia.com +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/mellanox/mlxbf-tmfifo.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/platform/mellanox/mlxbf-tmfifo.c b/drivers/platform/mellanox/mlxbf-tmfifo.c +index 92bda873d44a4..4b18ebd7e850c 100644 +--- a/drivers/platform/mellanox/mlxbf-tmfifo.c ++++ b/drivers/platform/mellanox/mlxbf-tmfifo.c +@@ -865,6 +865,7 @@ static bool mlxbf_tmfifo_virtio_notify(struct virtqueue *vq) + tm_vdev = fifo->vdev[VIRTIO_ID_CONSOLE]; + mlxbf_tmfifo_console_output(tm_vdev, vring); + spin_unlock_irqrestore(&fifo->spin_lock[0], flags); ++ set_bit(MLXBF_TM_TX_LWM_IRQ, &fifo->pend_events); + } else if (test_and_set_bit(MLXBF_TM_TX_LWM_IRQ, + &fifo->pend_events)) { + return true; +-- +2.40.1 + diff --git a/queue-5.4/platform-x86-huawei-wmi-silence-ambient-light-sensor.patch b/queue-5.4/platform-x86-huawei-wmi-silence-ambient-light-sensor.patch new file mode 100644 index 00000000000..7b2df864b0f --- /dev/null +++ b/queue-5.4/platform-x86-huawei-wmi-silence-ambient-light-sensor.patch @@ -0,0 +1,55 @@ +From 1a8ca731352e1ed3f5d4cf87e6eb048c4acade5d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 22 Jul 2023 18:59:20 +0300 +Subject: platform/x86: huawei-wmi: Silence ambient light sensor + +From: Konstantin Shelekhin + +[ Upstream commit c21733754cd6ecbca346f2adf9b17d4cfa50504f ] + +Currently huawei-wmi causes a lot of spam in dmesg on my +Huawei MateBook X Pro 2022: + + ... + [36409.328463] input input9: Unknown key pressed, code: 0x02c1 + [36411.335104] input input9: Unknown key pressed, code: 0x02c1 + [36412.338674] input input9: Unknown key pressed, code: 0x02c1 + [36414.848564] input input9: Unknown key pressed, code: 0x02c1 + [36416.858706] input input9: Unknown key pressed, code: 0x02c1 + ... + +Fix that by ignoring events generated by ambient light sensor. + +This issue was reported on GitHub and resolved with the following merge +request: + + https://github.com/aymanbagabas/Huawei-WMI/pull/70 + +I've contacted the mainter of this repo and he gave me the "go ahead" to +send this patch to the maling list. + +Signed-off-by: Konstantin Shelekhin +Link: https://lore.kernel.org/r/20230722155922.173856-1-k.shelekhin@ftml.net +Reviewed-by: Hans de Goede +Signed-off-by: Hans de Goede +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/huawei-wmi.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/platform/x86/huawei-wmi.c b/drivers/platform/x86/huawei-wmi.c +index 195a7f3638cb1..e27f551a9afa4 100644 +--- a/drivers/platform/x86/huawei-wmi.c ++++ b/drivers/platform/x86/huawei-wmi.c +@@ -41,6 +41,8 @@ static const struct key_entry huawei_wmi_keymap[] = { + { KE_IGNORE, 0x293, { KEY_KBDILLUMTOGGLE } }, + { KE_IGNORE, 0x294, { KEY_KBDILLUMUP } }, + { KE_IGNORE, 0x295, { KEY_KBDILLUMUP } }, ++ // Ignore Ambient Light Sensoring ++ { KE_KEY, 0x2c1, { KEY_RESERVED } }, + { KE_END, 0 } + }; + +-- +2.40.1 + diff --git a/queue-5.4/platform-x86-intel-hid-always-call-btnl-acpi-method.patch b/queue-5.4/platform-x86-intel-hid-always-call-btnl-acpi-method.patch new file mode 100644 index 00000000000..faf04851105 --- /dev/null +++ b/queue-5.4/platform-x86-intel-hid-always-call-btnl-acpi-method.patch @@ -0,0 +1,73 @@ +From 66b28b9811a80480f6e5027c40b9369332af9bd8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 15 Jul 2023 20:15:16 +0200 +Subject: platform/x86: intel: hid: Always call BTNL ACPI method + +From: Hans de Goede + +[ Upstream commit e3ab18de2b09361d6f0e4aafb9cfd6d002ce43a1 ] + +On a HP Elite Dragonfly G2 the 0xcc and 0xcd events for SW_TABLET_MODE +are only send after the BTNL ACPI method has been called. + +Likely more devices need this, so make the BTNL ACPI method unconditional +instead of only doing it on devices with a 5 button array. + +Note this also makes the intel_button_array_enable() call in probe() +unconditional, that function does its own priv->array check. This makes +the intel_button_array_enable() call in probe() consistent with the calls +done on suspend/resume which also rely on the priv->array check inside +the function. + +Reported-by: Maxim Mikityanskiy +Closes: https://lore.kernel.org/platform-driver-x86/20230712175023.31651-1-maxtram95@gmail.com/ +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20230715181516.5173-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/intel-hid.c | 21 +++++++++------------ + 1 file changed, 9 insertions(+), 12 deletions(-) + +diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c +index 164bebbfea214..050f8f7970374 100644 +--- a/drivers/platform/x86/intel-hid.c ++++ b/drivers/platform/x86/intel-hid.c +@@ -449,7 +449,7 @@ static bool button_array_present(struct platform_device *device) + static int intel_hid_probe(struct platform_device *device) + { + acpi_handle handle = ACPI_HANDLE(&device->dev); +- unsigned long long mode; ++ unsigned long long mode, dummy; + struct intel_hid_priv *priv; + acpi_status status; + int err; +@@ -501,18 +501,15 @@ static int intel_hid_probe(struct platform_device *device) + if (err) + goto err_remove_notify; + +- if (priv->array) { +- unsigned long long dummy; ++ intel_button_array_enable(&device->dev, true); + +- intel_button_array_enable(&device->dev, true); +- +- /* Call button load method to enable HID power button */ +- if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN, +- &dummy)) { +- dev_warn(&device->dev, +- "failed to enable HID power button\n"); +- } +- } ++ /* ++ * Call button load method to enable HID power button ++ * Always do this since it activates events on some devices without ++ * a button array too. ++ */ ++ if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN, &dummy)) ++ dev_warn(&device->dev, "failed to enable HID power button\n"); + + device_init_wakeup(&device->dev, true); + /* +-- +2.40.1 + diff --git a/queue-5.4/s390-dasd-fix-hanging-device-after-request-requeue.patch b/queue-5.4/s390-dasd-fix-hanging-device-after-request-requeue.patch new file mode 100644 index 00000000000..fc1e3340b75 --- /dev/null +++ b/queue-5.4/s390-dasd-fix-hanging-device-after-request-requeue.patch @@ -0,0 +1,222 @@ +From aa9db31507e9da41e71388978a57c4e26695a89c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 21:36:46 +0200 +Subject: s390/dasd: fix hanging device after request requeue + +From: Stefan Haberland + +[ Upstream commit 8a2278ce9c25048d999fe1a3561def75d963f471 ] + +The DASD device driver has a function to requeue requests to the +blocklayer. +This function is used in various cases when basic settings for the device +have to be changed like High Performance Ficon related parameters or copy +pair settings. + +The functions iterates over the device->ccw_queue and also removes the +requests from the block->ccw_queue. +In case the device is started on an alias device instead of the base +device it might be removed from the block->ccw_queue without having it +canceled properly before. This might lead to a hanging device since the +request is no longer on a queue and can not be handled properly. + +Fix by iterating over the block->ccw_queue instead of the +device->ccw_queue. This will take care of all blocklayer related requests +and handle them on all associated DASD devices. + +Signed-off-by: Stefan Haberland +Reviewed-by: Jan Hoeppner +Link: https://lore.kernel.org/r/20230721193647.3889634-4-sth@linux.ibm.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/s390/block/dasd.c | 125 +++++++++++++++----------------------- + 1 file changed, 48 insertions(+), 77 deletions(-) + +diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c +index 187565830b5b4..58027cdc58e3e 100644 +--- a/drivers/s390/block/dasd.c ++++ b/drivers/s390/block/dasd.c +@@ -2985,41 +2985,32 @@ static void _dasd_wake_block_flush_cb(struct dasd_ccw_req *cqr, void *data) + * Requeue a request back to the block request queue + * only works for block requests + */ +-static int _dasd_requeue_request(struct dasd_ccw_req *cqr) ++static void _dasd_requeue_request(struct dasd_ccw_req *cqr) + { +- struct dasd_block *block = cqr->block; + struct request *req; + +- if (!block) +- return -EINVAL; + /* + * If the request is an ERP request there is nothing to requeue. + * This will be done with the remaining original request. + */ + if (cqr->refers) +- return 0; ++ return; + spin_lock_irq(&cqr->dq->lock); + req = (struct request *) cqr->callback_data; + blk_mq_requeue_request(req, true); + spin_unlock_irq(&cqr->dq->lock); + +- return 0; ++ return; + } + +-/* +- * Go through all request on the dasd_block request queue, cancel them +- * on the respective dasd_device, and return them to the generic +- * block layer. +- */ +-static int dasd_flush_block_queue(struct dasd_block *block) ++static int _dasd_requests_to_flushqueue(struct dasd_block *block, ++ struct list_head *flush_queue) + { + struct dasd_ccw_req *cqr, *n; +- int rc, i; +- struct list_head flush_queue; + unsigned long flags; ++ int rc, i; + +- INIT_LIST_HEAD(&flush_queue); +- spin_lock_bh(&block->queue_lock); ++ spin_lock_irqsave(&block->queue_lock, flags); + rc = 0; + restart: + list_for_each_entry_safe(cqr, n, &block->ccw_queue, blocklist) { +@@ -3034,13 +3025,32 @@ static int dasd_flush_block_queue(struct dasd_block *block) + * is returned from the dasd_device layer. + */ + cqr->callback = _dasd_wake_block_flush_cb; +- for (i = 0; cqr != NULL; cqr = cqr->refers, i++) +- list_move_tail(&cqr->blocklist, &flush_queue); ++ for (i = 0; cqr; cqr = cqr->refers, i++) ++ list_move_tail(&cqr->blocklist, flush_queue); + if (i > 1) + /* moved more than one request - need to restart */ + goto restart; + } +- spin_unlock_bh(&block->queue_lock); ++ spin_unlock_irqrestore(&block->queue_lock, flags); ++ ++ return rc; ++} ++ ++/* ++ * Go through all request on the dasd_block request queue, cancel them ++ * on the respective dasd_device, and return them to the generic ++ * block layer. ++ */ ++static int dasd_flush_block_queue(struct dasd_block *block) ++{ ++ struct dasd_ccw_req *cqr, *n; ++ struct list_head flush_queue; ++ unsigned long flags; ++ int rc; ++ ++ INIT_LIST_HEAD(&flush_queue); ++ rc = _dasd_requests_to_flushqueue(block, &flush_queue); ++ + /* Now call the callback function of flushed requests */ + restart_cb: + list_for_each_entry_safe(cqr, n, &flush_queue, blocklist) { +@@ -3977,75 +3987,36 @@ EXPORT_SYMBOL_GPL(dasd_generic_space_avail); + */ + static int dasd_generic_requeue_all_requests(struct dasd_device *device) + { ++ struct dasd_block *block = device->block; + struct list_head requeue_queue; + struct dasd_ccw_req *cqr, *n; +- struct dasd_ccw_req *refers; + int rc; + +- INIT_LIST_HEAD(&requeue_queue); +- spin_lock_irq(get_ccwdev_lock(device->cdev)); +- rc = 0; +- list_for_each_entry_safe(cqr, n, &device->ccw_queue, devlist) { +- /* Check status and move request to flush_queue */ +- if (cqr->status == DASD_CQR_IN_IO) { +- rc = device->discipline->term_IO(cqr); +- if (rc) { +- /* unable to terminate requeust */ +- dev_err(&device->cdev->dev, +- "Unable to terminate request %p " +- "on suspend\n", cqr); +- spin_unlock_irq(get_ccwdev_lock(device->cdev)); +- dasd_put_device(device); +- return rc; +- } +- } +- list_move_tail(&cqr->devlist, &requeue_queue); +- } +- spin_unlock_irq(get_ccwdev_lock(device->cdev)); +- +- list_for_each_entry_safe(cqr, n, &requeue_queue, devlist) { +- wait_event(dasd_flush_wq, +- (cqr->status != DASD_CQR_CLEAR_PENDING)); ++ if (!block) ++ return 0; + +- /* +- * requeue requests to blocklayer will only work +- * for block device requests +- */ +- if (_dasd_requeue_request(cqr)) +- continue; ++ INIT_LIST_HEAD(&requeue_queue); ++ rc = _dasd_requests_to_flushqueue(block, &requeue_queue); + +- /* remove requests from device and block queue */ +- list_del_init(&cqr->devlist); +- while (cqr->refers != NULL) { +- refers = cqr->refers; +- /* remove the request from the block queue */ +- list_del(&cqr->blocklist); +- /* free the finished erp request */ +- dasd_free_erp_request(cqr, cqr->memdev); +- cqr = refers; ++ /* Now call the callback function of flushed requests */ ++restart_cb: ++ list_for_each_entry_safe(cqr, n, &requeue_queue, blocklist) { ++ wait_event(dasd_flush_wq, (cqr->status < DASD_CQR_QUEUED)); ++ /* Process finished ERP request. */ ++ if (cqr->refers) { ++ spin_lock_bh(&block->queue_lock); ++ __dasd_process_erp(block->base, cqr); ++ spin_unlock_bh(&block->queue_lock); ++ /* restart list_for_xx loop since dasd_process_erp ++ * might remove multiple elements ++ */ ++ goto restart_cb; + } +- +- /* +- * _dasd_requeue_request already checked for a valid +- * blockdevice, no need to check again +- * all erp requests (cqr->refers) have a cqr->block +- * pointer copy from the original cqr +- */ ++ _dasd_requeue_request(cqr); + list_del_init(&cqr->blocklist); + cqr->block->base->discipline->free_cp( + cqr, (struct request *) cqr->callback_data); + } +- +- /* +- * if requests remain then they are internal request +- * and go back to the device queue +- */ +- if (!list_empty(&requeue_queue)) { +- /* move freeze_queue to start of the ccw_queue */ +- spin_lock_irq(get_ccwdev_lock(device->cdev)); +- list_splice_tail(&requeue_queue, &device->ccw_queue); +- spin_unlock_irq(get_ccwdev_lock(device->cdev)); +- } + dasd_schedule_device_bh(device); + return rc; + } +-- +2.40.1 + diff --git a/queue-5.4/s390-dasd-use-correct-number-of-retries-for-erp-requ.patch b/queue-5.4/s390-dasd-use-correct-number-of-retries-for-erp-requ.patch new file mode 100644 index 00000000000..e50160903f3 --- /dev/null +++ b/queue-5.4/s390-dasd-use-correct-number-of-retries-for-erp-requ.patch @@ -0,0 +1,45 @@ +From c3f8d638bb3c3d8b318fcf762befc2122daea1b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 21:36:45 +0200 +Subject: s390/dasd: use correct number of retries for ERP requests + +From: Stefan Haberland + +[ Upstream commit acea28a6b74f458defda7417d2217b051ba7d444 ] + +If a DASD request fails an error recovery procedure (ERP) request might +be built as a copy of the original request to do error recovery. + +The ERP request gets a number of retries assigned. +This number is always 256 no matter what other value might have been set +for the original request. This is not what is expected when a user +specifies a certain amount of retries for the device via sysfs. + +Correctly use the number of retries of the original request for ERP +requests. + +Signed-off-by: Stefan Haberland +Reviewed-by: Jan Hoeppner +Link: https://lore.kernel.org/r/20230721193647.3889634-3-sth@linux.ibm.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/s390/block/dasd_3990_erp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c +index ee73b0607e47c..8598c792ded30 100644 +--- a/drivers/s390/block/dasd_3990_erp.c ++++ b/drivers/s390/block/dasd_3990_erp.c +@@ -2436,7 +2436,7 @@ static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr) + erp->block = cqr->block; + erp->magic = cqr->magic; + erp->expires = cqr->expires; +- erp->retries = 256; ++ erp->retries = device->default_retries; + erp->buildclk = get_tod_clock(); + erp->status = DASD_CQR_FILLED; + +-- +2.40.1 + diff --git a/queue-5.4/scsi-qedi-fix-potential-deadlock-on-qedi_percpu-p_wo.patch b/queue-5.4/scsi-qedi-fix-potential-deadlock-on-qedi_percpu-p_wo.patch new file mode 100644 index 00000000000..0ec760d108e --- /dev/null +++ b/queue-5.4/scsi-qedi-fix-potential-deadlock-on-qedi_percpu-p_wo.patch @@ -0,0 +1,67 @@ +From 69fdf3c7dc98370042bc287838b2528fce059c9d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Jul 2023 12:56:55 +0000 +Subject: scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock + +From: Chengfeng Ye + +[ Upstream commit dd64f80587190265ca8a0f4be6c64c2fda6d3ac2 ] + +As &qedi_percpu->p_work_lock is acquired by hard IRQ qedi_msix_handler(), +other acquisitions of the same lock under process context should disable +IRQ, otherwise deadlock could happen if the IRQ preempts the execution +while the lock is held in process context on the same CPU. + +qedi_cpu_offline() is one such function which acquires the lock in process +context. + +[Deadlock Scenario] +qedi_cpu_offline() + ->spin_lock(&p->p_work_lock) + + ->qedi_msix_handler() + ->edi_process_completions() + ->spin_lock_irqsave(&p->p_work_lock, flags); (deadlock here) + +This flaw was found by an experimental static analysis tool I am developing +for IRQ-related deadlocks. + +The tentative patch fix the potential deadlock by spin_lock_irqsave() +under process context. + +Signed-off-by: Chengfeng Ye +Link: https://lore.kernel.org/r/20230726125655.4197-1-dg573847474@gmail.com +Acked-by: Manish Rangankar +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi_main.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c +index 92c4a367b7bd7..6b47921202eba 100644 +--- a/drivers/scsi/qedi/qedi_main.c ++++ b/drivers/scsi/qedi/qedi_main.c +@@ -1910,8 +1910,9 @@ static int qedi_cpu_offline(unsigned int cpu) + struct qedi_percpu_s *p = this_cpu_ptr(&qedi_percpu); + struct qedi_work *work, *tmp; + struct task_struct *thread; ++ unsigned long flags; + +- spin_lock_bh(&p->p_work_lock); ++ spin_lock_irqsave(&p->p_work_lock, flags); + thread = p->iothread; + p->iothread = NULL; + +@@ -1922,7 +1923,7 @@ static int qedi_cpu_offline(unsigned int cpu) + kfree(work); + } + +- spin_unlock_bh(&p->p_work_lock); ++ spin_unlock_irqrestore(&p->p_work_lock, flags); + if (thread) + kthread_stop(thread); + return 0; +-- +2.40.1 + diff --git a/queue-5.4/scsi-storvsc-always-set-no_report_opcodes.patch b/queue-5.4/scsi-storvsc-always-set-no_report_opcodes.patch new file mode 100644 index 00000000000..54481bc5e61 --- /dev/null +++ b/queue-5.4/scsi-storvsc-always-set-no_report_opcodes.patch @@ -0,0 +1,48 @@ +From 374eda1038f17d87a8bfc0f9f62126d4b947c999 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Jun 2023 13:38:21 -0700 +Subject: scsi: storvsc: Always set no_report_opcodes + +From: Michael Kelley + +[ Upstream commit 31d16e712bdcaee769de4780f72ff8d6cd3f0589 ] + +Hyper-V synthetic SCSI devices do not support the MAINTENANCE_IN SCSI +command, so scsi_report_opcode() always fails, resulting in messages like +this: + +hv_storvsc : tag#205 cmd 0xa3 status: scsi 0x2 srb 0x86 hv 0xc0000001 + +The recently added support for command duration limits calls +scsi_report_opcode() four times as each device comes online, which +significantly increases the number of messages logged in a system with many +disks. + +Fix the problem by always marking Hyper-V synthetic SCSI devices as not +supporting scsi_report_opcode(). With this setting, the MAINTENANCE_IN SCSI +command is not issued and no messages are logged. + +Signed-off-by: Michael Kelley +Link: https://lore.kernel.org/r/1686343101-18930-1-git-send-email-mikelley@microsoft.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/storvsc_drv.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c +index 823088c7b199e..44f4e10f9bf9a 100644 +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1423,6 +1423,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice) + { + blk_queue_rq_timeout(sdevice->request_queue, (storvsc_timeout * HZ)); + ++ /* storvsc devices don't support MAINTENANCE_IN SCSI cmd */ ++ sdevice->no_report_opcodes = 1; + sdevice->no_write_same = 1; + + /* +-- +2.40.1 + diff --git a/queue-5.4/sctp-handle-invalid-error-codes-without-calling-bug.patch b/queue-5.4/sctp-handle-invalid-error-codes-without-calling-bug.patch new file mode 100644 index 00000000000..74dfcaa858f --- /dev/null +++ b/queue-5.4/sctp-handle-invalid-error-codes-without-calling-bug.patch @@ -0,0 +1,45 @@ +From 0e41a7f141ac3e10b770e35d2fb250d84e59f19d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 9 Jun 2023 14:04:43 +0300 +Subject: sctp: handle invalid error codes without calling BUG() + +From: Dan Carpenter + +[ Upstream commit a0067dfcd9418fd3b0632bc59210d120d038a9c6 ] + +The sctp_sf_eat_auth() function is supposed to return enum sctp_disposition +values but if the call to sctp_ulpevent_make_authkey() fails, it returns +-ENOMEM. + +This results in calling BUG() inside the sctp_side_effects() function. +Calling BUG() is an over reaction and not helpful. Call WARN_ON_ONCE() +instead. + +This code predates git. + +Signed-off-by: Dan Carpenter +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/sctp/sm_sideeffect.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c +index 8d32229199b96..c964e7ca6f7e5 100644 +--- a/net/sctp/sm_sideeffect.c ++++ b/net/sctp/sm_sideeffect.c +@@ -1240,7 +1240,10 @@ static int sctp_side_effects(enum sctp_event_type event_type, + default: + pr_err("impossible disposition %d in state %d, event_type %d, event_id %d\n", + status, state, event_type, subtype.chunk); +- BUG(); ++ error = status; ++ if (error >= 0) ++ error = -EINVAL; ++ WARN_ON_ONCE(1); + break; + } + +-- +2.40.1 + diff --git a/queue-5.4/security-keys-perform-capable-check-only-on-privileg.patch b/queue-5.4/security-keys-perform-capable-check-only-on-privileg.patch new file mode 100644 index 00000000000..50e1e8f98df --- /dev/null +++ b/queue-5.4/security-keys-perform-capable-check-only-on-privileg.patch @@ -0,0 +1,66 @@ +From 29086042d620406f63e1ad37e025c427165184a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 May 2023 14:32:52 +0200 +Subject: security: keys: perform capable check only on privileged operations +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christian Göttsche + +[ Upstream commit 2d7f105edbb3b2be5ffa4d833abbf9b6965e9ce7 ] + +If the current task fails the check for the queried capability via +`capable(CAP_SYS_ADMIN)` LSMs like SELinux generate a denial message. +Issuing such denial messages unnecessarily can lead to a policy author +granting more privileges to a subject than needed to silence them. + +Reorder CAP_SYS_ADMIN checks after the check whether the operation is +actually privileged. + +Signed-off-by: Christian Göttsche +Reviewed-by: Jarkko Sakkinen +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Sasha Levin +--- + security/keys/keyctl.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c +index edde63a63007f..f42968f349584 100644 +--- a/security/keys/keyctl.c ++++ b/security/keys/keyctl.c +@@ -977,14 +977,19 @@ long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group) + ret = -EACCES; + down_write(&key->sem); + +- if (!capable(CAP_SYS_ADMIN)) { ++ { ++ bool is_privileged_op = false; ++ + /* only the sysadmin can chown a key to some other UID */ + if (user != (uid_t) -1 && !uid_eq(key->uid, uid)) +- goto error_put; ++ is_privileged_op = true; + + /* only the sysadmin can set the key's GID to a group other + * than one of those that the current process subscribes to */ + if (group != (gid_t) -1 && !gid_eq(gid, key->gid) && !in_group_p(gid)) ++ is_privileged_op = true; ++ ++ if (is_privileged_op && !capable(CAP_SYS_ADMIN)) + goto error_put; + } + +@@ -1084,7 +1089,7 @@ long keyctl_setperm_key(key_serial_t id, key_perm_t perm) + down_write(&key->sem); + + /* if we're not the sysadmin, we can only change a key that we own */ +- if (capable(CAP_SYS_ADMIN) || uid_eq(key->uid, current_fsuid())) { ++ if (uid_eq(key->uid, current_fsuid()) || capable(CAP_SYS_ADMIN)) { + key->perm = perm; + ret = 0; + } +-- +2.40.1 + diff --git a/queue-5.4/series b/queue-5.4/series index 1351238f86b..4600143109d 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -15,3 +15,28 @@ fsi-master-ast-cf-add-module_firmware-macro.patch nilfs2-fix-general-protection-fault-in-nilfs_lookup_dirty_data_buffers.patch nilfs2-fix-warning-in-mark_buffer_dirty-due-to-discarded-buffer-reuse.patch pinctrl-amd-don-t-show-invalid-config-param-errors.patch +9p-virtio-make-sure-offs-is-initialized-in-zc_reques.patch +asoc-da7219-flush-pending-aad-irq-when-suspending.patch +asoc-da7219-check-for-failure-reading-aad-irq-events.patch +ethernet-atheros-fix-return-value-check-in-atl1c_tso.patch +vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch +m68k-fix-invalid-.section-syntax.patch +s390-dasd-use-correct-number-of-retries-for-erp-requ.patch +s390-dasd-fix-hanging-device-after-request-requeue.patch +fs-nls-make-load_nls-take-a-const-parameter.patch +asoc-codecs-es8316-fix-dmic-config.patch +asoc-atmel-fix-the-8k-sample-parameter-in-i2sc-maste.patch +platform-x86-intel-hid-always-call-btnl-acpi-method.patch +platform-x86-huawei-wmi-silence-ambient-light-sensor.patch +security-keys-perform-capable-check-only-on-privileg.patch +clk-fixed-mmio-make-common_clk_fixed_mmio-depend-on-.patch +net-usb-qmi_wwan-add-quectel-em05gv2.patch +idmaengine-make-fsl_edma-and-intel_idma64-depends-on.patch +scsi-qedi-fix-potential-deadlock-on-qedi_percpu-p_wo.patch +netlabel-fix-shift-wrapping-bug-in-netlbl_catmap_set.patch +bnx2x-fix-page-fault-following-eeh-recovery.patch +sctp-handle-invalid-error-codes-without-calling-bug.patch +cifs-add-a-warning-when-the-in-flight-count-goes-neg.patch +scsi-storvsc-always-set-no_report_opcodes.patch +alsa-seq-oss-fix-racy-open-close-of-midi-devices.patch +platform-mellanox-fix-mlxbf-tmfifo-not-handling-all-.patch diff --git a/queue-5.4/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch b/queue-5.4/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch new file mode 100644 index 00000000000..4953fdc17b4 --- /dev/null +++ b/queue-5.4/vxlan-generalize-vxlan_parse_gpe_hdr-and-remove-unus.patch @@ -0,0 +1,114 @@ +From c6f8d80b9aa9a084a3980f5abedd8cd417ee3189 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 16:30:46 +0200 +Subject: vxlan: generalize vxlan_parse_gpe_hdr and remove unused args + +From: Jiri Benc + +[ Upstream commit 17a0a64448b568442a101de09575f81ffdc45d15 ] + +The vxlan_parse_gpe_hdr function extracts the next protocol value from +the GPE header and marks GPE bits as parsed. + +In order to be used in the next patch, split the function into protocol +extraction and bit marking. The bit marking is meaningful only in +vxlan_rcv; move it directly there. + +Rename the function to vxlan_parse_gpe_proto to reflect what it now +does. Remove unused arguments skb and vxflags. Move the function earlier +in the file to allow it to be called from more places in the next patch. + +Signed-off-by: Jiri Benc +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/vxlan.c | 58 ++++++++++++++++++++++----------------------- + 1 file changed, 28 insertions(+), 30 deletions(-) + +diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c +index 1e3e075454f33..8808a6540b190 100644 +--- a/drivers/net/vxlan.c ++++ b/drivers/net/vxlan.c +@@ -698,6 +698,32 @@ static int vxlan_fdb_append(struct vxlan_fdb *f, + return 1; + } + ++static bool vxlan_parse_gpe_proto(struct vxlanhdr *hdr, __be16 *protocol) ++{ ++ struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)hdr; ++ ++ /* Need to have Next Protocol set for interfaces in GPE mode. */ ++ if (!gpe->np_applied) ++ return false; ++ /* "The initial version is 0. If a receiver does not support the ++ * version indicated it MUST drop the packet. ++ */ ++ if (gpe->version != 0) ++ return false; ++ /* "When the O bit is set to 1, the packet is an OAM packet and OAM ++ * processing MUST occur." However, we don't implement OAM ++ * processing, thus drop the packet. ++ */ ++ if (gpe->oam_flag) ++ return false; ++ ++ *protocol = tun_p_to_eth_p(gpe->next_protocol); ++ if (!*protocol) ++ return false; ++ ++ return true; ++} ++ + static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb, + unsigned int off, + struct vxlanhdr *vh, size_t hdrlen, +@@ -1564,35 +1590,6 @@ static void vxlan_parse_gbp_hdr(struct vxlanhdr *unparsed, + unparsed->vx_flags &= ~VXLAN_GBP_USED_BITS; + } + +-static bool vxlan_parse_gpe_hdr(struct vxlanhdr *unparsed, +- __be16 *protocol, +- struct sk_buff *skb, u32 vxflags) +-{ +- struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)unparsed; +- +- /* Need to have Next Protocol set for interfaces in GPE mode. */ +- if (!gpe->np_applied) +- return false; +- /* "The initial version is 0. If a receiver does not support the +- * version indicated it MUST drop the packet. +- */ +- if (gpe->version != 0) +- return false; +- /* "When the O bit is set to 1, the packet is an OAM packet and OAM +- * processing MUST occur." However, we don't implement OAM +- * processing, thus drop the packet. +- */ +- if (gpe->oam_flag) +- return false; +- +- *protocol = tun_p_to_eth_p(gpe->next_protocol); +- if (!*protocol) +- return false; +- +- unparsed->vx_flags &= ~VXLAN_GPE_USED_BITS; +- return true; +-} +- + static bool vxlan_set_mac(struct vxlan_dev *vxlan, + struct vxlan_sock *vs, + struct sk_buff *skb, __be32 vni) +@@ -1694,8 +1691,9 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) + * used by VXLAN extensions if explicitly requested. + */ + if (vs->flags & VXLAN_F_GPE) { +- if (!vxlan_parse_gpe_hdr(&unparsed, &protocol, skb, vs->flags)) ++ if (!vxlan_parse_gpe_proto(&unparsed, &protocol)) + goto drop; ++ unparsed.vx_flags &= ~VXLAN_GPE_USED_BITS; + raw_proto = true; + } + +-- +2.40.1 +