5.5.3-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 157/367 riscv, bpf: Fix broken BPF tail calls
In reply to Greg Kroah-HartmanFrom: Björn Töpel <[email protected]>
commit f1003b787c00fbaa4b11619c6b23a885bfce8f07 upstream.
The BPF JIT incorrectly clobbered the a0 register, and did not flag usage of s5 register when BPF stack was being used.
--- arch/riscv/net/bpf_jit_comp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/riscv/net/bpf_jit_comp.c +11 -2
@@ -120,6 +120,11 @@ static bool seen_reg(int reg, struct rv_return false; } +static void mark_fp (struct rv_jit_context *ctx) +{ +__set_bit (RV_CTX_F_SEEN_S5 , &ctx->flags); +} +static void mark_call (struct rv_jit_context *ctx) {__set_bit (RV_CTX_F_SEEN_CALL , &ctx->flags);
@@ -596,7 +601,8 @@ static void __build_epilogue(u8 reg, stremit (rv_addi (RV_REG_SP ,RV_REG_SP , stack_adjust), ctx);/* Set return value. */ -emit (rv_addi (RV_REG_A0 ,RV_REG_A5 ,0 ), ctx); +if (reg ==RV_REG_RA ) +emit (rv_addi (RV_REG_A0 ,RV_REG_A5 ,0 ), ctx);emit (rv_jalr (RV_REG_ZERO , reg,0 ), ctx); }
@@ -1426,6 +1432,10 @@ static void build_prologue(struct rv_jit {int stack_adjust =0 , store_offset, bpf_stack_adjust; + bpf_stack_adjust =round_up (ctx->prog->aux->stack_depth,16 ); +if (bpf_stack_adjust) +mark_fp (ctx); +if (seen_reg (RV_REG_RA , ctx)) stack_adjust +=8 ; stack_adjust +=8 ;/* RV_REG_FP */
@@ -1443,7 +1453,6 @@ static void build_prologue(struct rv_jit stack_adjust +=8 ; stack_adjust =round_up (stack_adjust,16 ); - bpf_stack_adjust =round_up (ctx->prog->aux->stack_depth,16 ); stack_adjust += bpf_stack_adjust; store_offset = stack_adjust -8 ;
Greg Kroah-Hartman
maintainerPATCH 155/367 btrfs: fix improper setting of scanned for range cyclic write cache pages
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 556755a8a99be8ca3cd9fbe36aaf9b3b0339a00d upstream.
We noticed that we were having regular CG OOM kills in cases where there was still enough dirty pages to avoid OOM'ing. It turned out there's this corner case in btrfs's handling of range_cyclic where files that were being redirtied were not getting fully written out because of how we do range_cyclic writeback.
We unconditionally were setting scanned = 1; the first time we found any pages in the inode. This isn't actually what we want, we want it to be set if we've scanned the entire file. For range_cyclic we could be starting in the middle or towards the end of the file, so we could write one page and then not write any of the other dirty pages in the file because we set scanned = 1.
Fix this by not setting scanned = 1 if we find pages. The rules for setting scanned should be
1) !range_cyclic. In this case we have a specified range to write out.
2) range_cyclic && index == 0. In this case we've started at the beginning and there is no need to loop around a second time.
3) range_cyclic && we started at index > 0 and we've reached the end of the file without satisfying our nr_to_write.
This patch fixes both of our writepages implementations to make sure these rules hold true. This fixed our over zealous CG OOMs in production.
--- fs/btrfs/extent_io.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/btrfs/extent_io.c +10 -2
@@ -3941,6 +3941,11 @@ int btree_write_cache_pages(struct addreif (wbc->range_cyclic) { index = mapping->writeback_index;/* Start from prev offset */ end =-1 ; +/* +* Start from the beginning does not need to cycle over the +* range, mark it as scanned. +*/ + scanned = (index ==0 ); }else { index = wbc->range_start >>PAGE_SHIFT ; end = wbc->range_end >>PAGE_SHIFT ;
@@ -3958,7 +3963,6 @@ retry: tag))) {unsigned i; - scanned =1 ;for (i =0 ; i < nr_pages; i++) {struct page *page = pvec.pages[i];
@@ -4087,6 +4091,11 @@ static int extent_write_cache_pages(struif (wbc->range_cyclic) { index = mapping->writeback_index;/* Start from prev offset */ end =-1 ; +/* +* Start from the beginning does not need to cycle over the +* range, mark it as scanned. +*/ + scanned = (index ==0 ); }else { index = wbc->range_start >>PAGE_SHIFT ; end = wbc->range_end >>PAGE_SHIFT ;
@@ -4120,7 +4129,6 @@ retry: &index, end, tag))) {unsigned i; - scanned =1 ;for (i =0 ; i < nr_pages; i++) {struct page *page = pvec.pages[i];
Greg Kroah-Hartman
maintainerPATCH 118/367 crypto: ccree - fix FDE descriptor sequence
In reply to Greg Kroah-HartmanFrom: Ofir Drang <[email protected]>
commit 5c83e8ec4d51ac4cc58482ed04297e6882b32a09 upstream.
In FDE mode (xts, essiv and bitlocker) the cryptocell hardware requires that the the XEX key will be loaded after Key1.
--- drivers/crypto/ccree/cc_cipher.c | 48 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-)
drivers/crypto/ccree/cc_cipher.c +45 -3
@@ -523,6 +523,7 @@ static void cc_setup_readiv_desc(struct } } + static void cc_setup_state_desc(struct crypto_tfm *tfm, struct cipher_req_ctx *req_ctx, unsigned int ivsize, unsigned int nbytes,
@@ -534,8 +535,6 @@ static void cc_setup_state_desc(struct cint cipher_mode = ctx_p->cipher_mode;int flow_mode = ctx_p->flow_mode;int direction = req_ctx->gen_ctx.op_type; -dma_addr_t key_dma_addr = ctx_p->user.key_dma_addr; -unsigned int key_len = ctx_p->keylen;dma_addr_t iv_dma_addr = req_ctx->gen_ctx.iv_dma_addr;unsigned int du_size = nbytes;
@@ -571,6 +570,47 @@ static void cc_setup_state_desc(struct ccase DRV_CIPHER_XTS :case DRV_CIPHER_ESSIV :case DRV_CIPHER_BITLOCKER : +break ; +default : +dev_err (dev,"Unsupported cipher mode (%d)\n" , cipher_mode); + } +} + + +static void cc_setup_xex_state_desc (struct crypto_tfm *tfm, +struct cipher_req_ctx *req_ctx, +unsigned int ivsize,unsigned int nbytes, +struct cc_hw_desc desc[], +unsigned int *seq_size) +{ +struct cc_cipher_ctx *ctx_p =crypto_tfm_ctx (tfm); +struct device *dev =drvdata_to_dev (ctx_p->drvdata); +int cipher_mode = ctx_p->cipher_mode; +int flow_mode = ctx_p->flow_mode; +int direction = req_ctx->gen_ctx.op_type; +dma_addr_t key_dma_addr = ctx_p->user.key_dma_addr; +unsigned int key_len = ctx_p->keylen; +dma_addr_t iv_dma_addr = req_ctx->gen_ctx.iv_dma_addr; +unsigned int du_size = nbytes; + +struct cc_crypto_alg *cc_alg = + container_of(tfm->__crt_alg, struct cc_crypto_alg, + skcipher_alg.base); + +if (cc_alg->data_unit) + du_size = cc_alg->data_unit; + +switch (cipher_mode) { +case DRV_CIPHER_ECB : +break ; +case DRV_CIPHER_CBC : +case DRV_CIPHER_CBC_CTS : +case DRV_CIPHER_CTR : +case DRV_CIPHER_OFB : +break ; +case DRV_CIPHER_XTS : +case DRV_CIPHER_ESSIV : +case DRV_CIPHER_BITLOCKER :/* load XEX key */ hw_desc_init (&desc[*seq_size]);set_cipher_mode (&desc[*seq_size], cipher_mode);
@@ -881,12 +921,14 @@ static int cc_cipher_process(struct skci/* STAT_PHASE_2: Create sequence */ -/* Setup IV and XEX key used */ +/* Setup state (IV) */ cc_setup_state_desc (tfm, req_ctx, ivsize, nbytes, desc, &seq_len);/* Setup MLLI line, if needed */ cc_setup_mlli_desc (tfm, req_ctx, dst, src, nbytes, req, desc, &seq_len);/* Setup key */ cc_setup_key_desc (tfm, req_ctx, nbytes, desc, &seq_len); +/* Setup state (IV and XEX key) */ +cc_setup_xex_state_desc (tfm, req_ctx, ivsize, nbytes, desc, &seq_len);/* Data processing */ cc_setup_flow_desc (tfm, req_ctx, dst, src, nbytes, desc, &seq_len);/* Read next IV */
Greg Kroah-Hartman
maintainerPATCH 154/367 crypto: pcrypt - Avoid deadlock by using per-instance padata queues
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
commit bbefa1dd6a6d53537c11624752219e39959d04fb upstream.
If the pcrypt template is used multiple times in an algorithm, then a deadlock occurs because all pcrypt instances share the same padata_instance, which completes requests in the order submitted. That is, the inner pcrypt request waits for the outer pcrypt request while the outer request is already waiting for the inner.
This patch fixes this by allocating a set of queues for each pcrypt instance instead of using two global queues. In order to maintain the existing user-space interface, the pinst structure remains global so any sysfs modifications will apply to every pcrypt instance.
Note that when an update occurs we have to allocate memory for every pcrypt instance. Should one of the allocations fail we will abort the update without rolling back changes already made.
The new per-instance data structure is called padata_shell and is essentially a wrapper around parallel_data.
Reproducer:
#include <linux/if_alg.h>
#include <sys/socket.h>
#include <unistd.h>
int main()
{
struct sockaddr_alg addr = {
.salg_type = "aead",
.salg_name = "pcrypt(pcrypt(rfc4106-gcm-aesni))"
};
int algfd, reqfd;
char buf[32] = { 0 };
algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
bind(algfd, (void *)&addr, sizeof(addr));
setsockopt(algfd, SOL_ALG, ALG_SET_KEY, buf, 20);
reqfd = accept(algfd, 0, 0);
write(reqfd, buf, 32);
read(reqfd, buf, 16);
}--- crypto/pcrypt.c | 36 ++++++- include/linux/padata.h | 34 ++++++- kernel/padata.c | 236 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 227 insertions(+), 79 deletions(-)
crypto/pcrypt.c +33 -3
@@ -24,6 +24,8 @@ static struct kset *pcrypt_ksestruct pcrypt_instance_ctx {struct crypto_aead_spawn spawn; +struct padata_shell *psenc; +struct padata_shell *psdec;atomic_t tfm_count; };
@@ -32,6 +34,12 @@ struct pcrypt_aead_ctx {unsigned int cb_cpu; }; +static inline struct pcrypt_instance_ctx *pcrypt_tfm_ictx ( +struct crypto_aead *tfm) +{ +return aead_instance_ctx (aead_alg_instance (tfm)); +} +static int pcrypt_aead_setkey (struct crypto_aead *parent,const u8 *key,unsigned int keylen) {
@@ -90,6 +98,9 @@ static int pcrypt_aead_encrypt(struct aestruct crypto_aead *aead =crypto_aead_reqtfm (req);struct pcrypt_aead_ctx *ctx =crypto_aead_ctx (aead);u32 flags =aead_request_flags (req); +struct pcrypt_instance_ctx *ictx; + + ictx =pcrypt_tfm_ictx (aead);memset (padata,0 ,sizeof (struct padata_priv ));
@@ -103,7 +114,7 @@ static int pcrypt_aead_encrypt(struct ae req->cryptlen, req->iv);aead_request_set_ad (creq, req->assoclen); - err =padata_do_parallel (pencrypt, padata, &ctx->cb_cpu); + err =padata_do_parallel (ictx->psenc, padata, &ctx->cb_cpu);if (!err)return -EINPROGRESS ;
@@ -132,6 +143,9 @@ static int pcrypt_aead_decrypt(struct aestruct crypto_aead *aead =crypto_aead_reqtfm (req);struct pcrypt_aead_ctx *ctx =crypto_aead_ctx (aead);u32 flags =aead_request_flags (req); +struct pcrypt_instance_ctx *ictx; + + ictx =pcrypt_tfm_ictx (aead);memset (padata,0 ,sizeof (struct padata_priv ));
@@ -145,7 +159,7 @@ static int pcrypt_aead_decrypt(struct ae req->cryptlen, req->iv);aead_request_set_ad (creq, req->assoclen); - err =padata_do_parallel (pdecrypt, padata, &ctx->cb_cpu); + err =padata_do_parallel (ictx->psdec, padata, &ctx->cb_cpu);if (!err)return -EINPROGRESS ;
@@ -192,6 +206,8 @@ static void pcrypt_free(struct aead_inststruct pcrypt_instance_ctx *ctx =aead_instance_ctx (inst);crypto_drop_aead (&ctx->spawn); +padata_free_shell (ctx->psdec); +padata_free_shell (ctx->psenc);kfree (inst); }
@@ -233,12 +249,22 @@ static int pcrypt_create_aead(struct cryif (!inst)return -ENOMEM ; + err = -ENOMEM ; + ctx =aead_instance_ctx (inst); + ctx->psenc =padata_alloc_shell (pencrypt); +if (!ctx->psenc) + goto out_free_inst; + + ctx->psdec =padata_alloc_shell (pdecrypt); +if (!ctx->psdec) + goto out_free_psenc; +crypto_set_aead_spawn (&ctx->spawn,aead_crypto_instance (inst)); err =crypto_grab_aead (&ctx->spawn, name,0 ,0 );if (err) - goto out_free_inst; + goto out_free_psdec; alg =crypto_spawn_aead_alg (&ctx->spawn); err =pcrypt_init_instance (aead_crypto_instance (inst), &alg->base);
@@ -271,6 +297,10 @@ out: out_drop_aead:crypto_drop_aead (&ctx->spawn); +out_free_psdec: +padata_free_shell (ctx->psdec); +out_free_psenc: +padata_free_shell (ctx->psenc); out_free_inst:kfree (inst); goto out;
include/linux/padata.h +29 -5
@@ -9,6 +9,7 @@#ifndef PADATA_H #define PADATA_H +#include <linux/compiler_types.h> #include <linux/workqueue.h> #include <linux/spinlock.h> #include <linux/list.h>
@@ -98,7 +99,7 @@ struct padata_cpumask {* struct parallel_data - Internal control structure, covers everything * that depends on the cpumask in use. * -* @pinst: padata instance. +* @sh: padata_shell object. * @pqueue: percpu padata queues used for parallelization. * @squeue: percpu padata queues used for serialuzation. * @reorder_objects: Number of objects waiting in the reorder queues.
@@ -111,7 +112,7 @@ struct padata_cpumask {* @lock: Reorder lock. */ struct parallel_data { -struct padata_instance *pinst; +struct padata_shell *ps;struct padata_parallel_queue __percpu *pqueue;struct padata_serial_queue __percpu *squeue;atomic_t reorder_objects;
@@ -125,13 +126,32 @@ struct parallel_data { };/** +* struct padata_shell - Wrapper around struct parallel_data, its +* purpose is to allow the underlying control structure to be replaced +* on the fly using RCU. +* +* @pinst: padat instance. +* @pd: Actual parallel_data structure which may be substituted on the fly. +* @opd: Pointer to old pd to be freed by padata_replace. +* @list: List entry in padata_instance list. +*/ +struct padata_shell { +struct padata_instance *pinst; +struct parallel_data __rcu *pd; +struct parallel_data *opd; +struct list_head list; +}; + +/** * struct padata_instance - The overall control structure. * * @cpu_notifier: cpu hotplug notifier. * @parallel_wq: The workqueue used for parallel work. * @serial_wq: The workqueue used for serial work. -* @pd: The internal control structure. +* @pslist: List of padata_shell objects attached to this instance. * @cpumask: User supplied cpumasks for parallel and serial works. +* @rcpumask: Actual cpumasks based on user cpumask and cpu_online_mask. +* @omask: Temporary storage used to compute the notification mask. * @cpumask_change_notifier: Notifiers chain for user-defined notify * callbacks that will be called when either @pcpu or @cbcpu * or both cpumasks change.
@@ -143,8 +163,10 @@ struct padata_instance {struct hlist_node node;struct workqueue_struct *parallel_wq;struct workqueue_struct *serial_wq; -struct parallel_data *pd; +struct list_head pslist;struct padata_cpumask cpumask; +struct padata_cpumask rcpumask; +cpumask_var_t omask;struct blocking_notifier_head cpumask_change_notifier;struct kobject kobj;struct mutex lock;
@@ -156,7 +178,9 @@ struct padata_instance {extern struct padata_instance *padata_alloc_possible (const char *name);extern void padata_free (struct padata_instance *pinst); -extern int padata_do_parallel (struct padata_instance *pinst, +extern struct padata_shell *padata_alloc_shell (struct padata_instance *pinst); +extern void padata_free_shell (struct padata_shell *ps); +extern int padata_do_parallel (struct padata_shell *ps,struct padata_priv *padata,int *cb_cpu);extern void padata_do_serial (struct padata_priv *padata); extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
kernel/padata.c +165 -71
399 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 150/367 tracing: Annotate ftrace_graph_hash pointer with __rcu
In reply to Greg Kroah-HartmanFrom: Amol Grover <[email protected]>
[ Upstream commit 24a9729f831462b1d9d61dc85ecc91c59037243f ]
Fix following instances of sparse error kernel/trace/ftrace.c:5664:29: error: incompatible types in comparison kernel/trace/ftrace.c:5785:21: error: incompatible types in comparison kernel/trace/ftrace.c:5864:36: error: incompatible types in comparison kernel/trace/ftrace.c:5866:25: error: incompatible types in comparison
Use rcu_dereference_protected to access the __rcu annotated pointer.
--- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +1 -1
@@ -5596,7 +5596,7 @@ static const struct file_operations ftrace_notrace_fops = {static DEFINE_MUTEX (graph_lock); -struct ftrace_hash *ftrace_graph_hash =EMPTY_HASH ; +struct ftrace_hash __rcu *ftrace_graph_hash =EMPTY_HASH ;struct ftrace_hash *ftrace_graph_notrace_hash =EMPTY_HASH ;enum graph_filter_type {
kernel/trace/trace.h +6 -3
@@ -950,22 +950,25 @@ extern void __trace_graph_return(struct trace_array *tr, unsigned long flags, int pc);#ifdef CONFIG_DYNAMIC_FTRACE -extern struct ftrace_hash *ftrace_graph_hash; +extern struct ftrace_hash __rcu *ftrace_graph_hash;extern struct ftrace_hash *ftrace_graph_notrace_hash;static inline int ftrace_graph_addr (struct ftrace_graph_ent *trace) {unsigned long addr = trace->func;int ret =0 ; +struct ftrace_hash *hash;preempt_disable_notrace (); -if (ftrace_hash_empty (ftrace_graph_hash)) { + hash =rcu_dereference_protected (ftrace_graph_hash, !preemptible ()); + +if (ftrace_hash_empty (hash)) { ret =1 ; goto out; } -if (ftrace_lookup_ip (ftrace_graph_hash, addr)) { +if (ftrace_lookup_ip (hash, addr)) {/* * This needs to be cleared on the return functions
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 148/367 ASoC: SOF: Introduce state machine for FW boot
In reply to Greg Kroah-HartmanFrom: Ranjani Sridharan <[email protected]>
[ Upstream commit 6ca5cecbd1c1758666ab79446f19e0e61ed11444 ]
Add a state machine for FW boot to track the different stages of FW boot and replace the boot_complete field with fw_state field in struct snd_sof_dev. This will be used to determine the actions to be performed during system suspend.
One of the main motivations for adding this change is the fact that errors during the top-level SOF device probe cannot be propagated and therefore suspending the SOF device normally during system suspend could potentially run into errors. For example, with the current flow, if the FW boot failed for some reason and the system suspends, the SOF device suspend could fail because the CTX_SAVE IPC would be attempted even though the FW never really booted successfully causing it to time out. Another scenario that the state machine fixes is when the runtime suspend for the SOF device fails and the DSP is powered down nevertheless, the CTX_SAVE IPC during system suspend would timeout because the DSP is already powered down.
--- sound/soc/sof/core.c | 50 +++++++++++++++++++++++++++++++- sound/soc/sof/intel/hda-loader.c | 1 - sound/soc/sof/intel/hda.c | 4 +-- sound/soc/sof/ipc.c | 17 ++++------- sound/soc/sof/loader.c | 19 ++++++++---- sound/soc/sof/pm.c | 21 +++++++++++++- sound/soc/sof/sof-priv.h | 11 ++++++- 7 files changed, 99 insertions(+), 24 deletions(-)
sound/soc/sof/core.c +49 -1
@@ -306,6 +306,46 @@ static int sof_machine_check(struct snd_sof_dev *sdev)#endif } +/* +* FW Boot State Transition Diagram +* +* +-----------------------------------------------------------------------+ +* | | +* ------------------ ------------------ | +* | | | | | +* | BOOT_FAILED | | READY_FAILED |-------------------------+ | +* | | | | | | +* ------------------ ------------------ | | +* ^ ^ | | +* | | | | +* (FW Boot Timeout) (FW_READY FAIL) | | +* | | | | +* | | | | +* ------------------ | ------------------ | | +* | | | | | | | +* | IN_PROGRESS |---------------+------------->| COMPLETE | | | +* | | (FW Boot OK) (FW_READY OK) | | | | +* ------------------ ------------------ | | +* ^ | | | +* | | | | +* (FW Loading OK) (System Suspend/Runtime Suspend) +* | | | | +* | | | | +* ------------------ ------------------ | | | +* | | | |<-----+ | | +* | PREPARE | | NOT_STARTED |<---------------------+ | +* | | | |<---------------------------+ +* ------------------ ------------------ +* | ^ | ^ +* | | | | +* | +-----------------------+ | +* | (DSP Probe OK) | +* | | +* | | +* +------------------------------------+ +* (System Suspend/Runtime Suspend) +*/ +static int sof_probe_continue (struct snd_sof_dev *sdev) {struct snd_sof_pdata *plat_data = sdev->pdata;
@@ -321,6 +361,8 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)return ret; } + sdev->fw_state =SOF_FW_BOOT_PREPARE ; +/* check machine info */ ret =sof_machine_check (sdev);if (ret <0 ) {
@@ -360,7 +402,12 @@ static int sof_probe_continue(struct snd_sof_dev *sdev) goto fw_load_err; } -/* boot the firmware */ + sdev->fw_state =SOF_FW_BOOT_IN_PROGRESS ; + +/* +* Boot the firmware. The FW boot status will be modified +* in snd_sof_run_firmware() depending on the outcome. +*/ ret =snd_sof_run_firmware (sdev);if (ret <0 ) { dev_err(sdev->dev, "error: failed to boot DSP firmware %d\n",
@@ -479,6 +526,7 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) sdev->pdata = plat_data; sdev->first_boot = true; + sdev->fw_state =SOF_FW_BOOT_NOT_STARTED ;dev_set_drvdata (dev, sdev);/* check all mandatory ops */
sound/soc/sof/intel/hda-loader.c +0 -1
@@ -295,7 +295,6 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)/* init for booting wait */ init_waitqueue_head (&sdev->boot_wait); - sdev->boot_complete = false;/* prepare DMA for code loader stream */ tag = cl_stream_prepare(sdev, 0x40, stripped_firmware.size,
sound/soc/sof/intel/hda.c +2 -2
@@ -168,7 +168,7 @@ void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags) panic =snd_sof_dsp_read (sdev,HDA_DSP_BAR ,HDA_ADSP_ERROR_CODE_SKL +0x4 ); -if (sdev->boot_complete) { +if (sdev->fw_state ==SOF_FW_BOOT_COMPLETE ) {hda_dsp_get_registers (sdev, &xoops, &panic_info, stack,HDA_DSP_STACK_DUMP_SIZE ); snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
@@ -195,7 +195,7 @@ void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags) HDA_DSP_SRAM_REG_FW_STATUS); panic =snd_sof_dsp_read (sdev,HDA_DSP_BAR ,HDA_DSP_SRAM_REG_FW_TRACEP ); -if (sdev->boot_complete) { +if (sdev->fw_state ==SOF_FW_BOOT_COMPLETE ) {hda_dsp_get_registers (sdev, &xoops, &panic_info, stack,HDA_DSP_STACK_DUMP_SIZE ); snd_sof_get_status(sdev, status, panic, &xoops, &panic_info,
sound/soc/sof/ipc.c +5 -12
@@ -346,19 +346,12 @@ void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev)break ;case SOF_IPC_FW_READY :/* check for FW boot completion */ -if (!sdev->boot_complete) { +if (sdev->fw_state ==SOF_FW_BOOT_IN_PROGRESS ) { err =sof_ops (sdev)->fw_ready (sdev, cmd); -if (err <0 ) { -/* -* this indicates a mismatch in ABI -* between the driver and fw -*/ -dev_err (sdev->dev,"error: ABI mismatch %d\n" , - err); - }else { -/* firmware boot completed OK */ - sdev->boot_complete = true; - } +if (err <0 ) + sdev->fw_state =SOF_FW_BOOT_READY_FAILED ; +else + sdev->fw_state =SOF_FW_BOOT_COMPLETE ;/* wake up firmware loader */ wake_up (&sdev->boot_wait);
sound/soc/sof/loader.c +13 -6
@@ -512,7 +512,6 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)int init_core_mask;init_waitqueue_head (&sdev->boot_wait); - sdev->boot_complete = false;/* create read-only fw_version debugfs to store boot version info */ if (sdev->first_boot) {
@@ -544,19 +543,27 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev) init_core_mask = ret; -/* now wait for the DSP to boot */ - ret =wait_event_timeout (sdev->boot_wait, sdev->boot_complete, +/* +* now wait for the DSP to boot. There are 3 possible outcomes: +* 1. Boot wait times out indicating FW boot failure. +* 2. FW boots successfully and fw_ready op succeeds. +* 3. FW boots but fw_ready op fails. +*/ + ret =wait_event_timeout (sdev->boot_wait, + sdev->fw_state >SOF_FW_BOOT_IN_PROGRESS ,msecs_to_jiffies (sdev->boot_timeout));if (ret ==0 ) {dev_err (sdev->dev,"error: firmware boot failure\n" );snd_sof_dsp_dbg_dump (sdev,SOF_DBG_REGS |SOF_DBG_MBOX |SOF_DBG_TEXT |SOF_DBG_PCI ); -/* after this point FW_READY msg should be ignored */ - sdev->boot_complete = true; + sdev->fw_state =SOF_FW_BOOT_FAILED ;return -EIO ; } -dev_info (sdev->dev,"firmware boot complete\n" ); +if (sdev->fw_state ==SOF_FW_BOOT_COMPLETE ) +dev_info (sdev->dev,"firmware boot complete\n" ); +else +return -EIO ;/* FW boots but fw_ready op failed */ /* perform post fw run operations */ ret =snd_sof_dsp_post_fw_run (sdev);
sound/soc/sof/pm.c +20 -1
@@ -283,6 +283,8 @@ static int sof_resume(struct device *dev, bool runtime_resume)return ret; } + sdev->fw_state =SOF_FW_BOOT_PREPARE ; +/* load the firmware */ ret =snd_sof_load_firmware (sdev);if (ret <0 ) {
@@ -292,7 +294,12 @@ static int sof_resume(struct device *dev, bool runtime_resume)return ret; } -/* boot the firmware */ + sdev->fw_state =SOF_FW_BOOT_IN_PROGRESS ; + +/* +* Boot the firmware. The FW boot status will be modified +* in snd_sof_run_firmware() depending on the outcome. +*/ ret =snd_sof_run_firmware (sdev);if (ret <0 ) { dev_err(sdev->dev,
@@ -341,6 +348,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)if (!sof_ops (sdev)->suspend)return 0 ; +if (sdev->fw_state !=SOF_FW_BOOT_COMPLETE ) + goto power_down; +/* release trace */ snd_sof_release_trace (sdev);
@@ -378,6 +388,12 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) ret); } +power_down: + +/* return if the DSP was not probed successfully */ +if (sdev->fw_state ==SOF_FW_BOOT_NOT_STARTED ) +return 0 ; +/* power down all DSP cores */ if (runtime_suspend) ret =snd_sof_dsp_runtime_suspend (sdev);
@@ -388,6 +404,9 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)"error: failed to power down DSP during suspend %d\n" , ret); +/* reset FW state */ + sdev->fw_state =SOF_FW_BOOT_NOT_STARTED ; +return ret; }
sound/soc/sof/sof-priv.h +10 -1
@@ -387,6 +387,15 @@ struct snd_sof_dai {struct list_head list;/* list in sdev dai list */ }; +enum snd_sof_fw_state { +SOF_FW_BOOT_NOT_STARTED =0 , +SOF_FW_BOOT_PREPARE , +SOF_FW_BOOT_IN_PROGRESS , +SOF_FW_BOOT_FAILED , +SOF_FW_BOOT_READY_FAILED ,/* firmware booted but fw_ready op failed */ +SOF_FW_BOOT_COMPLETE , +}; +/* * SOF Device Level. */
@@ -408,7 +417,7 @@ struct snd_sof_dev {/* DSP firmware boot */ wait_queue_head_t boot_wait; -u32 boot_complete; +enum snd_sof_fw_state fw_state;u32 first_boot;/* work queue in case the probe is implemented in two steps */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 149/367 ASoC: SOF: core: release resources on errors in probe_continue
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 410e5e55c9c1c9c0d452ac5b9adb37b933a7747e ]
The initial intent of releasing resources in the .remove does not work well with HDaudio codecs. If the probe_continue() fails in a work queue, e.g. due to missing firmware or authentication issues, we don't release any resources, and as a result the kernel oopses during suspend operations.
The suggested fix is to release all resources during errors in probe_continue(), and use fw_state to track resource allocation state, so that .remove does not attempt to release the same hardware resources twice. PM operations are also modified so that no action is done if DSP resources have been freed due to an error at probe.
Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1161246
--- sound/soc/sof/core.c | 32 +++++++++++--------------------- sound/soc/sof/pm.c | 4 ++++ 2 files changed, 15 insertions(+), 21 deletions(-)
sound/soc/sof/core.c +11 -21
@@ -466,7 +466,6 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)return 0 ; -#if !IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE ) fw_trace_err:snd_sof_free_trace (sdev); fw_run_err:
@@ -477,22 +476,10 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)snd_sof_free_debug (sdev); dbg_err:snd_sof_remove (sdev); -#else - -/* -* when the probe_continue is handled in a work queue, the -* probe does not fail so we don't release resources here. -* They will be released with an explicit call to -* snd_sof_device_remove() when the PCI/ACPI device is removed -*/ - -fw_trace_err: -fw_run_err: -fw_load_err: -ipc_err: -dbg_err: -#endif +/* all resources freed, update state to match */ + sdev->fw_state =SOF_FW_BOOT_NOT_STARTED ; + sdev->first_boot = true;return ret; }
@@ -575,10 +562,12 @@ int snd_sof_device_remove(struct device *dev)if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE ))cancel_work_sync (&sdev->probe_work); -snd_sof_fw_unload (sdev); -snd_sof_ipc_free (sdev); -snd_sof_free_debug (sdev); -snd_sof_free_trace (sdev); +if (sdev->fw_state >SOF_FW_BOOT_NOT_STARTED ) { +snd_sof_fw_unload (sdev); +snd_sof_ipc_free (sdev); +snd_sof_free_debug (sdev); +snd_sof_free_trace (sdev); + }/* * Unregister machine driver. This will unbind the snd_card which
@@ -594,7 +583,8 @@ int snd_sof_device_remove(struct device *dev)* scheduled on, when they are unloaded. Therefore, the DSP must be * removed only after the topology has been unloaded. */ -snd_sof_remove (sdev); +if (sdev->fw_state >SOF_FW_BOOT_NOT_STARTED ) +snd_sof_remove (sdev);/* release firmware */ release_firmware (pdata->fw);
sound/soc/sof/pm.c +4 -0
@@ -269,6 +269,10 @@ static int sof_resume(struct device *dev, bool runtime_resume)if (!sof_ops (sdev)->resume || !sof_ops (sdev)->runtime_resume)return 0 ; +/* DSP was never successfully started, nothing to resume */ +if (sdev->first_boot) +return 0 ; +/* * if the runtime_resume flag is set, call the runtime_resume routine * or else call the system resume routine
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/367 dm crypt: fix GFP flags passed to skcipher_request_alloc()
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 9402e959014a18b4ebf7558733076875808dd66c upstream.
GFP_KERNEL is not supposed to be or'd with GFP_NOFS (the result is equivalent to GFP_KERNEL). Also, we use GFP_NOIO instead of GFP_NOFS because we don't want any I/O being submitted in the direct reclaim path.
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -717,7 +717,7 @@ static int crypt_iv_eboiv_gen(struct crystruct crypto_wait wait;int err; - req =skcipher_request_alloc (any_tfm (cc),GFP_KERNEL |GFP_NOFS ); + req =skcipher_request_alloc (any_tfm (cc),GFP_NOIO );if (!req)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 144/367 dm crypt: fix benbi IV constructor crash if used in authenticated mode
In reply to Greg Kroah-HartmanFrom: Milan Broz <[email protected]>
commit 4ea9471fbd1addb25a4d269991dc724e200ca5b5 upstream.
If benbi IV is used in AEAD construction, for example:
cryptsetup luksFormat <device> --cipher twofish-xts-benbi --key-size 512 --integrity=hmac-sha256
the constructor uses wrong skcipher function and crashes:
BUG: kernel NULL pointer dereference, address: 00000014 ... EIP: crypt_iv_benbi_ctr+0x15/0x70 [dm_crypt] Call Trace: ? crypt_subkey_size+0x20/0x20 [dm_crypt] crypt_ctr+0x567/0xfc0 [dm_crypt] dm_table_add_target+0x15f/0x340 [dm_mod]
Fix this by properly using crypt_aead_blocksize() in this case.
--- drivers/md/dm-crypt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/md/dm-crypt.c +8 -2
@@ -331,8 +331,14 @@ static int crypt_iv_essiv_gen(struct crystatic int crypt_iv_benbi_ctr (struct crypt_config *cc,struct dm_target *ti,const char *opts) { -unsigned bs =crypto_skcipher_blocksize (any_tfm (cc)); -int log =ilog2 (bs); +unsigned bs; +int log; + +if (test_bit (CRYPT_MODE_INTEGRITY_AEAD , &cc->cipher_flags)) + bs =crypto_aead_blocksize (any_tfm_aead (cc)); +else + bs =crypto_skcipher_blocksize (any_tfm (cc)); + log =ilog2 (bs);/* we need to calculate how far we must shift the sector count * to get the cipher block count, we use this shift in _gen */
Greg Kroah-Hartman
maintainerPATCH 117/367 crypto: ccree - fix pm wrongful error reporting
In reply to Greg Kroah-HartmanFrom: Gilad Ben-Yossef <[email protected]>
commit cedca59fae5834af8445b403c66c9953754375d7 upstream.
pm_runtime_get_sync() can return 1 as a valid (none error) return code. Treat it as such.
--- drivers/crypto/ccree/cc_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccree/cc_pm.c +1 -1
@@ -85,7 +85,7 @@ int cc_pm_get(struct device *dev)else pm_runtime_get_noresume (dev); -return rc; +return (rc ==1 ?0 : rc); }int cc_pm_put_suspend (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 142/367 dm writecache: fix incorrect flush sequence when doing SSD mode commit
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit aa9509209c5ac2f0b35d01a922bf9ae072d0c2fc upstream.
When committing state, the function writecache_flush does the following:
1. write metadata (writecache_commit_flushed)
2. flush disk cache (writecache_commit_flushed)
3. wait for data writes to complete (writecache_wait_for_ios)
4. increase superblock seq_count
5. write the superblock
6. flush disk cache
It may happen that at step 3, when we wait for some write to finish, the disk may report the write as finished, but the write only hit the disk cache and it is not yet stored in persistent storage. At step 5 we write the superblock - it may happen that the superblock is written before the write that we waited for in step 3. If the machine crashes, it may result in incorrect data being returned after reboot.
In order to fix the bug, we must swap steps 2 and 3 in the above sequence, so that we first wait for writes to complete and then flush the disk cache.
--- drivers/md/dm-writecache.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/md/dm-writecache.c +21 -21
@@ -442,7 +442,13 @@ static void writecache_notify_io(unsignecomplete (&endio->c); } -static void ssd_commit_flushed (struct dm_writecache *wc) +static void writecache_wait_for_ios (struct dm_writecache *wc,int direction) +{ +wait_event (wc->bio_in_progress_wait[direction], + !atomic_read (&wc->bio_in_progress[direction])); +} + +static void ssd_commit_flushed (struct dm_writecache *wc,bool wait_for_ios) {struct dm_io_region region;struct dm_io_request req;
@@ -488,17 +494,20 @@ static void ssd_commit_flushed(struct dmwritecache_notify_io (0 , &endio);wait_for_completion_io (&endio.c); +if (wait_for_ios) +writecache_wait_for_ios (wc,WRITE ); +writecache_disk_flush (wc, wc->ssd_dev);memset (wc->dirty_bitmap,0 , wc->dirty_bitmap_size); } -static void writecache_commit_flushed (struct dm_writecache *wc) +static void writecache_commit_flushed (struct dm_writecache *wc,bool wait_for_ios) {if (WC_MODE_PMEM (wc))wmb ();else -ssd_commit_flushed (wc); +ssd_commit_flushed (wc, wait_for_ios); }static void writecache_disk_flush (struct dm_writecache *wc,struct dm_dev *dev)
@@ -522,12 +531,6 @@ static void writecache_disk_flush(structwritecache_error (wc, r,"error flushing metadata: %d" , r); } -static void writecache_wait_for_ios (struct dm_writecache *wc,int direction) -{ -wait_event (wc->bio_in_progress_wait[direction], - !atomic_read (&wc->bio_in_progress[direction])); -} -#define WFE_RETURN_FOLLOWING 1#define WFE_LOWEST_SEQ 2
@@ -724,15 +727,12 @@ static void writecache_flush(struct dm_w e = e2;cond_resched (); } -writecache_commit_flushed (wc); - -if (!WC_MODE_PMEM (wc)) -writecache_wait_for_ios (wc,WRITE ); +writecache_commit_flushed (wc, true); wc->seq_count++;pmem_assign (sb (wc)->seq_count,cpu_to_le64 (wc->seq_count));writecache_flush_region (wc, &sb (wc)->seq_count,sizeof sb (wc)->seq_count); -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false); wc->overwrote_committed = false;
@@ -756,7 +756,7 @@ static void writecache_flush(struct dm_w }if (need_flush_after_free) -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false); }static void writecache_flush_work (struct work_struct *work)
@@ -809,7 +809,7 @@ static void writecache_discard(struct dm }if (discarded_something) -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false); }static bool writecache_wait_for_writeback (struct dm_writecache *wc)
@@ -958,7 +958,7 @@ erase_this:if (need_flush) {writecache_flush_all_metadata (wc); -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false); }wc_unlock (wc);
@@ -1342,7 +1342,7 @@ static void __writecache_endio_pmem(stru wc->writeback_size--; n_walked++;if (unlikely (n_walked >=ENDIO_LATENCY )) { -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false);wc_unlock (wc);wc_lock (wc); n_walked =0 ;
@@ -1423,7 +1423,7 @@ pop_from_list:writecache_wait_for_ios (wc,READ ); } -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false);wc_unlock (wc); }
@@ -1766,10 +1766,10 @@ static int init_memory(struct dm_writecawrite_original_sector_seq_count (wc, &wc->entries[b],-1 ,-1 );writecache_flush_all_metadata (wc); -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false);pmem_assign (sb (wc)->magic,cpu_to_le32 (MEMORY_SUPERBLOCK_MAGIC ));writecache_flush_region (wc, &sb (wc)->magic,sizeof sb (wc)->magic); -writecache_commit_flushed (wc); +writecache_commit_flushed (wc, false);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 139/367 ARM: dma-api: fix max_pfn off-by-one error in __dma_supported()
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit f3cc4e1d44a813a0685f2e558b78ace3db559722 upstream.
max_pfn, as set in arch/arm/mm/init.c:
static void __init find_limits(unsigned long *min,
unsigned long *max_low,
unsigned long *max_high)
{
*max_low = PFN_DOWN(memblock_get_current_limit());
*min = PFN_UP(memblock_start_of_DRAM());
*max_high = PFN_DOWN(memblock_end_of_DRAM());
}with memblock_end_of_DRAM() pointing to the next byte after DRAM. As such, max_pfn points to the PFN after the end of DRAM.
Thus when using max_pfn to check DMA masks, we should subtract one when checking DMA ranges against it.
Commit 8bf1268f48ad ("ARM: dma-api: fix off-by-one error in __dma_supported()") fixed the same issue, but missed this spot.
This issue was found while working on the sun4i-csi v4l2 driver on the Allwinner R40 SoC. On Allwinner SoCs, DRAM is offset at 0x40000000, and we are starting to use of_dma_configure() with the "dma-ranges" property in the device tree to have the DMA API handle the offset.
In this particular instance, dma-ranges was set to the same range as the actual available (2 GiB) DRAM. The following error appeared when the driver attempted to allocate a buffer:
sun4i-csi 1c09000.csi: Coherent DMA mask 0x7fffffff (pfn 0x40000-0xc0000)
covers a smaller range of system memory than the DMA zone pfn 0x0-0xc0001
sun4i-csi 1c09000.csi: dma_alloc_coherent of size 307200 failedFixing the off-by-one error makes things work.
--- arch/arm/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/dma-mapping.c +1 -1
@@ -221,7 +221,7 @@ EXPORT_SYMBOL(arm_coherent_dma_ops);static int __dma_supported (struct device *dev,u64 mask,bool warn) { -unsigned long max_dma_pfn =min (max_pfn, arm_dma_pfn_limit); +unsigned long max_dma_pfn =min (max_pfn -1 , arm_dma_pfn_limit);/* * Translate the device's DMA mask to a PFN limit. This
Greg Kroah-Hartman
maintainerPATCH 140/367 dm zoned: support zone sizes smaller than 128MiB
In reply to Greg Kroah-HartmanFrom: Dmitry Fomichev <[email protected]>
commit b39962950339912978484cdac50069258545d753 upstream.
dm-zoned is observed to log failed kernel assertions and not work correctly when operating against a device with a zone size smaller than 128MiB (e.g. 32768 bits per 4K block). The reason is that the bitmap size per zone is calculated as zero with such a small zone size. Fix this problem and also make the code related to zone bitmap management be able to handle per zone bitmaps smaller than a single block.
A dm-zoned-tools patch is required to properly format dm-zoned devices with zone sizes smaller than 128MiB.
--- drivers/md/dm-zoned-metadata.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/md/dm-zoned-metadata.c +14 -9
@@ -134,6 +134,7 @@ struct dmz_metadata {sector_t zone_bitmap_size;unsigned int zone_nr_bitmap_blocks; +unsigned int zone_bits_per_mblk;unsigned int nr_bitmap_blocks;unsigned int nr_map_blocks;
@@ -1161,7 +1162,10 @@ static int dmz_init_zones(struct dmz_met/* Init */ zmd->zone_bitmap_size = dev->zone_nr_blocks >>3 ; - zmd->zone_nr_bitmap_blocks = zmd->zone_bitmap_size >>DMZ_BLOCK_SHIFT ; + zmd->zone_nr_bitmap_blocks = +max_t (sector_t,1 , zmd->zone_bitmap_size >>DMZ_BLOCK_SHIFT ); + zmd->zone_bits_per_mblk =min_t (sector_t, dev->zone_nr_blocks, +DMZ_BLOCK_SIZE_BITS );/* Allocate zone array */ zmd->zones =kcalloc (dev->nr_zones,sizeof (struct dm_zone ),GFP_KERNEL );
@@ -1956,7 +1960,7 @@ int dmz_copy_valid_blocks(struct dmz_metdmz_release_mblock (zmd, to_mblk);dmz_release_mblock (zmd, from_mblk); - chunk_block +=DMZ_BLOCK_SIZE_BITS ; + chunk_block += zmd->zone_bits_per_mblk; } to_zone->weight = from_zone->weight;
@@ -2017,7 +2021,7 @@ int dmz_validate_blocks(struct dmz_metad/* Set bits */ bit = chunk_block &DMZ_BLOCK_MASK_BITS ; - nr_bits =min (nr_blocks,DMZ_BLOCK_SIZE_BITS - bit); + nr_bits =min (nr_blocks, zmd->zone_bits_per_mblk - bit); count =dmz_set_bits ((unsigned long *)mblk->data, bit, nr_bits);if (count) {
@@ -2096,7 +2100,7 @@ int dmz_invalidate_blocks(struct dmz_met/* Clear bits */ bit = chunk_block &DMZ_BLOCK_MASK_BITS ; - nr_bits =min (nr_blocks,DMZ_BLOCK_SIZE_BITS - bit); + nr_bits =min (nr_blocks, zmd->zone_bits_per_mblk - bit); count =dmz_clear_bits ((unsigned long *)mblk->data, bit, nr_bits);
@@ -2156,6 +2160,7 @@ static int dmz_to_next_set_block(struct {struct dmz_mblock *mblk;unsigned int bit, set_bit, nr_bits; +unsigned int zone_bits = zmd->zone_bits_per_mblk;unsigned long *bitmap;int n =0 ;
@@ -2170,15 +2175,15 @@ static int dmz_to_next_set_block(struct/* Get offset */ bitmap = (unsigned long *) mblk->data; bit = chunk_block &DMZ_BLOCK_MASK_BITS ; - nr_bits =min (nr_blocks,DMZ_BLOCK_SIZE_BITS - bit); + nr_bits =min (nr_blocks, zone_bits - bit);if (set) - set_bit =find_next_bit (bitmap,DMZ_BLOCK_SIZE_BITS , bit); + set_bit =find_next_bit (bitmap, zone_bits, bit);else - set_bit =find_next_zero_bit (bitmap,DMZ_BLOCK_SIZE_BITS , bit); + set_bit =find_next_zero_bit (bitmap, zone_bits, bit);dmz_release_mblock (zmd, mblk); n += set_bit - bit; -if (set_bit <DMZ_BLOCK_SIZE_BITS ) +if (set_bit < zone_bits)break ; nr_blocks -= nr_bits;
@@ -2281,7 +2286,7 @@ static void dmz_get_zone_weight(struct d/* Count bits in this block */ bitmap = mblk->data; bit = chunk_block &DMZ_BLOCK_MASK_BITS ; - nr_bits =min (nr_blocks,DMZ_BLOCK_SIZE_BITS - bit); + nr_bits =min (nr_blocks, zmd->zone_bits_per_mblk - bit); n +=dmz_count_bits (bitmap, bit, nr_bits);dmz_release_mblock (zmd, mblk);
Greg Kroah-Hartman
maintainerPATCH 138/367 of: Add OF_DMA_DEFAULT_COHERENT & select it on powerpc
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit dabf6b36b83a18d57e3d4b9d50544ed040d86255 upstream.
There's an OF helper called of_dma_is_coherent(), which checks if a device has a "dma-coherent" property to see if the device is coherent for DMA.
But on some platforms devices are coherent by default, and on some platforms it's not possible to update existing device trees to add the "dma-coherent" property.
So add a Kconfig symbol to allow arch code to tell of_dma_is_coherent() that devices are coherent by default, regardless of the presence of the property.
Select that symbol on powerpc when NOT_COHERENT_CACHE is not set, ie. when the system has a coherent cache.
--- arch/powerpc/Kconfig | 1 + drivers/of/Kconfig | 4 ++++ drivers/of/address.c | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -0
@@ -238,6 +238,7 @@ config PPC select NEED_DMA_MAP_STATE if PPC64 || NOT_COHERENT_CACHE select NEED_SG_DMA_LENGTH select OF + select OF_DMA_DEFAULT_COHERENT if !NOT_COHERENT_CACHE select OF_EARLY_FLATTREE select OLD_SIGACTION if PPC32 select OLD_SIGSUSPEND
drivers/of/Kconfig +4 -0
@@ -103,4 +103,8 @@ config OF_OVERLAY config OF_NUMA bool +config OF_DMA_DEFAULT_COHERENT + # arches should select this if DMA is coherent by default for OF devices + bool + endif # OF
drivers/of/address.c +5 -1
@@ -995,12 +995,16 @@ out:* @np: device node * * It returns true if "dma-coherent" property was found -* for this device in DT. +* for this device in the DT, or if DMA is coherent by +* default for OF devices on the current platform. */ bool of_dma_is_coherent (struct device_node *np) {struct device_node *node =of_node_get (np); +if (IS_ENABLED (CONFIG_OF_DMA_DEFAULT_COHERENT )) +return true; +while (node) {if (of_property_read_bool (node,"dma-coherent" )) {of_node_put (node);
Greg Kroah-Hartman
maintainerPATCH 135/367 f2fs: fix race conditions in ->d_compare() and ->d_hash()
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 80f2388afa6ef985f9c5c228e36705c4d4db4756 upstream.
Since ->d_compare() and ->d_hash() can be called in RCU-walk mode, ->d_parent and ->d_inode can be concurrently modified, and in particular, ->d_inode may be changed to NULL. For f2fs_d_hash() this resulted in a reproducible NULL dereference if a lookup is done in a directory being deleted, e.g. with:
int main()
{
if (fork()) {
for (;;) {
mkdir("subdir", 0700);
rmdir("subdir");
}
} else {
for (;;)
access("subdir/file", 0);
}
}... or by running the 't_encrypted_d_revalidate' program from xfstests. Both repros work in any directory on a filesystem with the encoding feature, even if the directory doesn't actually have the casefold flag.
I couldn't reproduce a crash in f2fs_d_compare(), but it appears that a similar crash is possible there.
Fix these bugs by reading ->d_parent and ->d_inode using READ_ONCE() and falling back to the case sensitive behavior if the inode is NULL.
--- fs/f2fs/dir.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/f2fs/dir.c +6 -3
@@ -1069,24 +1069,27 @@ static int f2fs_d_compare(const struct d const char *str, const struct qstr *name) { struct qstr qstr = {.name = str, .len = len }; +const struct dentry *parent =READ_ONCE (dentry->d_parent); +const struct inode *inode =READ_ONCE (parent->d_inode); -if (!IS_CASEFOLDED (dentry->d_parent->d_inode)) { +if (!inode || !IS_CASEFOLDED (inode)) {if (len != name->len)return -1 ;return memcmp (str, name->name, len); } -return f2fs_ci_compare (dentry->d_parent->d_inode, name, &qstr, false); +return f2fs_ci_compare (inode, name, &qstr, false); }static int f2fs_d_hash (const struct dentry *dentry,struct qstr *str) {struct f2fs_sb_info *sbi =F2FS_SB (dentry->d_sb);const struct unicode_map *um = sbi->s_encoding; +const struct inode *inode =READ_ONCE (dentry->d_inode);unsigned char *norm;int len, ret =0 ; -if (!IS_CASEFOLDED (dentry->d_inode)) +if (!inode || !IS_CASEFOLDED (inode))return 0 ; norm =f2fs_kmalloc (sbi,PATH_MAX ,GFP_ATOMIC );
Greg Kroah-Hartman
maintainerPATCH 132/367 f2fs: fix miscounted block limit in f2fs_statfs_project()
In reply to Greg Kroah-HartmanFrom: Chengguang Xu <[email protected]>
commit acdf2172172a511f97fa21ed0ee7609a6d3b3a07 upstream.
statfs calculates Total/Used/Avail disk space in block unit, so we should translate soft/hard prjquota limit to block unit as well.
Below testing result shows the block/inode numbers of Total/Used/Avail from df command are all correct afer applying this patch.
[root@localhost quota-tools]\# ./repquota -P /dev/sdb1
--- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/f2fs/super.c +2 -0
@@ -1219,6 +1219,8 @@ static int f2fs_statfs_project(struct suif (dquot->dq_dqb.dqb_bhardlimit && (!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) limit = dquot->dq_dqb.dqb_bhardlimit; +if (limit) + limit >>= sb->s_blocksize_bits;if (limit && buf->f_blocks > limit) { curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;
Greg Kroah-Hartman
maintainerPATCH 131/367 ovl: fix lseek overflow on 32bit
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit a4ac9d45c0cd14a2adc872186431c79804b77dbf upstream.
ovl_lseek() is using ssize_t to return the value from vfs_llseek(). On a 32-bit kernel ssize_t is a 32-bit signed int, which overflows above 2 GB.
Assign the return value of vfs_llseek() to loff_t to fix this.
--- fs/overlayfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/overlayfs/file.c +1 -1
@@ -146,7 +146,7 @@ static loff_t ovl_llseek(struct file *fistruct inode *inode =file_inode (file);struct fd real;const struct cred *old_cred; -ssize_t ret; +loff_t ret;/* * The two special cases below do not need to involve real fs,
Greg Kroah-Hartman
maintainerPATCH 129/367 power: supply: ltc2941-battery-gauge: fix use-after-free
In reply to Greg Kroah-HartmanFrom: Sven Van Asbroeck <[email protected]>
commit a60ec78d306c6548d4adbc7918b587a723c555cc upstream.
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This could mean that the work function is still running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling cancel_delayed_work_sync(), which ensures that that the work is properly cancelled, no longer running, and unable to re-schedule itself.
This issue was detected with the help of Coccinelle.
--- drivers/power/supply/ltc2941-battery-gauge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/ltc2941-battery-gauge.c +1 -1
@@ -449,7 +449,7 @@ static int ltc294x_i2c_remove(struct i2c {struct ltc294x_info *info =i2c_get_clientdata (client); -cancel_delayed_work (&info->work); +cancel_delayed_work_sync (&info->work);power_supply_unregister (info->supply);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 127/367 cpupower: Revert library ABI changes from commit ae2917093fb60bdc1ed3e
In reply to Greg Kroah-HartmanFrom: Thomas Renninger <[email protected]>
commit 41ddb7e1f79693d904502ae9bea609837973eff8 upstream.
Commit ae2917093fb6 ("tools/power/cpupower: Display boost frequency separately") modified the library function:
struct cpufreq_available_frequencies *cpufreq_get_available_frequencies(unsigned int cpu)
to
struct cpufreq_frequencies *cpufreq_get_frequencies(const char *type, unsigned int cpu)
This patch recovers the old API and implements the new functionality in a newly introduce method:
struct cpufreq_boost_frequencies *cpufreq_get_available_frequencies(unsigned int cpu)
This one should get merged into stable kernels back to 5.0 when the above had been introduced.
--- tools/power/cpupower/lib/cpufreq.c | 78 ++++++++++++++++++++++++++---- tools/power/cpupower/lib/cpufreq.h | 20 +++++-- tools/power/cpupower/utils/cpufreq-info.c | 12 ++-- 3 files changed, 87 insertions(+), 23 deletions(-)
tools/power/cpupower/lib/cpufreq.c +68 -10
@@ -332,21 +332,74 @@ void cpufreq_put_available_governors(str } -struct cpufreq_frequencies -*cpufreq_get_frequencies (const char *type,unsigned int cpu) +struct cpufreq_available_frequencies +*cpufreq_get_available_frequencies (unsigned int cpu) { -struct cpufreq_frequencies *first =NULL ; -struct cpufreq_frequencies *current =NULL ; +struct cpufreq_available_frequencies *first =NULL ; +struct cpufreq_available_frequencies *current =NULL ;char one_value[SYSFS_PATH_MAX ];char linebuf[MAX_LINE_LEN ]; -char fname[MAX_LINE_LEN ];unsigned int pos, i;unsigned int len; -snprintf (fname,MAX_LINE_LEN ,"scaling_%s_frequencies" , type); + len =sysfs_cpufreq_read_file (cpu,"scaling_available_frequencies" , + linebuf,sizeof (linebuf)); +if (len ==0 ) +return NULL ; + + pos =0 ; +for (i =0 ; i < len; i++) { +if (linebuf[i] ==' ' || linebuf[i] =='\n' ) { +if (i - pos <2 ) +continue ; +if (i - pos >=SYSFS_PATH_MAX ) + goto error_out; +if (current) { + current->next =malloc (sizeof (*current)); +if (!current->next) + goto error_out; + current = current->next; + }else { + first =malloc (sizeof (*first)); +if (!first) + goto error_out; + current = first; + } + current->first = first; + current->next =NULL ; + +memcpy (one_value, linebuf + pos, i - pos); + one_value[i - pos] ='\0' ; +if (sscanf (one_value,"%lu" , ¤t->frequency) !=1 ) + goto error_out; + + pos = i +1 ; + } + } + +return first; + + error_out: +while (first) { + current = first->next; +free (first); + first = current; + } +return NULL ; +} - len =sysfs_cpufreq_read_file (cpu, fname, - linebuf,sizeof (linebuf)); +struct cpufreq_available_frequencies +*cpufreq_get_boost_frequencies (unsigned int cpu) +{ +struct cpufreq_available_frequencies *first =NULL ; +struct cpufreq_available_frequencies *current =NULL ; +char one_value[SYSFS_PATH_MAX ]; +char linebuf[MAX_LINE_LEN ]; +unsigned int pos, i; +unsigned int len; + + len =sysfs_cpufreq_read_file (cpu,"scaling_boost_frequencies" , + linebuf,sizeof (linebuf));if (len ==0 )return NULL ;
@@ -391,9 +444,9 @@ struct cpufreq_frequenciesreturn NULL ; } -void cpufreq_put_frequencies (struct cpufreq_frequencies *any) +void cpufreq_put_available_frequencies (struct cpufreq_available_frequencies *any) { -struct cpufreq_frequencies *tmp, *next; +struct cpufreq_available_frequencies *tmp, *next;if (!any)return ;
@@ -406,6 +459,11 @@ void cpufreq_put_frequencies(struct cpuf } } +void cpufreq_put_boost_frequencies (struct cpufreq_available_frequencies *any) +{ +cpufreq_put_available_frequencies (any); +} +static struct cpufreq_affected_cpus *sysfs_get_cpu_list (unsigned int cpu,const char *file) {
tools/power/cpupower/lib/cpufreq.h +13 -7
@@ -20,10 +20,10 @@ struct cpufreq_available_governors {struct cpufreq_available_governors *first; }; -struct cpufreq_frequencies { +struct cpufreq_available_frequencies {unsigned long frequency; -struct cpufreq_frequencies *next; -struct cpufreq_frequencies *first; +struct cpufreq_available_frequencies *next; +struct cpufreq_available_frequencies *first; };
@@ -124,11 +124,17 @@ void cpufreq_put_available_governors(* cpufreq_put_frequencies after use. */ -struct cpufreq_frequencies -*cpufreq_get_frequencies (const char *type,unsigned int cpu); +struct cpufreq_available_frequencies +*cpufreq_get_available_frequencies (unsigned int cpu); -void cpufreq_put_frequencies ( -struct cpufreq_frequencies *first); +void cpufreq_put_available_frequencies ( +struct cpufreq_available_frequencies *first); + +struct cpufreq_available_frequencies +*cpufreq_get_boost_frequencies (unsigned int cpu); + +void cpufreq_put_boost_frequencies ( +struct cpufreq_available_frequencies *first);/* determine affected CPUs
tools/power/cpupower/utils/cpufreq-info.c +6 -6
@@ -244,14 +244,14 @@ static int get_boost_mode_x86(unsigned istatic int get_boost_mode (unsigned int cpu) { -struct cpufreq_frequencies *freqs; +struct cpufreq_available_frequencies *freqs;if (cpupower_cpu_info.vendor ==X86_VENDOR_AMD || cpupower_cpu_info.vendor ==X86_VENDOR_HYGON || cpupower_cpu_info.vendor ==X86_VENDOR_INTEL )return get_boost_mode_x86 (cpu); - freqs =cpufreq_get_frequencies ("boost" , cpu); + freqs =cpufreq_get_boost_frequencies (cpu);if (freqs) {printf (_ (" boost frequency steps: " ));while (freqs->next) {
@@ -261,7 +261,7 @@ static int get_boost_mode(unsigned int c }print_speed (freqs->frequency);printf ("\n" ); -cpufreq_put_frequencies (freqs); +cpufreq_put_available_frequencies (freqs); }return 0 ;
@@ -475,7 +475,7 @@ static int get_latency(unsigned int cpu,static void debug_output_one (unsigned int cpu) { -struct cpufreq_frequencies *freqs; +struct cpufreq_available_frequencies *freqs;get_driver (cpu);get_related_cpus (cpu);
@@ -483,7 +483,7 @@ static void debug_output_one(unsigned inget_latency (cpu,1 );get_hardware_limits (cpu,1 ); - freqs =cpufreq_get_frequencies ("available" , cpu); + freqs =cpufreq_get_available_frequencies (cpu);if (freqs) {printf (_ (" available frequency steps: " ));while (freqs->next) {
@@ -493,7 +493,7 @@ static void debug_output_one(unsigned in }print_speed (freqs->frequency);printf ("\n" ); -cpufreq_put_frequencies (freqs); +cpufreq_put_available_frequencies (freqs); }get_available_governors (cpu);
Greg Kroah-Hartman
maintainerPATCH 125/367 scsi: qla2xxx: Fix stuck login session using prli_pend_timer
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 8aaac2d7da873aebeba92c666f82c00bbd74aaf9 upstream.
Session is stuck if driver sees FW has received a PRLI. Driver allows FW to finish with processing of PRLI by checking back with FW at a later time to see if the PRLI has finished. Instead, driver failed to push forward after re-checking PRLI completion.
--- drivers/scsi/qla2xxx/qla_def.h | 5 +++++ drivers/scsi/qla2xxx/qla_init.c | 34 ++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_target.c | 1 + 3 files changed, 32 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +5 -0
@@ -2402,6 +2402,7 @@ typedef struct fc_port { unsigned int scan_needed:1; unsigned int n2n_flag:1; unsigned int explicit_logout:1; + unsigned int prli_pend_timer:1;struct completion nvme_del_done;uint32_t nvme_prli_service_param;
@@ -2428,6 +2429,7 @@ typedef struct fc_port {struct work_struct free_work;struct work_struct reg_work;uint64_t jiffies_at_registration; +unsigned long prli_expired;struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX ];uint16_t tgt_id;
@@ -4845,6 +4847,9 @@ struct sff_8247_a0 { (ha->fc4_type_priority == FC4_PRIORITY_NVME)) || \ NVME_ONLY_TARGET(fcport)) \ +#define PRLI_PHASE (_cls) \ + ((_cls == DSC_LS_PRLI_PEND) || (_cls == DSC_LS_PRLI_COMP)) +#include "qla_target.h" #include "qla_gbl.h" #include "qla_dbg.h"
drivers/scsi/qla2xxx/qla_init.c +26 -8
@@ -685,7 +685,7 @@ static void qla24xx_handle_gnl_done_evenport_id_t id;u64 wwn;u16 data[2 ]; -u8 current_login_state; +u8 current_login_state, nvme_cls; fcport = ea->fcport; ql_dbg(ql_dbg_disc, vha, 0xffff,
@@ -744,10 +744,17 @@ static void qla24xx_handle_gnl_done_even loop_id =le16_to_cpu (e->nport_handle); loop_id = (loop_id &0x7fff ); -if (NVME_TARGET (vha->hw, fcport)) - current_login_state = e->current_login_state >>4 ; -else - current_login_state = e->current_login_state &0xf ; + nvme_cls = e->current_login_state >>4 ; + current_login_state = e->current_login_state &0xf ; + +if (PRLI_PHASE (nvme_cls)) { + current_login_state = nvme_cls; + fcport->fc4_type &= ~FS_FC4TYPE_FCP ; + fcport->fc4_type |=FS_FC4TYPE_NVME ; + }else if (PRLI_PHASE (current_login_state)) { + fcport->fc4_type |=FS_FC4TYPE_FCP ; + fcport->fc4_type &= ~FS_FC4TYPE_NVME ; + } ql_dbg(ql_dbg_disc, vha, 0x20e2, "%s found %8phC CLS [%x|%x] fc4_type %d ID[%06x|%06x] lid[%d|%d]\n",
@@ -1216,12 +1223,19 @@ qla24xx_async_prli(struct scsi_qla_hoststruct srb_iocb *lio;int rval =QLA_FUNCTION_FAILED ; -if (!vha->flags.online) +if (!vha->flags.online) { +ql_dbg (ql_dbg_disc, vha,0xffff ,"%s %d %8phC exit\n" , + __func__, __LINE__, fcport->port_name);return rval; + } -if (fcport->fw_login_state ==DSC_LS_PLOGI_PEND || - fcport->fw_login_state ==DSC_LS_PRLI_PEND ) +if ((fcport->fw_login_state ==DSC_LS_PLOGI_PEND || + fcport->fw_login_state ==DSC_LS_PRLI_PEND ) && +qla_dual_mode_enabled (vha)) { +ql_dbg (ql_dbg_disc, vha,0xffff ,"%s %d %8phC exit\n" , + __func__, __LINE__, fcport->port_name);return rval; + } sp =qla2x00_get_sp (vha, fcport,GFP_KERNEL );if (!sp)
@@ -1600,6 +1614,10 @@ int qla24xx_fcport_handle_login(struct sbreak ;default :if (fcport->login_pause) { +ql_dbg (ql_dbg_disc, vha,0x20d8 , +"%s %d %8phC exit\n" , + __func__, __LINE__, + fcport->port_name); fcport->last_rscn_gen = fcport->rscn_gen; fcport->last_login_gen = fcport->login_gen;set_bit (RELOGIN_NEEDED , &vha->dpc_flags);
drivers/scsi/qla2xxx/qla_target.c +1 -0
@@ -1257,6 +1257,7 @@ void qlt_schedule_sess_for_deletion(stru sess->deleted =QLA_SESS_DELETION_IN_PROGRESS ;spin_unlock_irqrestore (&sess->vha->work_lock, flags); + sess->prli_pend_timer =0 ; sess->disc_state =DSC_DELETE_PEND ;qla24xx_chk_fcp_state (sess);
Greg Kroah-Hartman
maintainerPATCH 124/367 scsi: megaraid_sas: Do not initiate OCR if controller is not in ready state
In reply to Greg Kroah-HartmanFrom: Anand Lodnoor <[email protected]>
commit 6d7537270e3283b92f9b327da9d58a4de40fe8d0 upstream.
Driver initiates OCR if a DCMD command times out. But there is a deadlock if the driver attempts to invoke another OCR before the mutex lock (reset_mutex) is released from the previous session of OCR.
This patch takes care of the above scenario using new flag MEGASAS_FUSION_OCR_NOT_POSSIBLE to indicate if OCR is possible.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 3 ++- drivers/scsi/megaraid/megaraid_sas_fusion.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +2 -1
@@ -4392,7 +4392,8 @@ dcmd_timeout_ocr_possible(struct megasasif (instance->adapter_type ==MFI_SERIES )return KILL_ADAPTER ;else if (instance->unload || -test_bit (MEGASAS_FUSION_IN_RESET , &instance->reset_flags)) +test_bit (MEGASAS_FUSION_OCR_NOT_POSSIBLE , + &instance->reset_flags))return IGNORE_TIMEOUT ;else return INITIATE_OCR ;
drivers/scsi/megaraid/megaraid_sas_fusion.c +2 -1
@@ -4847,6 +4847,7 @@ int megasas_reset_fusion(struct Scsi_Hosif (instance->requestorId && !instance->skip_heartbeat_timer_del)del_timer_sync (&instance->sriov_heartbeat_timer);set_bit (MEGASAS_FUSION_IN_RESET , &instance->reset_flags); +set_bit (MEGASAS_FUSION_OCR_NOT_POSSIBLE , &instance->reset_flags);atomic_set (&instance->adprecovery,MEGASAS_ADPRESET_SM_POLLING ); instance->instancet->disable_intr (instance);megasas_sync_irqs ((unsigned long )instance);
@@ -5046,7 +5047,7 @@ kill_hba: instance->skip_heartbeat_timer_del =1 ; retval =FAILED ; out: -clear_bit (MEGASAS_FUSION_IN_RESET , &instance->reset_flags); +clear_bit (MEGASAS_FUSION_OCR_NOT_POSSIBLE , &instance->reset_flags);mutex_unlock (&instance->reset_mutex);return retval; }
drivers/scsi/megaraid/megaraid_sas_fusion.h +1 -0
@@ -89,6 +89,7 @@ enum MR_RAID_FLAGS_IO_SUB_TYPE {#define MEGASAS_FP_CMD_LEN 16#define MEGASAS_FUSION_IN_RESET 0 +#define MEGASAS_FUSION_OCR_NOT_POSSIBLE 1#define RAID_1_PEER_CMDS 2#define JBOD_MAPS_COUNT 2#define MEGASAS_REDUCE_QD_COUNT 64
Greg Kroah-Hartman
maintainerPATCH 69/367 ALSA: hda: Add Clevo W65_67SB the power_save blacklist
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit d8feb6080bb0c9f4d799a423d9453048fdd06990 upstream.
Using HDA power-saving on the Clevo W65_67SB causes the first 0.5 seconds of audio to be missing every time audio starts playing.
This commit adds the Clevo W65_67SB the power_save blacklist to avoid this issue.
--- sound/pci/hda/hda_intel.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/hda_intel.c +2 -0
@@ -2188,6 +2188,8 @@ static struct snd_pci_quirk power_save_b/* https://bugzilla.redhat.com/show_bug.cgi?id=1581607 */ SND_PCI_QUIRK (0x1558 ,0x3501 ,"Clevo W35xSS_370SS" ,0 ),/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ +SND_PCI_QUIRK (0x1558 ,0x6504 ,"Clevo W65_67SB" ,0 ), +/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ SND_PCI_QUIRK(0x1028, 0x0497, "Dell Precision T3600", 0),/* https://bugzilla.redhat.com/show_bug.cgi?id=1525104 */ /* Note the P55A-UD3 and Z87-D3HP share the subsys id for the HDA dev */
Greg Kroah-Hartman
maintainerPATCH 115/367 crypto: ccree - fix backlog memory leak
In reply to Greg Kroah-HartmanFrom: Gilad Ben-Yossef <[email protected]>
commit 4df2ef25b3b3618fd708ab484fe6239abd130fec upstream.
Fix brown paper bag bug of not releasing backlog list item buffer when backlog was consumed causing a memory leak when backlog is used.
--- drivers/crypto/ccree/cc_request_mgr.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ccree/cc_request_mgr.c +1 -0
@@ -404,6 +404,7 @@ static void cc_proc_backlog(struct cc_drspin_lock (&mgr->bl_lock);list_del (&bli->list); --mgr->bl_len; +kfree (bli); }spin_unlock (&mgr->bl_lock);
Greg Kroah-Hartman
maintainerPATCH 77/367 MIPS: syscalls: fix indentation of the SYSNR message
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 4f29ad200f7b40fbcf73cd65f95087535ba78380 upstream.
It also lacks a whitespace (copy'n'paste error?) and also messes up the output:
SYSHDR arch/mips/include/generated/uapi/asm/unistd_n32.h SYSHDR arch/mips/include/generated/uapi/asm/unistd_n64.h SYSHDR arch/mips/include/generated/uapi/asm/unistd_o32.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_n32.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_n64.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_o32.h
WRAP arch/mips/include/generated/uapi/asm/bpf_perf_event.h
WRAP arch/mips/include/generated/uapi/asm/ipcbuf.h
After:
SYSHDR arch/mips/include/generated/uapi/asm/unistd_n32.h SYSHDR arch/mips/include/generated/uapi/asm/unistd_n64.h SYSHDR arch/mips/include/generated/uapi/asm/unistd_o32.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_n32.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_n64.h SYSNR arch/mips/include/generated/uapi/asm/unistd_nr_o32.h WRAP arch/mips/include/generated/uapi/asm/bpf_perf_event.h WRAP arch/mips/include/generated/uapi/asm/ipcbuf.h
Present since day 0 of syscall table generation introduction for MIPS.
--- arch/mips/kernel/syscalls/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/syscalls/Makefile +1 -1
@@ -18,7 +18,7 @@ quiet_cmd_syshdr = SYSHDR $@ '$(syshdr_pfx_$(basetarget))' \ '$(syshdr_offset_$(basetarget))' -quiet_cmd_sysnr = SYSNR $@ +quiet_cmd_sysnr = SYSNR $@ cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@' \ '$(sysnr_abis_$(basetarget))' \ '$(sysnr_pfx_$(basetarget))' \
Greg Kroah-Hartman
maintainerPATCH 76/367 KVM: arm64: Only sign-extend MMIO up to register width
In reply to Greg Kroah-HartmanFrom: Christoffer Dall <[email protected]>
commit b6ae256afd32f96bec0117175b329d0dd617655e upstream.
On AArch64 you can do a sign-extended load to either a 32-bit or 64-bit register, and we should only sign extend the register up to the width of the register as specified in the operation (by using the 32-bit Wn or 64-bit Xn register specifier).
As it turns out, the architecture provides this decoding information in the SF ("Sixty-Four" -- how cute...) bit.
Let's take advantage of this with the usual 32-bit/64-bit header file dance and do the right thing on AArch64 hosts.
--- arch/arm/include/asm/kvm_emulate.h | 5 +++++ arch/arm/include/asm/kvm_mmio.h | 2 ++ arch/arm64/include/asm/kvm_emulate.h | 5 +++++ arch/arm64/include/asm/kvm_mmio.h | 6 ++---- virt/kvm/arm/mmio.c | 6 ++++++ 5 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/include/asm/kvm_emulate.h +5 -0
@@ -199,6 +199,11 @@ static inline bool kvm_vcpu_dabt_issext(return kvm_vcpu_get_hsr (vcpu) &HSR_SSE ; } +static inline bool kvm_vcpu_dabt_issf (const struct kvm_vcpu *vcpu) +{ +return false; +} +static inline int kvm_vcpu_dabt_get_rd (struct kvm_vcpu *vcpu) {return (kvm_vcpu_get_hsr (vcpu) &HSR_SRT_MASK ) >>HSR_SRT_SHIFT ;
arch/arm/include/asm/kvm_mmio.h +2 -0
@@ -14,6 +14,8 @@struct kvm_decode {unsigned long rt;bool sign_extend; +/* Not used on 32-bit arm */ +bool sixty_four; };void kvm_mmio_write_buf (void *buf,unsigned int len,unsigned long data);
arch/arm64/include/asm/kvm_emulate.h +5 -0
@@ -315,6 +315,11 @@ static inline bool kvm_vcpu_dabt_issext(return !!(kvm_vcpu_get_hsr (vcpu) & ESR_ELx_SSE); } +static inline bool kvm_vcpu_dabt_issf (const struct kvm_vcpu *vcpu) +{ +return !!(kvm_vcpu_get_hsr (vcpu) & ESR_ELx_SF); +} +static inline int kvm_vcpu_dabt_get_rd (const struct kvm_vcpu *vcpu) {return (kvm_vcpu_get_hsr (vcpu) & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT;
arch/arm64/include/asm/kvm_mmio.h +2 -4
@@ -10,13 +10,11 @@#include <linux/kvm_host.h> #include <asm/kvm_arm.h> -/* -* This is annoying. The mmio code requires this, even if we don't -* need any decoding. To be fixed. -*/ struct kvm_decode {unsigned long rt;bool sign_extend; +/* Witdth of the register accessed by the faulting instruction is 64-bits */ +bool sixty_four; };void kvm_mmio_write_buf (void *buf,unsigned int len,unsigned long data);
virt/kvm/arm/mmio.c +6 -0
@@ -105,6 +105,9 @@ int kvm_handle_mmio_return(struct kvm_vc data = (data ^ mask) - mask; } +if (!vcpu->arch.mmio_decode.sixty_four) + data = data &0xffffffff ; +trace_kvm_mmio (KVM_TRACE_MMIO_READ , len, run->mmio.phys_addr, &data); data =vcpu_data_host_to_guest (vcpu, data, len);
@@ -125,6 +128,7 @@ static int decode_hsr(struct kvm_vcpu *vunsigned long rt;int access_size;bool sign_extend; +bool sixty_four;if (kvm_vcpu_dabt_iss1tw (vcpu)) {/* page table accesses IO mem: tell guest to fix its TTBR */
@@ -138,11 +142,13 @@ static int decode_hsr(struct kvm_vcpu *v *is_write =kvm_vcpu_dabt_iswrite (vcpu); sign_extend =kvm_vcpu_dabt_issext (vcpu); + sixty_four =kvm_vcpu_dabt_issf (vcpu); rt =kvm_vcpu_dabt_get_rd (vcpu); *len = access_size; vcpu->arch.mmio_decode.sign_extend = sign_extend; vcpu->arch.mmio_decode.rt = rt; + vcpu->arch.mmio_decode.sixty_four = sixty_four;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 113/367 nvmem: core: fix memory abort in cleanup path
In reply to Greg Kroah-HartmanFrom: Bitan Biswas <[email protected]>
commit 16bb7abc4a6b9defffa294e4dc28383e62a1dbcf upstream.
nvmem_cell_info_to_nvmem_cell implementation has static allocation of name. nvmem_add_cells_from_of() call may return error and kfree name results in memory abort. Use kstrdup_const() and kfree_const calls for name alloc and free.
Unable to handle kernel paging request at virtual address ffffffffffe44888
Mem abort info:
ESR = 0x96000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
swapper pgtable: 64k pages, 48-bit VAs, pgdp=00000000815d0000 [ffffffffffe44888] pgd=0000000081d30803, pud=0000000081d30803, pmd=0000000000000000
Internal error: Oops: 96000006 [#1] PREEMPT SMP Modules linked in: CPU: 2 PID: 43 Comm: kworker/2:1 Tainted Hardware name: quill (DT) Workqueue: events deferred_probe_work_func pstate: a0000005 (NzCv daif -PAN -UAO) pc : kfree+0x38/0x278 lr : nvmem_cell_drop+0x68/0x80
sp : ffff80001284f9d0
x29: ffff80001284f9d0 x28: ffff0001f677e830
x27: ffff800011b0b000 x26: ffff0001c36e1008
x25: ffff8000112ad000 x24: ffff8000112c9000
x23: ffffffffffffffea x22: ffff800010adc7f0
x21: ffffffffffe44880 x20: ffff800011b0b068
x19: ffff80001122d380 x18: ffffffffffffffff
x17: 00000000d5cb4756 x16: 0000000070b193b8
x15: ffff8000119538c8 x14: 0720072007200720
x13: 07200720076e0772 x12: 07750762072d0765
x11: 0773077507660765 x10: 072f073007300730
x9 : 0730073207380733 x8 : 0000000000000151
x7 : 07660765072f0720 x6 : ffff0001c00e0f00
x5 : 0000000000000000 x4 : ffff0001c0b43800
x3 : ffff800011b0b068 x2 : 0000000000000000
x1 : 0000000000000000 x0 : ffffffdfffe00000
Call trace: kfree+0x38/0x278 nvmem_cell_drop+0x68/0x80 nvmem_device_remove_all_cells+0x2c/0x50 nvmem_register.part.9+0x520/0x628 devm_nvmem_register+0x48/0xa0 tegra_fuse_probe+0x140/0x1f0 platform_drv_probe+0x50/0xa0 really_probe+0x108/0x348 driver_probe_device+0x58/0x100 __device_attach_driver+0x90/0xb0 bus_for_each_drv+0x64/0xc8 __device_attach+0xd8/0x138 device_initial_probe+0x10/0x18 bus_probe_device+0x90/0x98 deferred_probe_work_func+0x74/0xb0 process_one_work+0x1e0/0x358 worker_thread+0x208/0x488 kthread+0x118/0x120 ret_from_fork+0x10/0x18 Code: d350feb5 f2dffbe0 aa1e03f6 8b151815 (f94006a0) ---[ end trace 49b1303c6b83198e ]---
--- drivers/nvmem/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/nvmem/core.c +5 -3
@@ -83,7 +83,7 @@ static void nvmem_cell_drop(struct nvmemlist_del (&cell->node);mutex_unlock (&nvmem_mutex);of_node_put (cell->np); -kfree (cell->name); +kfree_const (cell->name);kfree (cell); }
@@ -110,7 +110,9 @@ static int nvmem_cell_info_to_nvmem_cell cell->nvmem = nvmem; cell->offset = info->offset; cell->bytes = info->bytes; - cell->name = info->name; + cell->name =kstrdup_const (info->name,GFP_KERNEL ); +if (!cell->name) +return -ENOMEM ; cell->bit_offset = info->bit_offset; cell->nbits = info->nbits;
@@ -300,7 +302,7 @@ static int nvmem_add_cells_from_of(strucdev_err (dev,"cell %s unaligned to nvmem stride %d\n" , cell->name, nvmem->stride);/* Cells already added will be freed later. */ -kfree (cell->name); +kfree_const (cell->name);kfree (cell);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 110/367 hv_balloon: Balloon up according to request page number
In reply to Greg Kroah-HartmanFrom: Tianyu Lan <[email protected]>
commit d33c240d47dab4fd15123d9e73fc8810cbc6ed6a upstream.
Current code has assumption that balloon request memory size aligns with 2MB. But actually Hyper-V doesn't guarantee such alignment. When balloon driver receives non-aligned balloon request, it produces warning and balloon up more memory than requested in order to keep 2MB alignment. Remove the warning and balloon up memory according to actual requested memory size.
--- drivers/hv/hv_balloon.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hv/hv_balloon.c +3 -10
@@ -1217,10 +1217,7 @@ static unsigned int alloc_balloon_pages(unsigned int i, j;struct page *pg; -if (num_pages < alloc_unit) -return 0 ; - -for (i =0 ; (i * alloc_unit) < num_pages; i++) { +for (i =0 ; i < num_pages / alloc_unit; i++) {if (bl_resp->hdr.size +sizeof (union dm_mem_page_range ) >HV_HYP_PAGE_SIZE )return i * alloc_unit;
@@ -1258,7 +1255,7 @@ static unsigned int alloc_balloon_pages( } -return num_pages; +return i * alloc_unit; }static void balloon_up (struct work_struct *dummy)
@@ -1273,9 +1270,6 @@ static void balloon_up(struct work_struclong avail_pages;unsigned long floor; -/* The host balloons pages in 2M granularity. */ -WARN_ON_ONCE (num_pages %PAGES_IN_2M !=0 ); -/* * We will attempt 2M allocations. However, if we fail to * allocate 2M chunks, we will go back to PAGE_SIZE allocations.
@@ -1285,14 +1279,13 @@ static void balloon_up(struct work_struc avail_pages =si_mem_available (); floor =compute_balloon_floor (); -/* Refuse to balloon below the floor, keep the 2M granularity. */ +/* Refuse to balloon below the floor. */ if (avail_pages < num_pages || avail_pages - num_pages < floor) {pr_warn ("Balloon request will be partially fulfilled. %s\n" , avail_pages < num_pages ?"Not enough memory." :"Balloon floor reached." ); num_pages = avail_pages > floor ? (avail_pages - floor) :0 ; - num_pages -= num_pages %PAGES_IN_2M ; }while (!done) {
Greg Kroah-Hartman
maintainerPATCH 73/367 KVM: arm64: Correct PSTATE on exception entry
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
commit a425372e733177eb0779748956bc16c85167af48 upstream.
When KVM injects an exception into a guest, it generates the PSTATE value from scratch, configuring PSTATE.{M[4:0],DAIF}, and setting all other bits to zero.
This isn't correct, as the architecture specifies that some PSTATE bits are (conditionally) cleared or set upon an exception, and others are unchanged from the original context.
This patch adds logic to match the architectural behaviour. To make this simple to follow/audit/extend, documentation references are provided, and bits are configured in order of their layout in SPSR_EL2. This layout can be seen in the diagram on ARM DDI 0487E.a page C5-429.
--- arch/arm64/include/uapi/asm/ptrace.h | 1 arch/arm64/kvm/inject_fault.c | 70 ++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 5 deletions(-)
arch/arm64/include/uapi/asm/ptrace.h +1 -0
@@ -49,6 +49,7 @@#define PSR_SSBS_BIT 0x00001000#define PSR_PAN_BIT 0x00400000#define PSR_UAO_BIT 0x00800000 +#define PSR_DIT_BIT 0x01000000#define PSR_V_BIT 0x10000000#define PSR_C_BIT 0x20000000#define PSR_Z_BIT 0x40000000
arch/arm64/kvm/inject_fault.c +65 -5
94 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 107/367 ASoC: tegra: Revert 24 and 32 bit support
In reply to Greg Kroah-HartmanFrom: Jon Hunter <[email protected]>
commit 961b91a93ea27495022b2bdc3ca0f608f2c97b5f upstream.
Commit f3ee99087c8ca0ecfdd549ef5a94f557c42d5428 ("ASoC: tegra: Allow 24bit and 32bit samples") added 24-bit and 32-bit support for to the Tegra30 I2S driver. However, there are two additional commits that are also needed to get 24-bit and 32-bit support to work correctly. These commits are not yet applied because there are still some review comments that need to be addressed. With only this change applied, 24-bit and 32-bit support is advertised by the I2S driver, but it does not work and the audio is distorted. Therefore, revert this patch for now until the other changes are also ready.
Furthermore, a clock issue with 24-bit support has been identified with this change and so if we revert this now, we can also fix that in the updated version.
--- sound/soc/tegra/tegra30_i2s.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-)
sound/soc/tegra/tegra30_i2s.c +5 -20
@@ -127,7 +127,7 @@ static int tegra30_i2s_hw_params(structstruct device *dev = dai->dev;struct tegra30_i2s *i2s =snd_soc_dai_get_drvdata (dai);unsigned int mask, val, reg; -int ret, sample_size, srate, i2sclock, bitcnt, audio_bits; +int ret, sample_size, srate, i2sclock, bitcnt;struct tegra30_ahub_cif_conf cif_conf;if (params_channels (params) !=2 )
@@ -137,19 +137,8 @@ static int tegra30_i2s_hw_params(structswitch (params_format (params)) {case SNDRV_PCM_FORMAT_S16_LE : val =TEGRA30_I2S_CTRL_BIT_SIZE_16 ; - audio_bits =TEGRA30_AUDIOCIF_BITS_16 ; sample_size =16 ;break ; -case SNDRV_PCM_FORMAT_S24_LE : - val =TEGRA30_I2S_CTRL_BIT_SIZE_24 ; - audio_bits =TEGRA30_AUDIOCIF_BITS_24 ; - sample_size =24 ; -break ; -case SNDRV_PCM_FORMAT_S32_LE : - val =TEGRA30_I2S_CTRL_BIT_SIZE_32 ; - audio_bits =TEGRA30_AUDIOCIF_BITS_32 ; - sample_size =32 ; -break ;default :return -EINVAL ; }
@@ -181,8 +170,8 @@ static int tegra30_i2s_hw_params(struct cif_conf.threshold =0 ; cif_conf.audio_channels =2 ; cif_conf.client_channels =2 ; - cif_conf.audio_bits = audio_bits; - cif_conf.client_bits = audio_bits; + cif_conf.audio_bits =TEGRA30_AUDIOCIF_BITS_16 ; + cif_conf.client_bits =TEGRA30_AUDIOCIF_BITS_16 ; cif_conf.expand =0 ; cif_conf.stereo_conv =0 ; cif_conf.replicate =0 ;
@@ -317,18 +306,14 @@ static const struct snd_soc_dai_driver t .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats =SNDRV_PCM_FMTBIT_S32_LE | -SNDRV_PCM_FMTBIT_S24_LE | - SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .capture = { .stream_name = "Capture", .channels_min = 2, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_96000, - .formats =SNDRV_PCM_FMTBIT_S32_LE | -SNDRV_PCM_FMTBIT_S24_LE | - SNDRV_PCM_FMTBIT_S16_LE, + .formats = SNDRV_PCM_FMTBIT_S16_LE, }, .ops = &tegra30_i2s_dai_ops, .symmetric_rates = 1,
Greg Kroah-Hartman
maintainerPATCH 105/367 ubifs: Fix deadlock in concurrent bulk-read and writepage
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit f5de5b83303e61b1f3fb09bd77ce3ac2d7a475f2 upstream.
In ubifs, concurrent execution of writepage and bulk read on the same file may cause ABBA deadlock, for example (Reproduce method see Link):
Process A(Bulk-read starts from page4) Process B(write page4 back)
vfs_read wb_workfn or fsync ... ... generic_file_buffered_read write_cache_pages
ubifs_readpage LOCK(page4)
ubifs_bulk_read ubifs_writepage
LOCK(ui->ui_mutex) ubifs_write_inode
ubifs_do_bulk_read LOCK(ui->ui_mutex)
find_or_create_page(alloc page4) ↑
LOCK(page4) <-- ABBA deadlock occurs!
In order to ensure the serialization execution of bulk read, we can't remove the big lock 'ui->ui_mutex' in ubifs_bulk_read(). Instead, we allow ubifs_do_bulk_read() to lock page failed by replacing find_or_create_page(FGP_LOCK) with pagecache_get_page(FGP_LOCK | FGP_NOWAIT).
--- fs/ubifs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ubifs/file.c +3 -1
@@ -786,7 +786,9 @@ static int ubifs_do_bulk_read(struct ubiif (page_offset > end_index)break ; - page =find_or_create_page (mapping, page_offset, ra_gfp_mask); + page =pagecache_get_page (mapping, page_offset, +FGP_LOCK |FGP_ACCESSED |FGP_CREAT |FGP_NOWAIT , + ra_gfp_mask);if (!page)break ;if (!PageUptodate (page))
Greg Kroah-Hartman
maintainerPATCH 101/367 fscrypt: dont print name of busy file when removing key
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 13a10da94615d81087e718517794f2868a8b3fab upstream.
When an encryption key can't be fully removed due to file(s) protected by it still being in-use, we shouldn't really print the path to one of these files to the kernel log, since parts of this path are likely to be encrypted on-disk, and (depending on how the system is set up) the confidentiality of this path might be lost by printing it to the log.
This is a trade-off: a single file path often doesn't matter at all, especially if it's a directory; the kernel log might still be protected in some way; and I had originally hoped that any "inode(s) still busy" bugs (which are security weaknesses in their own right) would be quickly fixed and that to do so it would be super helpful to always know the file path and not have to run 'find dir -inum $inum' after the fact.
But in practice, these bugs can be hard to fix (e.g. due to asynchronous process killing that is difficult to eliminate, for performance reasons), and also not tied to specific files, so knowing a file path doesn't necessarily help.
So to be safe, for now let's just show the inode number, not the path. If someone really wants to know a path they can use 'find -inum'.
--- fs/crypto/keyring.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
fs/crypto/keyring.c +2 -13
@@ -666,9 +666,6 @@ static int check_for_busy_inodes(structstruct list_head *pos;size_t busy_count =0 ;unsigned long ino; -struct dentry *dentry; -char _path[256 ]; -char *path =NULL ;spin_lock (&mk->mk_decrypted_inodes_lock);
@@ -687,22 +684,14 @@ static int check_for_busy_inodes(struct struct fscrypt_info, ci_master_key_link)->ci_inode; ino = inode->i_ino; - dentry =d_find_alias (inode); }spin_unlock (&mk->mk_decrypted_inodes_lock); -if (dentry) { - path =dentry_path (dentry, _path,sizeof (_path)); -dput (dentry); - } -if (IS_ERR_OR_NULL (path)) - path ="(unknown)" ; -fscrypt_warn (NULL , -"%s: %zu inode(s) still busy after removing key with %s %*phN, including ino %lu (%s)" , +"%s: %zu inode(s) still busy after removing key with %s %*phN, including ino %lu" , sb->s_id, busy_count,master_key_spec_type (&mk->mk_spec),master_key_spec_len (&mk->mk_spec), (u8 *)&mk->mk_spec.u, - ino, path); + ino);return -EBUSY ; }
Greg Kroah-Hartman
maintainerPATCH 99/367 smb3: fix default permissions on new files when mounting with modefromsid
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit 643fbceef48e5b22bf8e0905f903e908b5d2ba69 upstream.
When mounting with "modefromsid" mount parm most servers will require that some default permissions are given to users in the ACL on newly created files, files created with the new 'sd context' - when passing in an sd context on create, permissions are not inherited from the parent directory, so in addition to the ACE with the special SID which contains the mode, we also must pass in an ACE allowing users to access the file (GENERIC_ALL for authenticated users seemed like a reasonable default, although later we could allow a mount option or config switch to make it GENERIC_ALL for EVERYONE special sid).
--- fs/cifs/cifsacl.c | 20 ++++++++++++++++++++ fs/cifs/cifsproto.h | 1 + fs/cifs/smb2pdu.c | 11 ++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-)
fs/cifs/cifsacl.c +20 -0
@@ -802,6 +802,26 @@ static void parse_dacl(struct cifs_acl *return ; } +unsigned int setup_authusers_ACE (struct cifs_ace *pntace) +{ +int i; +unsigned int ace_size =20 ; + + pntace->type =ACCESS_ALLOWED_ACE_TYPE ; + pntace->flags =0x0 ; + pntace->access_req =cpu_to_le32 (GENERIC_ALL ); + pntace->sid.num_subauth =1 ; + pntace->sid.revision =1 ; +for (i =0 ; i <NUM_AUTHS ; i++) + pntace->sid.authority[i] = sid_authusers.authority[i]; + + pntace->sid.sub_auth[0 ] = sid_authusers.sub_auth[0 ]; + +/* size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth*4) */ + pntace->size =cpu_to_le16 (ace_size); +return ace_size; +} +/* * Fill in the special SID based on the mode. See * http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx
fs/cifs/cifsproto.h +1 -0
@@ -213,6 +213,7 @@ extern struct cifs_ntsd *get_cifs_acl_by const struct cifs_fid *, u32 *);extern int set_cifs_acl (struct cifs_ntsd *,__u32 ,struct inode *,const char *,int ); +extern unsigned int setup_authusers_ACE (struct cifs_ace *pace);extern unsigned int setup_special_mode_ACE (struct cifs_ace *pace,__u64 nmode);extern void dequeue_mid (struct mid_q_entry *mid,bool malformed);
fs/cifs/smb2pdu.c +8 -3
@@ -2199,13 +2199,14 @@ create_sd_buf(umode_t mode, unsigned intstruct cifs_ace *pace;unsigned int sdlen, acelen; - *len =roundup (sizeof (struct crt_sd_ctxt ) +sizeof (struct cifs_ace ),8 ); + *len =roundup (sizeof (struct crt_sd_ctxt ) +sizeof (struct cifs_ace ) *2 , +8 ); buf =kzalloc (*len,GFP_KERNEL );if (buf ==NULL )return buf; sdlen =sizeof (struct smb3_sd ) +sizeof (struct smb3_acl ) + -sizeof (struct cifs_ace ); +2 *sizeof (struct cifs_ace ); buf->ccontext.DataOffset =cpu_to_le16 (offsetof (struct crt_sd_ctxt , sd));
@@ -2232,8 +2233,12 @@ create_sd_buf(umode_t mode, unsigned int/* create one ACE to hold the mode embedded in reserved special SID */ pace = (struct cifs_ace *)(sizeof (struct crt_sd_ctxt ) + (char *)buf); acelen =setup_special_mode_ACE (pace, (__u64 )mode); +/* and one more ACE to allow access for authenticated users */ + pace = (struct cifs_ace *)(acelen + (sizeof (struct crt_sd_ctxt ) + + (char *)buf)); + acelen +=setup_authusers_ACE (pace); buf->acl.AclSize =cpu_to_le16 (sizeof (struct cifs_acl ) + acelen); - buf->acl.AceCount =cpu_to_le16 (1 ); + buf->acl.AceCount =cpu_to_le16 (2 );return buf; }
Greg Kroah-Hartman
maintainerPATCH 72/367 arm64: acpi: fix DAIF manipulation with pNMI
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
commit e533dbe9dcb199bb637a2c465f3a6e70564994fe upstream.
Since commit:
d44f1b8dd7e66d80 ("arm64: KVM/mm: Move SEA handling behind a single 'claim' interface")
... the top-level APEI SEA handler has the shape:
1. current_flags = arch_local_save_flags()
2. local_daif_restore(DAIF_ERRCTX)
3. <GHES handler>
4. local_daif_restore(current_flags)
However, since commit:
4a503217ce37e1f4 ("arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking")
... when pseudo-NMIs (pNMIs) are in use, arch_local_save_flags() will save the PMR value rather than the DAIF flags.
The combination of these two commits means that the APEI SEA handler will erroneously attempt to restore the PMR value into DAIF. Fix this by factoring local_daif_save_flags() out of local_daif_save(), so that we can consistently save DAIF in step #1, regardless of whether pNMIs are in use.
Both commits were introduced concurrently in v5.0.
--- arch/arm64/include/asm/daifflags.h | 11 ++++++++++- arch/arm64/kernel/acpi.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-)
arch/arm64/include/asm/daifflags.h +10 -1
@@ -38,7 +38,7 @@ static inline void local_daif_mask(void)trace_hardirqs_off (); } -static inline unsigned long local_daif_save (void ) +static inline unsigned long local_daif_save_flags (void ) {unsigned long flags;
@@ -50,6 +50,15 @@ static inline unsigned long local_daif_s flags |=PSR_I_BIT ; } +return flags; +} + +static inline unsigned long local_daif_save (void ) +{ +unsigned long flags; + + flags =local_daif_save_flags (); +local_daif_mask ();return flags;
arch/arm64/kernel/acpi.c +1 -1
@@ -274,7 +274,7 @@ int apei_claim_sea(struct pt_regs *regs)if (!IS_ENABLED (CONFIG_ACPI_APEI_GHES ))return err; - current_flags =arch_local_save_flags (); + current_flags =local_daif_save_flags ();/* * SEA can interrupt SError, mask it and describe this as an NMI so
Greg Kroah-Hartman
maintainerPATCH 96/367 ACPI / battery: Deal with design or full capacity being reported as -1
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit cc99f0ad52467028cb1251160f23ad4bb65baf20 upstream.
Commit b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity") added support for some (broken) devices which always report 0 for both design- and full_charge-capacity.
This assumes that if the capacity is not being reported it is 0. The ThunderSoft TS178 tablet's _BIX implementation falsifies this assumption. It reports ACPI_BATTERY_VALUE_UNKNOWN (-1) as full_charge_capacity, which we treat as a valid value which causes several problems.
This commit fixes this by adding a new ACPI_BATTERY_CAPACITY_VALID() helper which checks that the value is not 0 and not -1; and using this whenever we need to test if either design_capacity or full_charge_capacity is valid.
--- drivers/acpi/battery.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/acpi/battery.c +12 -7
@@ -38,6 +38,8 @@#define PREFIX "ACPI: "#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF +#define ACPI_BATTERY_CAPACITY_VALID (capacity) \ + ((capacity) != 0 && (capacity) != ACPI_BATTERY_VALUE_UNKNOWN)#define ACPI_BATTERY_DEVICE_NAME "Battery"
@@ -192,7 +194,8 @@ static int acpi_battery_is_charged(strucstatic bool acpi_battery_is_degraded (struct acpi_battery *battery) { -return battery->full_charge_capacity && battery->design_capacity && +return ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity) && +ACPI_BATTERY_CAPACITY_VALID (battery->design_capacity) && battery->full_charge_capacity < battery->design_capacity; }
@@ -263,14 +266,14 @@ static int acpi_battery_get_property(strbreak ;case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN :case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN : -if (battery->design_capacity ==ACPI_BATTERY_VALUE_UNKNOWN ) +if (!ACPI_BATTERY_CAPACITY_VALID (battery->design_capacity)) ret = -ENODEV ;else val->intval = battery->design_capacity *1000 ;break ;case POWER_SUPPLY_PROP_CHARGE_FULL :case POWER_SUPPLY_PROP_ENERGY_FULL : -if (battery->full_charge_capacity ==ACPI_BATTERY_VALUE_UNKNOWN ) +if (!ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity)) ret = -ENODEV ;else val->intval = battery->full_charge_capacity *1000 ;
@@ -283,11 +286,12 @@ static int acpi_battery_get_property(str val->intval = battery->capacity_now *1000 ;break ;case POWER_SUPPLY_PROP_CAPACITY : -if (battery->capacity_now && battery->full_charge_capacity) +if (battery->capacity_now ==ACPI_BATTERY_VALUE_UNKNOWN || + !ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity)) + ret = -ENODEV ; +else val->intval = battery->capacity_now *100 / battery->full_charge_capacity; -else - val->intval =0 ;break ;case POWER_SUPPLY_PROP_CAPACITY_LEVEL :if (battery->state &ACPI_BATTERY_STATE_CRITICAL )
@@ -799,7 +803,8 @@ static int sysfs_add_battery(struct acpi battery->bat_desc.properties = charge_battery_props; battery->bat_desc.num_properties =ARRAY_SIZE (charge_battery_props); - }else if (battery->full_charge_capacity ==0 ) { + }else if (!ACPI_BATTERY_CAPACITY_VALID ( + battery->full_charge_capacity)) { battery->bat_desc.properties = energy_battery_full_cap_broken_props; battery->bat_desc.num_properties =
Greg Kroah-Hartman
maintainerPATCH 100/367 alarmtimer: Unregister wakeup source when module get fails
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
commit 6b6d188aae79a630957aefd88ff5c42af6553ee3 upstream.
The alarmtimer_rtc_add_device() function creates a wakeup source and then tries to grab a module reference. If that fails the function returns early with an error code, but fails to remove the wakeup source.
Cleanup this exit path so there is no dangling wakeup source, which is named 'alarmtime' left allocated which will conflict with another RTC device that may be registered later.
--- kernel/time/alarmtimer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/time/alarmtimer.c +5 -3
@@ -88,6 +88,7 @@ static int alarmtimer_rtc_add_device(strunsigned long flags;struct rtc_device *rtc =to_rtc_device (dev);struct wakeup_source *__ws; +int ret =0 ;if (rtcdev)return -EBUSY ;
@@ -102,8 +103,8 @@ static int alarmtimer_rtc_add_device(strspin_lock_irqsave (&rtcdev_lock, flags);if (!rtcdev) {if (!try_module_get (rtc->owner)) { -spin_unlock_irqrestore (&rtcdev_lock, flags); -return -1 ; + ret =-1 ; + goto unlock; } rtcdev = rtc;
@@ -112,11 +113,12 @@ static int alarmtimer_rtc_add_device(str ws = __ws; __ws =NULL ; } +unlock:spin_unlock_irqrestore (&rtcdev_lock, flags);wakeup_source_unregister (__ws); -return 0 ; +return ret; }static inline void alarmtimer_rtc_timer_init (void )
Greg Kroah-Hartman
maintainerPATCH 98/367 ACPI / battery: Deal better with neither design nor full capacity not being reported
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit ff3154d1d89a2343fd5f82e65bc0cf1d4e6659b3 upstream.
Commit b41901a2cf06 ("ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity") added support for some (broken) devices which always report 0 for both design_capacity and full_charge_capacity.
Since the device that commit was written as a fix for is not reporting any form of "full" capacity we cannot calculate the value for the POWER_SUPPLY_PROP_CAPACITY, this is worked around by using an alternative array of available properties which does not contain this property.
This is necessary because userspace (upower) treats us returning -ENODEV as 0 and then typically will trigger an emergency shutdown because of that. Userspace does not do this if the capacity sysfs attribute is not present at all.
There are two potential problems with that commit:
1) It assumes that both full_charge- and design-capacity are broken at the same time and only checks if full_charge- is broken.
2) It assumes that this only ever happens for devices which report energy units rather then charge units.
This commit fixes both issues by only using the alternative array of available properties if both full_charge- and design-capacity are broken and by also adding an alternative array of available properties for devices using mA units.
--- drivers/acpi/battery.c | 51 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-)
drivers/acpi/battery.c +39 -12
@@ -342,6 +342,20 @@ static enum power_supply_property charge POWER_SUPPLY_PROP_SERIAL_NUMBER, }; +static enum power_supply_property charge_battery_full_cap_broken_props[] = { +POWER_SUPPLY_PROP_STATUS , +POWER_SUPPLY_PROP_PRESENT , +POWER_SUPPLY_PROP_TECHNOLOGY , +POWER_SUPPLY_PROP_CYCLE_COUNT , +POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN , +POWER_SUPPLY_PROP_VOLTAGE_NOW , +POWER_SUPPLY_PROP_CURRENT_NOW , +POWER_SUPPLY_PROP_CHARGE_NOW , +POWER_SUPPLY_PROP_MODEL_NAME , +POWER_SUPPLY_PROP_MANUFACTURER , +POWER_SUPPLY_PROP_SERIAL_NUMBER , +}; +static enum power_supply_property energy_battery_props[] = {POWER_SUPPLY_PROP_STATUS ,POWER_SUPPLY_PROP_PRESENT ,
@@ -803,21 +817,34 @@ static void __exit battery_hook_exit(voistatic int sysfs_add_battery (struct acpi_battery *battery) {struct power_supply_config psy_cfg = { .drv_data = battery, }; +bool full_cap_broken = false; + +if (!ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity) && + !ACPI_BATTERY_CAPACITY_VALID (battery->design_capacity)) + full_cap_broken = true;if (battery->power_unit ==ACPI_BATTERY_POWER_UNIT_MA ) { - battery->bat_desc.properties = charge_battery_props; - battery->bat_desc.num_properties = -ARRAY_SIZE (charge_battery_props); - }else if (!ACPI_BATTERY_CAPACITY_VALID ( - battery->full_charge_capacity)) { - battery->bat_desc.properties = - energy_battery_full_cap_broken_props; - battery->bat_desc.num_properties = -ARRAY_SIZE (energy_battery_full_cap_broken_props); +if (full_cap_broken) { + battery->bat_desc.properties = + charge_battery_full_cap_broken_props; + battery->bat_desc.num_properties = +ARRAY_SIZE (charge_battery_full_cap_broken_props); + }else { + battery->bat_desc.properties = charge_battery_props; + battery->bat_desc.num_properties = +ARRAY_SIZE (charge_battery_props); + } }else { - battery->bat_desc.properties = energy_battery_props; - battery->bat_desc.num_properties = -ARRAY_SIZE (energy_battery_props); +if (full_cap_broken) { + battery->bat_desc.properties = + energy_battery_full_cap_broken_props; + battery->bat_desc.num_properties = +ARRAY_SIZE (energy_battery_full_cap_broken_props); + }else { + battery->bat_desc.properties = energy_battery_props; + battery->bat_desc.num_properties = +ARRAY_SIZE (energy_battery_props); + } } battery->bat_desc.name =acpi_device_bid (battery->device);
Greg Kroah-Hartman
maintainerPATCH 97/367 ACPI / battery: Use design-cap for capacity calculations if full-cap is not available
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 5b74d1d16e2f5753fcbdecd6771b2d8370dda414 upstream.
The ThunderSoft TS178 tablet's _BIX implementation reports design_capacity but not full_charge_capacity.
Before this commit this would cause us to return -ENODEV for the capacity attribute, which userspace does not like. Specifically upower does this:
if (sysfs_file_exists (native_path, "capacity")) {
percentage = sysfs_get_double (native_path, "capacity");Where the sysfs_get_double() helper returns 0 when we return -ENODEV, so the battery always reads 0% if we return -ENODEV.
This commit fixes this by using the design-capacity instead of the full-charge-capacity when the full-charge-capacity is not available.
--- drivers/acpi/battery.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/acpi/battery.c +8 -3
@@ -217,7 +217,7 @@ static int acpi_battery_get_property(strenum power_supply_property psp, union power_supply_propval *val) { - int ret = 0; + int full_capacity = ACPI_BATTERY_VALUE_UNKNOWN, ret = 0;struct acpi_battery *battery =to_acpi_battery (psy);if (acpi_battery_present (battery)) {
@@ -286,12 +286,17 @@ static int acpi_battery_get_property(str val->intval = battery->capacity_now *1000 ;break ;case POWER_SUPPLY_PROP_CAPACITY : +if (ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity)) + full_capacity = battery->full_charge_capacity; +else if (ACPI_BATTERY_CAPACITY_VALID (battery->design_capacity)) + full_capacity = battery->design_capacity; +if (battery->capacity_now ==ACPI_BATTERY_VALUE_UNKNOWN || - !ACPI_BATTERY_CAPACITY_VALID (battery->full_charge_capacity)) + full_capacity ==ACPI_BATTERY_VALUE_UNKNOWN ) ret = -ENODEV ;else val->intval = battery->capacity_now *100 / - battery->full_charge_capacity; + full_capacity;break ;case POWER_SUPPLY_PROP_CAPACITY_LEVEL :if (battery->state &ACPI_BATTERY_STATE_CRITICAL )
Greg Kroah-Hartman
maintainerPATCH 95/367 ACPI: video: Do not export a non working backlight interface on MSI MS-7721 boards
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit d21a91629f4b8e794fc4c0e0c17c85cedf1d806c upstream.
Despite our heuristics to not wrongly export a non working ACPI backlight interface on desktop machines, we still end up exporting one on desktops using a motherboard from the MSI MS-7721 series.
I've looked at improving the heuristics, but in this case a quirk seems to be the only way to solve this.
While at it also add a comment to separate the video_detect_force_none entries in the video_detect_dmi_table from other type of entries, as we already do for the other entry types.
--- drivers/acpi/video_detect.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/acpi/video_detect.c +13 -0
@@ -336,6 +336,11 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_PRODUCT_NAME, "Precision 7510"), }, }, + +/* +* Desktops which falsely report a backlight and which our heuristics +* for this do not catch. +*/ { .callback = video_detect_force_none, .ident = "Dell OptiPlex 9020M",
@@ -344,6 +349,14 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 9020M"), }, }, + { + .callback = video_detect_force_none, + .ident = "MSI MS-7721", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "MSI"), + DMI_MATCH(DMI_PRODUCT_NAME, "MS-7721"), + }, + }, { }, };
Greg Kroah-Hartman
maintainerPATCH 93/367 PCI: keystone: Fix error handling when "num-viewport" DT property is not populated
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
commit b0de922af53eede340986a2d05b6cd4b6d6efa43 upstream.
Fix error handling when "num-viewport" DT property is not populated.
--- drivers/pci/controller/dwc/pci-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-keystone.c +1 -1
@@ -1354,7 +1354,7 @@ static int __init ks_pcie_probe(struct p ret =of_property_read_u32 (np,"num-viewport" , &num_viewport);if (ret <0 ) {dev_err (dev,"unable to read *num-viewport* property\n" ); -return ret; + goto err_get_sync; }/*
Greg Kroah-Hartman
maintainerPATCH 91/367 PCI: keystone: Fix outbound region mapping
In reply to Greg Kroah-HartmanFrom: Yurii Monakov <[email protected]>
commit 2d0c3fbe43fa0e6fcb7a6c755c5f4cd702c0d2f4 upstream.
The Keystone outbound Address Translation Unit (ATU) maps PCI MMIO space in 8 MB windows. When programming the ATU windows, we previously incremented the starting address by 8, not 8 MB, so all the windows were mapped to the first 8 MB. Therefore, only 8 MB of MMIO space was accessible.
Update the loop so it increments the starting address by 8 MB, not 8, so more MMIO space is accessible.
--- drivers/pci/controller/dwc/pci-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-keystone.c +1 -1
@@ -422,7 +422,7 @@ static void ks_pcie_setup_rc_app_regs(st lower_32_bits(start) | OB_ENABLEN);ks_pcie_app_writel (ks_pcie,OB_OFFSET_HI (i),upper_32_bits (start)); - start +=OB_WIN_SIZE ; + start +=OB_WIN_SIZE *SZ_1M ; } val =ks_pcie_app_readl (ks_pcie,CMD_STATUS );
Greg Kroah-Hartman
maintainerPATCH 71/367 ALSA: hda - Fix DP-MST support for NVIDIA codecs
In reply to Greg Kroah-HartmanFrom: Nikhil Mahale <[email protected]>
commit c7e661a1c2ae98a4754db6a85fc686b4a89322ad upstream.
If dyn_pcm_assign is set, different jack objects are being created for pcm and pins.
If dyn_pcm_assign is set, generic_hdmi_build_jack() calls into add_hdmi_jack_kctl() to create and track separate jack object for pcm. Like sync_eld_via_acomp(), hdmi_present_sense_via_verbs() also need to report status change of the pcm jack.
Rename pin_idx_to_jack() to pin_idx_to_pcm_jack(). Update hdmi_present_sense_via_verbs() to report plug state of pcm jack object. Unlike sync_eld_via_acomp(), for !acomp drivers the pcm jack's plug state must be consistent with plug state of pin's jack.
--- sound/pci/hda/patch_hdmi.c | 94 ++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 31 deletions(-)
sound/pci/hda/patch_hdmi.c +63 -31
@@ -1547,6 +1547,34 @@ static bool update_eld(struct hda_codecreturn eld_changed; } +static struct snd_jack *pin_idx_to_pcm_jack (struct hda_codec *codec, +struct hdmi_spec_per_pin *per_pin) +{ +struct hdmi_spec *spec = codec->spec; +struct snd_jack *jack =NULL ; +struct hda_jack_tbl *jack_tbl; + +/* if !dyn_pcm_assign, get jack from hda_jack_tbl +* in !dyn_pcm_assign case, spec->pcm_rec[].jack is not +* NULL even after snd_hda_jack_tbl_clear() is called to +* free snd_jack. This may cause access invalid memory +* when calling snd_jack_report +*/ +if (per_pin->pcm_idx >=0 && spec->dyn_pcm_assign) { + jack = spec->pcm_rec[per_pin->pcm_idx].jack; + }else if (!spec->dyn_pcm_assign) { +/* +* jack tbl doesn't support DP MST +* DP MST will use dyn_pcm_assign, +* so DP MST will never come here +*/ + jack_tbl =snd_hda_jack_tbl_get_mst (codec, per_pin->pin_nid, + per_pin->dev_id); +if (jack_tbl) + jack = jack_tbl->jack; + } +return jack; +}/* update ELD and jack state via HD-audio verbs */ static bool hdmi_present_sense_via_verbs (struct hdmi_spec_per_pin *per_pin,int repoll)
@@ -1568,6 +1596,7 @@ static bool hdmi_present_sense_via_verbsint present;bool ret;bool do_repoll = false; +struct snd_jack *pcm_jack =NULL ; present =snd_hda_jack_pin_sense (codec, pin_nid, dev_id);
@@ -1595,10 +1624,19 @@ static bool hdmi_present_sense_via_verbs do_repoll = true; } -if (do_repoll) +if (do_repoll) {schedule_delayed_work (&per_pin->work,msecs_to_jiffies (300 )); -else + }else { +/* +* pcm_idx >=0 before update_eld() means it is in monitor +* disconnected event. Jack must be fetched before +* update_eld(). +*/ + pcm_jack =pin_idx_to_pcm_jack (codec, per_pin);update_eld (codec, per_pin, eld); +if (!pcm_jack) + pcm_jack =pin_idx_to_pcm_jack (codec, per_pin); + } ret = !repoll || !eld->monitor_present || eld->eld_valid;
@@ -1607,38 +1645,32 @@ static bool hdmi_present_sense_via_verbs jack->block_report = !ret; jack->pin_sense = (eld->monitor_present && eld->eld_valid) ?AC_PINSENSE_PRESENCE :0 ; - } -mutex_unlock (&per_pin->lock); -return ret; -} -static struct snd_jack *pin_idx_to_jack (struct hda_codec *codec, -struct hdmi_spec_per_pin *per_pin) -{ -struct hdmi_spec *spec = codec->spec; -struct snd_jack *jack =NULL ; -struct hda_jack_tbl *jack_tbl; +if (spec->dyn_pcm_assign && pcm_jack && !do_repoll) { +int state =0 ; + +if (jack->pin_sense &AC_PINSENSE_PRESENCE ) + state =SND_JACK_AVOUT ; +snd_jack_report (pcm_jack, state); + } -/* if !dyn_pcm_assign, get jack from hda_jack_tbl -* in !dyn_pcm_assign case, spec->pcm_rec[].jack is not -* NULL even after snd_hda_jack_tbl_clear() is called to -* free snd_jack. This may cause access invalid memory -* when calling snd_jack_report -*/ -if (per_pin->pcm_idx >=0 && spec->dyn_pcm_assign) - jack = spec->pcm_rec[per_pin->pcm_idx].jack; -else if (!spec->dyn_pcm_assign) {/* -* jack tbl doesn't support DP MST -* DP MST will use dyn_pcm_assign, -* so DP MST will never come here +* snd_hda_jack_pin_sense() call at the beginning of this +* function, updates jack->pins_sense and clears +* jack->jack_dirty, therefore snd_hda_jack_report_sync() will +* not override the jack->pin_sense. +* +* snd_hda_jack_report_sync() is superfluous for dyn_pcm_assign +* case. The jack->pin_sense update was already performed, and +* hda_jack->jack is NULL for dyn_pcm_assign. +* +* Don't call snd_hda_jack_report_sync() for +* dyn_pcm_assign. */ - jack_tbl =snd_hda_jack_tbl_get_mst (codec, per_pin->pin_nid, - per_pin->dev_id); -if (jack_tbl) - jack = jack_tbl->jack; + ret = ret && !spec->dyn_pcm_assign; } -return jack; +mutex_unlock (&per_pin->lock); +return ret; }/* update ELD and jack state via audio component */
@@ -1674,10 +1706,10 @@ static void sync_eld_via_acomp(struct hd/* pcm_idx >=0 before update_eld() means it is in monitor * disconnected event. Jack must be fetched before update_eld() */ - jack =pin_idx_to_jack (codec, per_pin); + jack =pin_idx_to_pcm_jack (codec, per_pin); changed =update_eld (codec, per_pin, eld);if (jack ==NULL ) - jack =pin_idx_to_jack (codec, per_pin); + jack =pin_idx_to_pcm_jack (codec, per_pin);if (changed && jack) snd_jack_report(jack, (eld->monitor_present && eld->eld_valid) ?
Greg Kroah-Hartman
maintainerPATCH 88/367 powerpc/32s: Fix CPU wake-up from sleep mode
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 9933819099c4600b41a042f27a074470a43cf6b9 upstream.
Commit f7354ccac844 ("powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU") broke the CPU wake-up from sleep mode (i.e. when _TLF_SLEEPING is set) by delaying the tovirt(r2, r2).
This is because r2 is not restored by fast_exception_return. It used to work (by chance ?) because CPU wake-up interrupt never comes from user, so r2 is expected to point to 'current' on return.
Commit e2fb9f544431 ("powerpc/32: Prepare for Kernel Userspace Access Protection") broke it even more by clobbering r0 which is not restored by fast_exception_return either.
Use r6 instead of r0. This is possible because r3-r6 are restored by fast_exception_return and only r3-r5 are used for exception arguments.
For r2 it could be converted back to virtual address, but stay on the safe side and restore it from the stack instead. It should be live in the cache at that moment, so loading from the stack should make no difference compared to converting it from phys to virt.
--- arch/powerpc/kernel/entry_32.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/entry_32.S +2 -1
@@ -179,7 +179,7 @@ transfer_to_handler: 2: /* if from kernel, check interrupted DOZE/NAP mode and * check for stack overflow */ - kuap_save_and_lock r11, r12, r9, r2, r0 + kuap_save_and_lock r11, r12, r9, r2, r6 addi r2, r12, -THREAD lwz r9,KSP_LIMIT(r12) cmplw r1,r9 /* if r1 <= ksp_limit */
@@ -284,6 +284,7 @@ reenable_mmu: rlwinm r9,r9,0,~MSR_EE lwz r12,_LINK(r11) /* and return to address in LR */ kuap_restore r11, r2, r3, r4, r5 + lwz r2, GPR2(r11) b fast_exception_return #endif
Greg Kroah-Hartman
maintainerPATCH 87/367 powerpc/32s: Fix bad_kuap_fault()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 6ec20aa2e510b6297906c45f009aa08b2d97269a upstream.
At the moment, bad_kuap_fault() reports a fault only if a bad access to userspace occurred while access to userspace was not granted.
But if a fault occurs for a write outside the allowed userspace segment(s) that have been unlocked, bad_kuap_fault() fails to detect it and the kernel loops forever in do_page_fault().
Fix it by checking that the accessed address is within the allowed range.
--- arch/powerpc/include/asm/book3s/32/kup.h | 9 +++++++-- arch/powerpc/include/asm/book3s/64/kup-radix.h | 3 ++- arch/powerpc/include/asm/kup.h | 6 +++++- arch/powerpc/include/asm/nohash/32/kup-8xx.h | 3 ++- arch/powerpc/mm/fault.c | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/book3s/32/kup.h +7 -2
@@ -131,12 +131,17 @@ static inline void prevent_user_access(v kuap_update_sr(mfsrin(addr) | SR_KS, addr, end); /* set Ks */ } -static inline bool bad_kuap_fault (struct pt_regs *regs,bool is_write) +static inline bool +bad_kuap_fault (struct pt_regs *regs,unsigned long address,bool is_write) { +unsigned long begin = regs->kuap &0xf0000000 ; +unsigned long end = regs->kuap <<28 ; +if (!is_write)return false; -return WARN (!regs->kuap,"Bug: write fault blocked by segment registers !" ); +return WARN (address < begin || address >= end, +"Bug: write fault blocked by segment registers !" ); }#endif /* CONFIG_PPC_KUAP */
arch/powerpc/include/asm/book3s/64/kup-radix.h +2 -1
@@ -95,7 +95,8 @@ static inline void prevent_user_access(vset_kuap (AMR_KUAP_BLOCKED ); } -static inline bool bad_kuap_fault (struct pt_regs *regs,bool is_write) +static inline bool +bad_kuap_fault (struct pt_regs *regs,unsigned long address,bool is_write) { return WARN(mmu_has_feature(MMU_FTR_RADIX_KUAP) && (regs->kuap & (is_write ? AMR_KUAP_BLOCK_WRITE : AMR_KUAP_BLOCK_READ)),
arch/powerpc/include/asm/kup.h +5 -1
@@ -45,7 +45,11 @@ static inline void allow_user_access(voi unsigned long size) { }static inline void prevent_user_access (void __user *to,const void __user *from,unsigned long size) { } -static inline bool bad_kuap_fault (struct pt_regs *regs,bool is_write) {return false; } +static inline bool +bad_kuap_fault (struct pt_regs *regs,unsigned long address,bool is_write) +{ +return false; +}#endif /* CONFIG_PPC_KUAP */ static inline void allow_read_from_user (const void __user *from,unsigned long size)
arch/powerpc/include/asm/nohash/32/kup-8xx.h +2 -1
@@ -46,7 +46,8 @@ static inline void prevent_user_access(vmtspr (SPRN_MD_AP ,MD_APG_KUAP ); } -static inline bool bad_kuap_fault (struct pt_regs *regs,bool is_write) +static inline bool +bad_kuap_fault (struct pt_regs *regs,unsigned long address,bool is_write) {return WARN (!((regs->kuap ^MD_APG_KUAP ) &0xf0000000 ),"Bug: fault blocked by AP register !" );
arch/powerpc/mm/fault.c +1 -1
@@ -233,7 +233,7 @@ static bool bad_kernel_fault(struct pt_r// Read/write fault in a valid region (the exception table search passed // above), but blocked by KUAP is bad, it can never succeed. -if (bad_kuap_fault (regs, is_write)) +if (bad_kuap_fault (regs, address, is_write))return true;// What's left? Kernel fault on user in well defined regions (extable
Greg Kroah-Hartman
maintainerPATCH 84/367 powerpc/ptdump: Fix W+X verification
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit d80ae83f1f932ab7af47b54d0d3bef4f4dba489f upstream.
Verification cannot rely on simple bit checking because on some platforms PAGE_RW is 0, checking that a page is not W means checking that PAGE_RO is set instead of checking that PAGE_RW is not set.
Use pte helpers instead of checking bits.
--- arch/powerpc/mm/ptdump/ptdump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/mm/ptdump/ptdump.c +3 -1
@@ -173,10 +173,12 @@ static void dump_addr(struct pg_state *sstatic void note_prot_wx (struct pg_state *st,unsigned long addr) { +pte_t pte =__pte (st->current_flags); +if (!IS_ENABLED (CONFIG_PPC_DEBUG_WX ) || !st->check_wx)return ; -if (!((st->current_flags &pgprot_val (PAGE_KERNEL_X )) ==pgprot_val (PAGE_KERNEL_X ))) +if (!pte_write (pte) || !pte_exec (pte))return ; WARN_ONCE(1, "powerpc/mm: Found insecure W+X mapping at address %p/%pS\n",
Greg Kroah-Hartman
maintainerPATCH 86/367 powerpc/pseries: Advance pfn if section is not present in lmb_is_removable()
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
commit fbee6ba2dca30d302efe6bddb3a886f5e964a257 upstream.
In lmb_is_removable(), if a section is not present, it should continue to test the rest of the sections in the block. But the current code fails to do so.
--- arch/powerpc/platforms/pseries/hotplug-memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +3 -1
@@ -360,8 +360,10 @@ static bool lmb_is_removable(struct drmefor (i =0 ; i < scns_per_block; i++) { pfn =PFN_DOWN (phys_addr); -if (!pfn_present (pfn)) +if (!pfn_present (pfn)) { + phys_addr +=MIN_MEMORY_BLOCK_SIZE ;continue ; + } rc = rc &&is_mem_section_removable (pfn,PAGES_PER_SECTION ); phys_addr +=MIN_MEMORY_BLOCK_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 85/367 powerpc/xmon: dont access ASDR in VMs
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
commit c2a20711fc181e7f22ee5c16c28cb9578af84729 upstream.
ASDR is HV-privileged and must only be accessed in HV-mode. Fixes a Program Check (0x700) when xmon in a VM dumps SPRs.
--- arch/powerpc/xmon/xmon.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/xmon/xmon.c +4 -5
@@ -1949,15 +1949,14 @@ static void dump_300_sprs(void)printf ("pidr = %.16lx tidr = %.16lx\n" ,mfspr (SPRN_PID ),mfspr (SPRN_TIDR )); -printf ("asdr = %.16lx psscr = %.16lx\n" , -mfspr (SPRN_ASDR ), hv ?mfspr (SPRN_PSSCR ) - :mfspr (SPRN_PSSCR_PR )); +printf ("psscr = %.16lx\n" , + hv ?mfspr (SPRN_PSSCR ) :mfspr (SPRN_PSSCR_PR ));if (!hv)return ; -printf ("ptcr = %.16lx\n" , -mfspr (SPRN_PTCR )); +printf ("ptcr = %.16lx asdr = %.16lx\n" , +mfspr (SPRN_PTCR ),mfspr (SPRN_ASDR ));#endif }
Greg Kroah-Hartman
maintainerPATCH 81/367 MIPS: asm: local: add barriers for Loongson
In reply to Greg Kroah-HartmanFrom: Wang Xuerui <[email protected]>
commit 3e86460ebe2340df6a33b35a55312cc369bdcbd0 upstream.
Somehow these LL/SC usages are not taken care of, breaking Loongson builds. Add the SYNCs appropriately.
--- arch/mips/include/asm/local.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/include/asm/local.h +4 -0
@@ -37,6 +37,7 @@ static __inline__ long local_add_return( __asm__ __volatile__(" .set push \n" " .set arch=r4000 \n" + __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_add_return \n" " addu %0, %1, %3 \n" __SC"%0, %2 \n"
@@ -52,6 +53,7 @@ static __inline__ long local_add_return( __asm__ __volatile__(" .set push \n" " .set " MIPS_ISA_ARCH_LEVEL " \n" + __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_add_return \n" " addu %0, %1, %3 \n" __SC"%0, %2 \n"
@@ -84,6 +86,7 @@ static __inline__ long local_sub_return( __asm__ __volatile__(" .set push \n" " .set arch=r4000 \n" + __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_sub_return \n" " subu %0, %1, %3 \n" __SC"%0, %2 \n"
@@ -99,6 +102,7 @@ static __inline__ long local_sub_return( __asm__ __volatile__(" .set push \n" " .set " MIPS_ISA_ARCH_LEVEL " \n" + __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_sub_return \n" " subu %0, %1, %3 \n" __SC"%0, %2 \n"
Greg Kroah-Hartman
maintainerPATCH 79/367 MIPS: boot: fix typo in vmlinux.lzma.its target
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 16202c09577f3d0c533274c0410b7de05fb0d458 upstream.
Commit 92b34a976348 ("MIPS: boot: add missing targets for vmlinux.*.its") fixed constant rebuild of *.its files on every make invocation, but due to typo ("lzmo") it made no sense for vmlinux.lzma.its.
--- arch/mips/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/boot/Makefile +1 -1
@@ -123,7 +123,7 @@ $(obj)/vmlinux.its.S: $(addprefix $(srct targets += vmlinux.its targets += vmlinux.gz.its targets += vmlinux.bz2.its -targets += vmlinux.lzmo.its +targets += vmlinux.lzma.its targets += vmlinux.lzo.its quiet_cmd_cpp_its_S = ITS $@
Greg Kroah-Hartman
maintainerPATCH 31/367 ipc/msg.c: consolidate all xxxctl_down() functions
In reply to Greg Kroah-HartmanFrom: Lu Shuaibing <[email protected]>
commit 889b331724c82c11e15ba0a60979cf7bded0a26c upstream.
A use of uninitialized memory in msgctl_down() because msqid64 in ksys_msgctl hasn't been initialized. The local | msqid64 | is created in ksys_msgctl() and then passed into msgctl_down(). Along the way msqid64 is never initialized before msgctl_down() checks msqid64->msg_qbytes.
KUMSAN(KernelUninitializedMemorySantizer, a new error detection tool) reports:
==================================================================
BUG: KUMSAN: use of uninitialized memory in msgctl_down+0x94/0x300 Read of size 8 at addr ffff88806bb97eb8 by task syz-executor707/2022 CPU: 0 PID: 2022 Comm: syz-executor707 Not tainted 5.2.0-rc4+ #63 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 Call Trace: dump_stack+0x75/0xae __kumsan_report+0x17c/0x3e6 kumsan_report+0xe/0x20 msgctl_down+0x94/0x300 ksys_msgctl.constprop.14+0xef/0x260 do_syscall_64+0x7e/0x1f0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x4400e9 Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffd869e0598 EFLAGS: 00000246 ORIG_RAX: 0000000000000047 RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004400e9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000401970 R13: 0000000000401a00 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the page: page:ffffea0001aee5c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x100000000000000() raw: 0100000000000000 0000000000000000 ffffffff01ae0101 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kumsan: bad access detected ==================================================================
Syzkaller reproducer:
msgctl$IPC_RMID(0x0, 0x0)
C reproducer:
// autogenerated by syzkaller (https://github.com/google/syzkaller)
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); syscall(__NR_msgctl, 0, 0, 0);
return 0;
}
From: Andrew Morton <[email protected]>
Subject: [PATCH 5.5 031/367] ipc/msg.c: consolidate all xxxctl_down() functions
Each line here overflows 80 cols by exactly one character. Delete one tab per line to fix.
--- ipc/msg.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
ipc/msg.c +10 -9
@@ -377,7 +377,7 @@ copy_msqid_from_user(struct msqid64_ds ** NOTE: no locks must be held, the rwsem is taken inside this function. */ static int msgctl_down (struct ipc_namespace *ns,int msqid,int cmd, -struct msqid64_ds *msqid64) +struct ipc64_perm *perm,int msg_qbytes) {struct kern_ipc_perm *ipcp;struct msg_queue *msq;
@@ -387,7 +387,7 @@ static int msgctl_down(struct ipc_namesprcu_read_lock (); ipcp =ipcctl_obtain_check (ns, &msg_ids (ns), msqid, cmd, - &msqid64->msg_perm, msqid64->msg_qbytes); + perm, msg_qbytes);if (IS_ERR (ipcp)) { err =PTR_ERR (ipcp); goto out_unlock1;
@@ -409,18 +409,18 @@ static int msgctl_down(struct ipc_namesp {DEFINE_WAKE_Q (wake_q); -if (msqid64->msg_qbytes > ns->msg_ctlmnb && +if (msg_qbytes > ns->msg_ctlmnb && !capable (CAP_SYS_RESOURCE )) { err = -EPERM ; goto out_unlock1; }ipc_lock_object (&msq->q_perm); - err =ipc_update_perm (&msqid64->msg_perm, ipcp); + err =ipc_update_perm (perm, ipcp);if (err) goto out_unlock0; - msq->q_qbytes = msqid64->msg_qbytes; + msq->q_qbytes = msg_qbytes; msq->q_ctime =ktime_get_real_seconds ();/*
@@ -601,9 +601,10 @@ static long ksys_msgctl(int msqid, int ccase IPC_SET :if (copy_msqid_from_user (&msqid64, buf, version))return -EFAULT ; -/* fallthru */ +return msgctl_down (ns, msqid, cmd, &msqid64.msg_perm, + msqid64.msg_qbytes);case IPC_RMID : -return msgctl_down (ns, msqid, cmd, &msqid64); +return msgctl_down (ns, msqid, cmd,NULL ,0 );default :return -EINVAL ; }
@@ -735,9 +736,9 @@ static long compat_ksys_msgctl(int msqidcase IPC_SET :if (copy_compat_msqid_from_user (&msqid64, uptr, version))return -EFAULT ; -/* fallthru */ +return msgctl_down (ns, msqid, cmd, &msqid64.msg_perm, msqid64.msg_qbytes);case IPC_RMID : -return msgctl_down (ns, msqid, cmd, &msqid64); +return msgctl_down (ns, msqid, cmd,NULL ,0 );default :return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 24/367 MAINTAINERS: correct entries for ISDN/mISDN section
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit dff6bc1bfd462b76dc13ec19dedc2c134a62ac59 ]
Commit 6d97985072dc ("isdn: move capi drivers to staging") cleaned up the isdn drivers and split the MAINTAINERS section for ISDN, but missed to add the terminal slash for the two directories mISDN and hardware. Hence, all files in those directories were not part of the new ISDN/mISDN SUBSYSTEM, but were considered to be part of "THE REST".
Rectify the situation, and while at it, also complete the section with two further build files that belong to that subsystem.
This was identified with a small script that finds all files belonging to "THE REST" according to the current MAINTAINERS file, and I investigated upon its output.
--- MAINTAINERS | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
MAINTAINERS +4 -2
@@ -8808,8 +8808,10 @@ L: [email protected] (su L: [email protected] W: http://www.isdn4linux.de S: Maintained -F: drivers/isdn/mISDN -F: drivers/isdn/hardware +F: drivers/isdn/mISDN/ +F: drivers/isdn/hardware/ +F: drivers/isdn/Kconfig +F: drivers/isdn/Makefile ISDN/CAPI SUBSYSTEM M: Karsten Keil <[email protected]>
Greg Kroah-Hartman
maintainerPATCH 29/367 netfilter: ipset: fix suspicious RCU usage in find_set_and_id
In reply to Greg Kroah-HartmanFrom: Kadlecsik József <[email protected]>
commit 5038517119d50ed0240059b1d7fc2faa92371c08 upstream.
find_set_and_id() is called when the NFNL_SUBSYS_IPSET mutex is held. However, in the error path there can be a follow-up recvmsg() without the mutex held. Use the start() function of struct netlink_dump_control instead of dump() to verify and report if the specified set does not exist.
Thanks to Pablo Neira Ayuso for helping me to understand the subleties of the netlink protocol.
--- net/netfilter/ipset/ip_set_core.c | 41 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
net/netfilter/ipset/ip_set_core.c +21 -20
@@ -1483,31 +1483,34 @@ ip_set_dump_policy[IPSET_ATTR_CMD_MAX + };static int -dump_init (struct netlink_callback *cb,struct ip_set_net *inst) +ip_set_dump_start (struct netlink_callback *cb) {struct nlmsghdr *nlh =nlmsg_hdr (cb->skb);int min_len =nlmsg_total_size (sizeof (struct nfgenmsg ));struct nlattr *cda[IPSET_ATTR_CMD_MAX +1 ];struct nlattr *attr = (void *)nlh + min_len; +struct sk_buff *skb = cb->skb; +struct ip_set_net *inst =ip_set_pernet (sock_net (skb->sk));u32 dump_type; -ip_set_id_t index;int ret; ret =nla_parse (cda,IPSET_ATTR_CMD_MAX , attr, nlh->nlmsg_len - min_len, ip_set_dump_policy,NULL );if (ret) -return ret; + goto error; cb->args[IPSET_CB_PROTO ] =nla_get_u8 (cda[IPSET_ATTR_PROTOCOL ]);if (cda[IPSET_ATTR_SETNAME ]) { +ip_set_id_t index;struct ip_set *set; set =find_set_and_id (inst,nla_data (cda[IPSET_ATTR_SETNAME ]), &index); -if (!set) -return -ENOENT ; - +if (!set) { + ret = -ENOENT ; + goto error; + } dump_type =DUMP_ONE ; cb->args[IPSET_CB_INDEX ] = index; }else {
@@ -1523,10 +1526,17 @@ dump_init(struct netlink_callback *cb, s cb->args[IPSET_CB_DUMP ] = dump_type;return 0 ; + +error: +/* We have to create and send the error message manually :-( */ +if (nlh->nlmsg_flags &NLM_F_ACK ) { +netlink_ack (cb->skb, nlh, ret,NULL ); + } +return ret; }static int -ip_set_dump_start (struct sk_buff *skb,struct netlink_callback *cb) +ip_set_dump_do (struct sk_buff *skb,struct netlink_callback *cb) {ip_set_id_t index =IPSET_INVALID_ID , max;struct ip_set *set =NULL ;
@@ -1537,18 +1547,8 @@ ip_set_dump_start(struct sk_buff *skb, sbool is_destroyed;int ret =0 ; -if (!cb->args[IPSET_CB_DUMP ]) { - ret =dump_init (cb, inst); -if (ret <0 ) { - nlh =nlmsg_hdr (cb->skb); -/* We have to create and send the error message -* manually :-( -*/ -if (nlh->nlmsg_flags &NLM_F_ACK ) -netlink_ack (cb->skb, nlh, ret,NULL ); -return ret; - } - } +if (!cb->args[IPSET_CB_DUMP ]) +return -EINVAL ;if (cb->args[IPSET_CB_INDEX ] >= inst->ip_set_max) goto out;
@@ -1684,7 +1684,8 @@ static int ip_set_dump(struct net *net, {struct netlink_dump_control c = { - .dump = ip_set_dump_start, + .start = ip_set_dump_start, + .dump = ip_set_dump_do, .done = ip_set_dump_done, };return netlink_dump_start (ctnl, skb, nlh, &c);
Greg Kroah-Hartman
maintainerPATCH 67/367 platform/x86: intel_scu_ipc: Fix interrupt support
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
commit e48b72a568bbd641c91dad354138d3c17d03ee6f upstream.
Currently the driver has disabled interrupt support for Tangier but actually interrupt works just fine if the command is not written twice in a row. Also we need to ack the interrupt in the handler.
--- drivers/platform/x86/intel_scu_ipc.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/platform/x86/intel_scu_ipc.c +8 -13
@@ -67,26 +67,22 @@struct intel_scu_ipc_pdata_t {u32 i2c_base;u32 i2c_len; -u8 irq_mode; };static const struct intel_scu_ipc_pdata_t intel_scu_ipc_lincroft_pdata = { .i2c_base =0xff12b000 , .i2c_len =0x10 , - .irq_mode =0 , };/* Penwell and Cloverview */ static const struct intel_scu_ipc_pdata_t intel_scu_ipc_penwell_pdata = { .i2c_base =0xff12b000 , .i2c_len =0x10 , - .irq_mode =1 , };static const struct intel_scu_ipc_pdata_t intel_scu_ipc_tangier_pdata = { .i2c_base =0xff00d000 , .i2c_len =0x10 , - .irq_mode =0 , };struct intel_scu_ipc_dev {
@@ -99,6 +95,9 @@ struct intel_scu_ipc_dev {static struct intel_scu_ipc_dev ipcdev;/* Only one for now */ +#define IPC_STATUS 0x04 +#define IPC_STATUS_IRQ BIT(2) +/* * IPC Read Buffer (Read Only): * 16 byte buffer for receiving data from SCU, if IPC command
@@ -120,11 +119,8 @@ static DEFINE_MUTEX(ipclock); /* lock us*/ static inline void ipc_command (struct intel_scu_ipc_dev *scu,u32 cmd) { -if (scu->irq_mode) { -reinit_completion (&scu->cmd_complete); -writel (cmd |IPC_IOC , scu->ipc_base); - } -writel (cmd, scu->ipc_base); +reinit_completion (&scu->cmd_complete); +writel (cmd |IPC_IOC , scu->ipc_base); }/*
@@ -610,9 +606,10 @@ EXPORT_SYMBOL(intel_scu_ipc_i2c_cntrl);static irqreturn_t ioc (int irq,void *dev_id) {struct intel_scu_ipc_dev *scu = dev_id; +int status =ipc_read_status (scu); -if (scu->irq_mode) -complete (&scu->cmd_complete); +writel (status |IPC_STATUS_IRQ , scu->ipc_base +IPC_STATUS ); +complete (&scu->cmd_complete);return IRQ_HANDLED ; }
@@ -638,8 +635,6 @@ static int ipc_probe(struct pci_dev *pdeif (!pdata)return -ENODEV ; - scu->irq_mode = pdata->irq_mode; - err =pcim_enable_device (pdev);if (err)return err;
Greg Kroah-Hartman
maintainerPATCH 65/367 irqdomain: Fix a memory leak in irq_domain_push_irq()
In reply to Greg Kroah-HartmanFrom: Kevin Hao <[email protected]>
commit 0f394daef89b38d58c91118a2b08b8a1b316703b upstream.
Fix a memory leak reported by kmemleak:
unreferenced object 0xffff000bc6f50e80 (size 128):
comm "kworker/23:2", pid 201, jiffies 4294894947 (age 942.132s) hex dump (first 32 bytes):
00 00 00 00 41 00 00 00 86 c0 03 00 00 00 00 00 ....A...........
00 a0 b2 c6 0b 00 ff ff 40 51 fd 10 00 80 ff ff ........@Q......
backtrace:
[<00000000e62d2240>] kmem_cache_alloc_trace+0x1a4/0x320
[<00000000279143c9>] irq_domain_push_irq+0x7c/0x188
[<00000000d9f4c154>] thunderx_gpio_probe+0x3ac/0x438
[<00000000fd09ec22>] pci_device_probe+0xe4/0x198
[<00000000d43eca75>] really_probe+0xdc/0x320
[<00000000d3ebab09>] driver_probe_device+0x5c/0xf0
[<000000005b3ecaa0>] __device_attach_driver+0x88/0xc0
[<000000004e5915f5>] bus_for_each_drv+0x7c/0xc8
[<0000000079d4db41>] __device_attach+0xe4/0x140
[<00000000883bbda9>] device_initial_probe+0x18/0x20
[<000000003be59ef6>] bus_probe_device+0x98/0xa0
[<0000000039b03d3f>] deferred_probe_work_func+0x74/0xa8
[<00000000870934ce>] process_one_work+0x1c8/0x470
[<00000000e3cce570>] worker_thread+0x1f8/0x428
[<000000005d64975e>] kthread+0xfc/0x128
[<00000000f0eaa764>] ret_from_fork+0x10/0x18--- kernel/irq/irqdomain.c | 1 + 1 file changed, 1 insertion(+)
kernel/irq/irqdomain.c +1 -0
@@ -1459,6 +1459,7 @@ int irq_domain_push_irq(struct irq_domaiif (rv) {/* Restore the original irq_data. */ *root_irq_data = *child_irq_data; +kfree (child_irq_data); goto error; }
Greg Kroah-Hartman
maintainerPATCH 60/367 mm: move_pages: report the number of non-attempted pages
In reply to Greg Kroah-HartmanFrom: Yang Shi <[email protected]>
commit 5984fabb6e82d9ab4e6305cb99694c85d46de8ae upstream.
Since commit a49bd4d71637 ("mm, numa: rework do_pages_move"), the semantic of move_pages() has changed to return the number of non-migrated pages if they were result of a non-fatal reasons (usually a busy page).
This was an unintentional change that hasn't been noticed except for LTP tests which checked for the documented behavior.
There are two ways to go around this change. We can even get back to the original behavior and return -EAGAIN whenever migrate_pages is not able to migrate pages due to non-fatal reasons. Another option would be to simply continue with the changed semantic and extend move_pages documentation to clarify that -errno is returned on an invalid input or when migration simply cannot succeed (e.g. -ENOMEM, -EBUSY) or the number of pages that couldn't have been migrated due to ephemeral reasons (e.g. page is pinned or locked for other reasons).
This patch implements the second option because this behavior is in place for some time without anybody complaining and possibly new users depending on it. Also it allows to have a slightly easier error handling as the caller knows that it is worth to retry when err > 0.
But since the new semantic would be aborted immediately if migration is failed due to ephemeral reasons, need include the number of non-attempted pages in the return value too.
--- mm/migrate.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
mm/migrate.c +23 -2
@@ -1627,8 +1627,19 @@ static int do_pages_move(struct mm_struc start = i; }else if (node != current_node) { err =do_move_pages_to_node (mm, &pagelist, current_node); -if (err) +if (err) { +/* +* Positive err means the number of failed +* pages to migrate. Since we are going to +* abort and return the number of non-migrated +* pages, so need to incude the rest of the +* nr_pages that have not been attempted as +* well. +*/ +if (err >0 ) + err += nr_pages - i -1 ; goto out; + } err =store_status (status, start, current_node, i - start);if (err) goto out;
@@ -1659,8 +1670,11 @@ static int do_pages_move(struct mm_struc goto out_flush; err =do_move_pages_to_node (mm, &pagelist, current_node); -if (err) +if (err) { +if (err >0 ) + err += nr_pages - i -1 ; goto out; + }if (i > start) { err =store_status (status, start, current_node, i - start);if (err)
@@ -1674,6 +1688,13 @@ out_flush:/* Make sure we do not overwrite the existing error */ err1 =do_move_pages_to_node (mm, &pagelist, current_node); +/* +* Don't have to report non-attempted pages here since: +* - If the above loop is done gracefully all pages have been +* attempted. +* - If the above loop is aborted it means a fatal error +* happened, should return ret. +*/ if (!err1) err1 =store_status (status, start, current_node, i - start);if (err >=0 )
Greg Kroah-Hartman
maintainerPATCH 61/367 media/v4l2-core: set pages dirty upon releasing DMA buffers
In reply to Greg Kroah-HartmanFrom: John Hubbard <[email protected]>
commit 3c7470b6f68434acae459482ab920d1e3fabd1c7 upstream.
After DMA is complete, and the device and CPU caches are synchronized, it's still required to mark the CPU pages as dirty, if the data was coming from the device. However, this driver was just issuing a bare put_page() call, without any set_page_dirty*() call.
Fix the problem, by calling set_page_dirty_lock() if the CPU pages were potentially receiving data from the device.
--- drivers/media/v4l2-core/videobuf-dma-sg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/videobuf-dma-sg.c +4 -1
@@ -349,8 +349,11 @@ int videobuf_dma_free(struct videobuf_dmBUG_ON (dma->sglen);if (dma->pages) { -for (i =0 ; i < dma->nr_pages; i++) +for (i =0 ; i < dma->nr_pages; i++) { +if (dma->direction ==DMA_FROM_DEVICE ) +set_page_dirty_lock (dma->pages[i]);put_page (dma->pages[i]); + }kfree (dma->pages); dma->pages =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 57/367 mm/migrate.c: also overwrite error when it is bigger than zero
In reply to Greg Kroah-HartmanFrom: Wei Yang <[email protected]>
commit dfe9aa23cab7880a794db9eb2d176c00ed064eb6 upstream.
If we get here after successfully adding page to list, err would be 1 to indicate the page is queued in the list.
Current code has two problems:
* on success, 0 is not returned
* on error, if add_page_for_migratioin() return 1, and the following err1 from do_move_pages_to_node() is set, the err1 is not returned since err is 1
And these behaviors break the user interface.
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -1676,7 +1676,7 @@ out_flush: err1 =do_move_pages_to_node (mm, &pagelist, current_node);if (!err1) err1 =store_status (status, start, current_node, i - start); -if (!err) +if (err >=0 ) err = err1; out:return err;
Greg Kroah-Hartman
maintainerPATCH 59/367 mm: thp: dont need care deferred split queue in memcg charge move path
In reply to Greg Kroah-HartmanFrom: Wei Yang <[email protected]>
commit fac0516b5534897bf4c4a88daa06a8cfa5611b23 upstream.
If compound is true, this means it is a PMD mapped THP. Which implies the page is not linked to any defer list. So the first code chunk will not be executed.
Also with this reason, it would not be proper to add this page to a defer list. So the second code chunk is not correct.
Based on this, we should remove the defer list related code.
--- mm/memcontrol.c | 18 ------------------ 1 file changed, 18 deletions(-)
mm/memcontrol.c +0 -18
@@ -5340,14 +5340,6 @@ static int mem_cgroup_move_account(struc__mod_lruvec_state (to_vec,NR_WRITEBACK , nr_pages); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -if (compound && !list_empty (page_deferred_list (page))) { -spin_lock (&from->deferred_split_queue.split_queue_lock); -list_del_init (page_deferred_list (page)); - from->deferred_split_queue.split_queue_len--; -spin_unlock (&from->deferred_split_queue.split_queue_lock); - } -#endif /* * It is safe to change page->mem_cgroup here because the page * is referenced, charged, and isolated - we can't race with
@@ -5357,16 +5349,6 @@ static int mem_cgroup_move_account(struc/* caller should have done css_get */ page->mem_cgroup = to; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -if (compound &&list_empty (page_deferred_list (page))) { -spin_lock (&to->deferred_split_queue.split_queue_lock); -list_add_tail (page_deferred_list (page), - &to->deferred_split_queue.split_queue); - to->deferred_split_queue.split_queue_len++; -spin_unlock (&to->deferred_split_queue.split_queue_lock); - } -#endif -spin_unlock_irqrestore (&from->move_lock, flags); ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 58/367 mm/memory_hotplug: fix remove_memory() lockdep splat
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit f1037ec0cc8ac1a450974ad9754e991f72884f48 upstream.
The daxctl unit test for the dax_kmem driver currently triggers the (false positive) lockdep splat below. It results from the fact that remove_memory_block_devices() is invoked under the mem_hotplug_lock() causing lockdep entanglements with cpu_hotplug_lock() and sysfs (kernfs active state tracking). It is a false positive because the sysfs attribute path triggering the memory remove is not the same attribute path associated with memory-block device.
sysfs_break_active_protection() is not applicable since there is no real deadlock conflict, instead move memory-block device removal outside the lock. The mem_hotplug_lock() is not needed to synchronize the memory-block device removal vs the page online state, that is already handled by lock_device_hotplug(). Specifically, lock_device_hotplug() is sufficient to allow try_remove_memory() to check the offline state of the memblocks and be assured that any in progress online attempts are flushed / blocked by kernfs_drain() / attribute removal.
The add_memory() path safely creates memblock devices under the mem_hotplug_lock(). There is no kernfs active state synchronization in the memblock device_register() path, so nothing to fix there.
This change is only possible thanks to the recent change that refactored memory block device removal out of arch_remove_memory() (commit 4c4b7f9ba948 "mm/memory_hotplug: remove memory block devices before arch_remove_memory()"), and David's due diligence tracking down the guarantees afforded by kernfs_drain(). Not flagged for -stable since this only impacts ongoing development and lockdep validation, not a runtime issue.
======================================================
WARNING: possible circular locking dependency detected
5.5.0-rc3+ #230 Tainted: G OE
------------------------------------------------------
lt-daxctl/6459 is trying to acquire lock:
ffff99c7f0003510 (kn->count#241){++++}, at: kernfs_remove_by_name_ns+0x41/0x80
but task is already holding lock:
ffffffffa76a5450 (mem_hotplug_lock.rw_sem){++++}, at: percpu_down_write+0x20/0xe0
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (mem_hotplug_lock.rw_sem){++++}:
__lock_acquire+0x39c/0x790
lock_acquire+0xa2/0x1b0
get_online_mems+0x3e/0xb0
kmem_cache_create_usercopy+0x2e/0x260
kmem_cache_create+0x12/0x20
ptlock_cache_init+0x20/0x28
start_kernel+0x243/0x547
secondary_startup_64+0xb6/0xc0
-> #1 (cpu_hotplug_lock.rw_sem){++++}:
__lock_acquire+0x39c/0x790
lock_acquire+0xa2/0x1b0
cpus_read_lock+0x3e/0xb0
online_pages+0x37/0x300
memory_subsys_online+0x17d/0x1c0
device_online+0x60/0x80
state_store+0x65/0xd0
kernfs_fop_write+0xcf/0x1c0
vfs_write+0xdb/0x1d0
ksys_write+0x65/0xe0
do_syscall_64+0x5c/0xa0
entry_SYSCALL_64_after_hwframe+0x49/0xbe
-> #0 (kn->count#241){++++}:
check_prev_add+0x98/0xa40
validate_chain+0x576/0x860
__lock_acquire+0x39c/0x790
lock_acquire+0xa2/0x1b0
__kernfs_remove+0x25f/0x2e0
kernfs_remove_by_name_ns+0x41/0x80
remove_files.isra.0+0x30/0x70
sysfs_remove_group+0x3d/0x80
sysfs_remove_groups+0x29/0x40
device_remove_attrs+0x39/0x70
device_del+0x16a/0x3f0
device_unregister+0x16/0x60
remove_memory_block_devices+0x82/0xb0
try_remove_memory+0xb5/0x130
remove_memory+0x26/0x40
dev_dax_kmem_remove+0x44/0x6a [kmem]
device_release_driver_internal+0xe4/0x1c0
unbind_store+0xef/0x120
kernfs_fop_write+0xcf/0x1c0
vfs_write+0xdb/0x1d0
ksys_write+0x65/0xe0
do_syscall_64+0x5c/0xa0
entry_SYSCALL_64_after_hwframe+0x49/0xbe
other info that might help us debug this:
Chain exists of:
kn->count#241 --> cpu_hotplug_lock.rw_sem --> mem_hotplug_lock.rw_sem
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(mem_hotplug_lock.rw_sem);
lock(cpu_hotplug_lock.rw_sem);
lock(mem_hotplug_lock.rw_sem);
lock(kn->count#241);
*** DEADLOCK ***No fixes tag as this has been a long standing issue that predated the addition of kernfs lockdep annotations.
--- mm/memory_hotplug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
mm/memory_hotplug.c +6 -3
@@ -1764,8 +1764,6 @@ static int __ref try_remove_memory(int nBUG_ON (check_hotplug_memory_range (start, size)); -mem_hotplug_begin (); -/* * All memory blocks must be offlined before removing memory. Check * whether all memory blocks in question are offline and return error
@@ -1778,9 +1776,14 @@ static int __ref try_remove_memory(int n/* remove memmap entry */ firmware_map_remove (start, start + size,"System RAM" ); -/* remove memory block devices before removing memory */ +/* +* Memory block device removal under the device_hotplug_lock is +* a barrier against racing online attempts. +*/ remove_memory_block_devices (start, size); +mem_hotplug_begin (); +arch_remove_memory (nid, start, size,NULL );memblock_free (start, size);memblock_remove (start, size);
Greg Kroah-Hartman
maintainerPATCH 55/367 mm/sparse.c: reset sections mem_map when fully deactivated
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
commit 1f503443e7df8dc8366608b4d810ce2d6669827c upstream.
After commit ba72b4c8cf60 ("mm/sparsemem: support sub-section hotplug"), when a mem section is fully deactivated, section_mem_map still records the section's start pfn, which is not used any more and will be reassigned during re-addition.
In analogy with alloc/free pattern, it is better to clear all fields of section_mem_map.
Beside this, it breaks the user space tool "makedumpfile" [1], which makes assumption that a hot-removed section has mem_map as NULL, instead of checking directly against SECTION_MARKED_PRESENT bit. (makedumpfile will be better to change the assumption, and need a patch)
The bug can be reproduced on IBM POWERVM by "drmgr -c mem -r -q 5" , trigger a crash, and save vmcore by makedumpfile
[1]: makedumpfile, commit e73016540293 ("[v1.6.7] Update version")
--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
@@ -789,7 +789,7 @@ static void section_deactivate(unsigned ms->usage =NULL ; } memmap =sparse_decode_mem_map (ms->section_mem_map, section_nr); - ms->section_mem_map =sparse_encode_mem_map (NULL , section_nr); + ms->section_mem_map = (unsigned long )NULL ; }if (section_is_early && memmap)
Greg Kroah-Hartman
maintainerPATCH 56/367 utimes: Clamp the timestamps in notify_change()
In reply to Greg Kroah-HartmanFrom: Amir Goldstein <[email protected]>
commit eb31e2f63d85d1bec4f7b136f317e03c03db5503 upstream.
Push clamping timestamps into notify_change(), so in-kernel callers like nfsd and overlayfs will get similar timestamp set behavior as utimes.
AV: get rid of clamping in ->setattr() instances; we don't need to bother with that there, with notify_change() doing normalization in all cases now (it already did for implicit case, since current_time() clamps).
--- fs/attr.c | 23 +++++++++++------------ fs/configfs/inode.c | 9 +++------ fs/f2fs/file.c | 18 ++++++------------ fs/ntfs/inode.c | 18 ++++++------------ fs/ubifs/file.c | 18 ++++++------------ fs/utimes.c | 4 ++-- 6 files changed, 34 insertions(+), 56 deletions(-)
fs/attr.c +11 -12
@@ -183,18 +183,12 @@ void setattr_copy(struct inode *inode, c inode->i_uid = attr->ia_uid;if (ia_valid &ATTR_GID ) inode->i_gid = attr->ia_gid; -if (ia_valid &ATTR_ATIME ) { - inode->i_atime =timestamp_truncate (attr->ia_atime, - inode); - } -if (ia_valid &ATTR_MTIME ) { - inode->i_mtime =timestamp_truncate (attr->ia_mtime, - inode); - } -if (ia_valid &ATTR_CTIME ) { - inode->i_ctime =timestamp_truncate (attr->ia_ctime, - inode); - } +if (ia_valid &ATTR_ATIME ) + inode->i_atime = attr->ia_atime; +if (ia_valid &ATTR_MTIME ) + inode->i_mtime = attr->ia_mtime; +if (ia_valid &ATTR_CTIME ) + inode->i_ctime = attr->ia_ctime;if (ia_valid &ATTR_MODE ) {umode_t mode = attr->ia_mode;
@@ -268,8 +262,13 @@ int notify_change(struct dentry * dentry attr->ia_ctime = now;if (!(ia_valid &ATTR_ATIME_SET )) attr->ia_atime = now; +else + attr->ia_atime =timestamp_truncate (attr->ia_atime, inode);if (!(ia_valid &ATTR_MTIME_SET )) attr->ia_mtime = now; +else + attr->ia_mtime =timestamp_truncate (attr->ia_mtime, inode); +if (ia_valid &ATTR_KILL_PRIV ) { error =security_inode_need_killpriv (dentry);if (error <0 )
fs/configfs/inode.c +3 -6
@@ -76,14 +76,11 @@ int configfs_setattr(struct dentry * denif (ia_valid &ATTR_GID ) sd_iattr->ia_gid = iattr->ia_gid;if (ia_valid &ATTR_ATIME ) - sd_iattr->ia_atime =timestamp_truncate (iattr->ia_atime, - inode); + sd_iattr->ia_atime = iattr->ia_atime;if (ia_valid &ATTR_MTIME ) - sd_iattr->ia_mtime =timestamp_truncate (iattr->ia_mtime, - inode); + sd_iattr->ia_mtime = iattr->ia_mtime;if (ia_valid &ATTR_CTIME ) - sd_iattr->ia_ctime =timestamp_truncate (iattr->ia_ctime, - inode); + sd_iattr->ia_ctime = iattr->ia_ctime;if (ia_valid &ATTR_MODE ) {umode_t mode = iattr->ia_mode;
fs/f2fs/file.c +6 -12
@@ -754,18 +754,12 @@ static void __setattr_copy(struct inode inode->i_uid = attr->ia_uid;if (ia_valid &ATTR_GID ) inode->i_gid = attr->ia_gid; -if (ia_valid &ATTR_ATIME ) { - inode->i_atime =timestamp_truncate (attr->ia_atime, - inode); - } -if (ia_valid &ATTR_MTIME ) { - inode->i_mtime =timestamp_truncate (attr->ia_mtime, - inode); - } -if (ia_valid &ATTR_CTIME ) { - inode->i_ctime =timestamp_truncate (attr->ia_ctime, - inode); - } +if (ia_valid &ATTR_ATIME ) + inode->i_atime = attr->ia_atime; +if (ia_valid &ATTR_MTIME ) + inode->i_mtime = attr->ia_mtime; +if (ia_valid &ATTR_CTIME ) + inode->i_ctime = attr->ia_ctime;if (ia_valid &ATTR_MODE ) {umode_t mode = attr->ia_mode;
fs/ntfs/inode.c +6 -12
@@ -2899,18 +2899,12 @@ int ntfs_setattr(struct dentry *dentry, ia_valid |=ATTR_MTIME |ATTR_CTIME ; } } -if (ia_valid &ATTR_ATIME ) { - vi->i_atime =timestamp_truncate (attr->ia_atime, - vi); - } -if (ia_valid &ATTR_MTIME ) { - vi->i_mtime =timestamp_truncate (attr->ia_mtime, - vi); - } -if (ia_valid &ATTR_CTIME ) { - vi->i_ctime =timestamp_truncate (attr->ia_ctime, - vi); - } +if (ia_valid &ATTR_ATIME ) + vi->i_atime = attr->ia_atime; +if (ia_valid &ATTR_MTIME ) + vi->i_mtime = attr->ia_mtime; +if (ia_valid &ATTR_CTIME ) + vi->i_ctime = attr->ia_ctime;mark_inode_dirty (vi); out:return err;
fs/ubifs/file.c +6 -12
@@ -1078,18 +1078,12 @@ static void do_attr_changes(struct inode inode->i_uid = attr->ia_uid;if (attr->ia_valid &ATTR_GID ) inode->i_gid = attr->ia_gid; -if (attr->ia_valid &ATTR_ATIME ) { - inode->i_atime =timestamp_truncate (attr->ia_atime, - inode); - } -if (attr->ia_valid &ATTR_MTIME ) { - inode->i_mtime =timestamp_truncate (attr->ia_mtime, - inode); - } -if (attr->ia_valid &ATTR_CTIME ) { - inode->i_ctime =timestamp_truncate (attr->ia_ctime, - inode); - } +if (attr->ia_valid &ATTR_ATIME ) + inode->i_atime = attr->ia_atime; +if (attr->ia_valid &ATTR_MTIME ) + inode->i_mtime = attr->ia_mtime; +if (attr->ia_valid &ATTR_CTIME ) + inode->i_ctime = attr->ia_ctime;if (attr->ia_valid &ATTR_MODE ) {umode_t mode = attr->ia_mode;
fs/utimes.c +2 -2
@@ -36,14 +36,14 @@ static int utimes_common(const struct paif (times[0 ].tv_nsec ==UTIME_OMIT ) newattrs.ia_valid &= ~ATTR_ATIME ;else if (times[0 ].tv_nsec !=UTIME_NOW ) { - newattrs.ia_atime =timestamp_truncate (times[0 ], inode); + newattrs.ia_atime = times[0 ]; newattrs.ia_valid |=ATTR_ATIME_SET ; }if (times[1 ].tv_nsec ==UTIME_OMIT ) newattrs.ia_valid &= ~ATTR_MTIME ;else if (times[1 ].tv_nsec !=UTIME_NOW ) { - newattrs.ia_mtime =timestamp_truncate (times[1 ], inode); + newattrs.ia_mtime = times[1 ]; newattrs.ia_valid |=ATTR_MTIME_SET ; }/*
Greg Kroah-Hartman
maintainerPATCH 27/367 media: uvcvideo: Avoid cyclic entity chains due to malformed USB descriptors
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 68035c80e129c4cfec659aac4180354530b26527 upstream.
Way back in 2017, fuzzing the 4.14-rc2 USB stack with syzkaller kicked up the following WARNING from the UVC chain scanning code:
| list_add double add: new=ffff880069084010, prev=ffff880069084010, | next=ffff880067d22298. | ------------[ cut here ]------------ | WARNING: CPU: 1 PID: 1846 at lib/list_debug.c:31 __list_add_valid+0xbd/0xf0 | Modules linked in: | CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted | 4.14.0-rc2-42613-g1488251d1a98 #238 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 | Workqueue: usb_hub_wq hub_event | task: ffff88006b01ca40 task.stack: ffff880064358000 | RIP: 0010:__list_add_valid+0xbd/0xf0 lib/list_debug.c:29 | RSP: 0018:ffff88006435ddd0 EFLAGS: 00010286 | RAX: 0000000000000058 RBX: ffff880067d22298 RCX: 0000000000000000 | RDX: 0000000000000058 RSI: ffffffff85a58800 RDI: ffffed000c86bbac | RBP: ffff88006435dde8 R08: 1ffff1000c86ba52 R09: 0000000000000000 | R10: 0000000000000002 R11: 0000000000000000 R12: ffff880069084010 | R13: ffff880067d22298 R14: ffff880069084010 R15: ffff880067d222a0 | FS: 0000000000000000(0000) GS:ffff88006c900000(0000) knlGS:0000000000000000 | CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | CR2: 0000000020004ff2 CR3: 000000006b447000 CR4: 00000000000006e0 | Call Trace: | __list_add ./include/linux/list.h:59 | list_add_tail+0x8c/0x1b0 ./include/linux/list.h:92 | uvc_scan_chain_forward.isra.8+0x373/0x416 | drivers/media/usb/uvc/uvc_driver.c:1471 | uvc_scan_chain drivers/media/usb/uvc/uvc_driver.c:1585 | uvc_scan_device drivers/media/usb/uvc/uvc_driver.c:1769 | uvc_probe+0x77f2/0x8f00 drivers/media/usb/uvc/uvc_driver.c:2104
Looking into the output from usbmon, the interesting part is the following data packet:
ffff880069c63e00 30710169 C Ci:1:002:0 0 143 = 09028f00 01030080 00090403 00000e01 00000924 03000103 7c003328 010204db
If we drop the lead configuration and interface descriptors, we're left with an output terminal descriptor describing a generic display:
/* Output terminal descriptor */
buf[0] 09
buf[1] 24
buf[2] 03 /* UVC_VC_OUTPUT_TERMINAL */
buf[3] 00 /* ID */
buf[4] 01 /* type == 0x0301 (UVC_OTT_DISPLAY) */
buf[5] 03
buf[6] 7c
buf[7] 00 /* source ID refers to self! */
buf[8] 33
The problem with this descriptor is that it is self-referential: the source ID of 0 matches itself! This causes the 'struct uvc_entity' representing the display to be added to its chain list twice during 'uvc_scan_chain()': once via 'uvc_scan_chain_entity()' when it is processed directly from the 'dev->entities' list and then again immediately afterwards when trying to follow the source ID in 'uvc_scan_chain_forward()'
Add a check before adding an entity to a chain list to ensure that the entity is not already part of a chain.
--- drivers/media/usb/uvc/uvc_driver.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/media/usb/uvc/uvc_driver.c +12 -0
@@ -1493,6 +1493,11 @@ static int uvc_scan_chain_forward(structbreak ;if (forward == prev)continue ; +if (forward->chain.next || forward->chain.prev) { +uvc_trace (UVC_TRACE_DESCR ,"Found reference to " +"entity %d already in chain.\n" , forward->id); +return -EINVAL ; + }switch (UVC_ENTITY_TYPE (forward)) {case UVC_VC_EXTENSION_UNIT :
@@ -1574,6 +1579,13 @@ static int uvc_scan_chain_backward(strucreturn -1 ; } +if (term->chain.next || term->chain.prev) { +uvc_trace (UVC_TRACE_DESCR ,"Found reference to " +"entity %d already in chain.\n" , + term->id); +return -EINVAL ; + } +if (uvc_trace_param &UVC_TRACE_PROBE )printk (KERN_CONT " %d" , term->id);
Greg Kroah-Hartman
maintainerPATCH 54/367 memcg: fix a crash in wb_workfn when a device disappears
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit 68f23b89067fdf187763e75a56087550624fdbee upstream.
Without memcg, there is a one-to-one mapping between the bdi and bdi_writeback structures. In this world, things are fairly straightforward; the first thing bdi_unregister() does is to shutdown the bdi_writeback structure (or wb), and part of that writeback ensures that no other work queued against the wb, and that the wb is fully drained.
With memcg, however, there is a one-to-many relationship between the bdi and bdi_writeback structures; that is, there are multiple wb objects which can all point to a single bdi. There is a refcount which prevents the bdi object from being released (and hence, unregistered). So in theory, the bdi_unregister() *should* only get called once its refcount goes to zero (bdi_put will drop the refcount, and when it is zero, release_bdi gets called, which calls bdi_unregister).
Unfortunately, del_gendisk() in block/gen_hd.c never got the memo about the Brave New memcg World, and calls bdi_unregister directly. It does this without informing the file system, or the memcg code, or anything else. This causes the root wb associated with the bdi to be unregistered, but none of the memcg-specific wb's are shutdown. So when one of these wb's are woken up to do delayed work, they try to dereference their wb->bdi->dev to fetch the device name, but unfortunately bdi->dev is now NULL, thanks to the bdi_unregister() called by del_gendisk(). As a result, *boom*.
Fortunately, it looks like the rest of the writeback path is perfectly happy with bdi->dev and bdi->owner being NULL, so the simplest fix is to create a bdi_dev_name() function which can handle bdi->dev being NULL. This also allows us to bulletproof the writeback tracepoints to prevent them from dereferencing a NULL pointer and crashing the kernel if one is tracing with memcg's enabled, and an iSCSI device dies or a USB storage stick is pulled.
The most common way of triggering this will be hotremoval of a device while writeback with memcg enabled is going on. It was triggering several times a day in a heavily loaded production environment.
Google Bug Id: 145475544
--- fs/fs-writeback.c | 2 +- include/linux/backing-dev.h | 10 ++++++++++ include/trace/events/writeback.h | 37 +++++++++++++++++-------------------- mm/backing-dev.c | 1 + 4 files changed, 29 insertions(+), 21 deletions(-)
fs/fs-writeback.c +1 -1
@@ -2063,7 +2063,7 @@ void wb_workfn(struct work_struct *work) struct bdi_writeback, dwork);long pages_written; -set_worker_desc ("flush-%s" ,dev_name (wb->bdi->dev)); +set_worker_desc ("flush-%s" ,bdi_dev_name (wb->bdi)); current->flags |=PF_SWAPWRITE ; if (likely(!current_is_workqueue_rescuer() ||
include/linux/backing-dev.h +10 -0
@@ -13,6 +13,7 @@#include <linux/fs.h> #include <linux/sched.h> #include <linux/blkdev.h> +#include <linux/device.h> #include <linux/writeback.h> #include <linux/blk-cgroup.h> #include <linux/backing-dev-defs.h>
@@ -504,4 +505,13 @@ static inline int bdi_rw_congested(struc (1 << WB_async_congested)); } +extern const char *bdi_unknown_name; + +static inline const char *bdi_dev_name (struct backing_dev_info *bdi) +{ +if (!bdi || !bdi->dev) +return bdi_unknown_name; +return dev_name (bdi->dev); +} +#endif /* _LINUX_BACKING_DEV_H */
include/trace/events/writeback.h +17 -20
@@ -67,8 +67,8 @@ DECLARE_EVENT_CLASS(writeback_page_templTP_fast_assign (strscpy_pad (__entry->name, - mapping ?dev_name (inode_to_bdi (mapping->host)->dev) :"(unknown)" , - 32); +bdi_dev_name (mapping ?inode_to_bdi (mapping->host) : + NULL), 32); __entry->ino = mapping ? mapping->host->i_ino :0 ; __entry->index = page->index; ),
@@ -111,8 +111,7 @@ DECLARE_EVENT_CLASS(writeback_dirty_inodstruct backing_dev_info *bdi =inode_to_bdi (inode);/* may be called for files on pseudo FSes w/ unregistered bdi */ -strscpy_pad (__entry->name, - bdi->dev ?dev_name (bdi->dev) :"(unknown)" ,32 ); +strscpy_pad (__entry->name,bdi_dev_name (bdi),32 ); __entry->ino = inode->i_ino; __entry->state = inode->i_state; __entry->flags = flags;
@@ -193,7 +192,7 @@ TRACE_EVENT(inode_foreign_history, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(inode_to_bdi(inode)->dev), 32); + strncpy(__entry->name, bdi_dev_name(inode_to_bdi(inode)), 32); __entry->ino = inode->i_ino; __entry->cgroup_ino =__trace_wbc_assign_cgroup (wbc); __entry->history = history;
@@ -222,7 +221,7 @@ TRACE_EVENT(inode_switch_wbs, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(old_wb->bdi->dev), 32); + strncpy(__entry->name, bdi_dev_name(old_wb->bdi), 32); __entry->ino = inode->i_ino; __entry->old_cgroup_ino =__trace_wb_assign_cgroup (old_wb); __entry->new_cgroup_ino =__trace_wb_assign_cgroup (new_wb);
@@ -255,7 +254,7 @@ TRACE_EVENT(track_foreign_dirty,struct address_space *mapping =page_mapping (page);struct inode *inode = mapping ? mapping->host :NULL ; -strncpy (__entry->name,dev_name (wb->bdi->dev),32 ); +strncpy (__entry->name,bdi_dev_name (wb->bdi),32 ); __entry->bdi_id = wb->bdi->id; __entry->ino = inode ? inode->i_ino :0 ; __entry->memcg_id = wb->memcg_css->id;
@@ -288,7 +287,7 @@ TRACE_EVENT(flush_foreign, ), TP_fast_assign( - strncpy(__entry->name, dev_name(wb->bdi->dev), 32); + strncpy(__entry->name, bdi_dev_name(wb->bdi), 32); __entry->cgroup_ino =__trace_wb_assign_cgroup (wb); __entry->frn_bdi_id = frn_bdi_id; __entry->frn_memcg_id = frn_memcg_id;
@@ -318,7 +317,7 @@ DECLARE_EVENT_CLASS(writeback_write_inodTP_fast_assign (strscpy_pad (__entry->name, - dev_name(inode_to_bdi(inode)->dev), 32); + bdi_dev_name(inode_to_bdi(inode)), 32); __entry->ino = inode->i_ino; __entry->sync_mode = wbc->sync_mode; __entry->cgroup_ino =__trace_wbc_assign_cgroup (wbc);
@@ -361,9 +360,7 @@ DECLARE_EVENT_CLASS(writeback_work_class__field (ino_t, cgroup_ino) ),TP_fast_assign ( -strscpy_pad (__entry->name, - wb->bdi->dev ?dev_name (wb->bdi->dev) : - "(unknown)", 32); + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); __entry->nr_pages = work->nr_pages; __entry->sb_dev = work->sb ? work->sb->s_dev :0 ; __entry->sync_mode = work->sync_mode;
@@ -416,7 +413,7 @@ DECLARE_EVENT_CLASS(writeback_class,__field (ino_t, cgroup_ino) ),TP_fast_assign ( - strscpy_pad(__entry->name, dev_name(wb->bdi->dev), 32); + strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); __entry->cgroup_ino =__trace_wb_assign_cgroup (wb); ), TP_printk("bdi %s: cgroup_ino=%lu",
@@ -438,7 +435,7 @@ TRACE_EVENT(writeback_bdi_register,__array (char, name,32 ) ),TP_fast_assign ( - strscpy_pad(__entry->name, dev_name(bdi->dev), 32); + strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); ),TP_printk ("bdi %s" , __entry->name
@@ -463,7 +460,7 @@ DECLARE_EVENT_CLASS(wbc_class, ), TP_fast_assign( - strscpy_pad(__entry->name, dev_name(bdi->dev), 32); + strscpy_pad(__entry->name, bdi_dev_name(bdi), 32); __entry->nr_to_write = wbc->nr_to_write; __entry->pages_skipped = wbc->pages_skipped; __entry->sync_mode = wbc->sync_mode;
@@ -514,7 +511,7 @@ TRACE_EVENT(writeback_queue_io, ),TP_fast_assign ( unsigned long *older_than_this = work->older_than_this; -strscpy_pad (__entry->name,dev_name (wb->bdi->dev),32 ); +strscpy_pad (__entry->name,bdi_dev_name (wb->bdi),32 ); __entry->older = older_than_this ? *older_than_this :0 ; __entry->age = older_than_this ? (jiffies - *older_than_this) *1000 /HZ :-1 ;
@@ -600,7 +597,7 @@ TRACE_EVENT(bdi_dirty_ratelimit, ),TP_fast_assign ( - strscpy_pad(__entry->bdi, dev_name(wb->bdi->dev), 32); + strscpy_pad(__entry->bdi, bdi_dev_name(wb->bdi), 32); __entry->write_bw =KBps (wb->write_bandwidth); __entry->avg_write_bw =KBps (wb->avg_write_bandwidth); __entry->dirty_rate =KBps (dirty_rate);
@@ -665,7 +662,7 @@ TRACE_EVENT(balance_dirty_pages, TP_fast_assign( unsigned long freerun = (thresh + bg_thresh) / 2; -strscpy_pad (__entry->bdi,dev_name (wb->bdi->dev),32 ); +strscpy_pad (__entry->bdi,bdi_dev_name (wb->bdi),32 ); __entry->limit = global_wb_domain.dirty_limit; __entry->setpoint = (global_wb_domain.dirty_limit +
@@ -726,7 +723,7 @@ TRACE_EVENT(writeback_sb_inodes_requeue,TP_fast_assign (strscpy_pad (__entry->name, - dev_name(inode_to_bdi(inode)->dev), 32); + bdi_dev_name(inode_to_bdi(inode)), 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; __entry->dirtied_when = inode->dirtied_when;
@@ -800,7 +797,7 @@ DECLARE_EVENT_CLASS(writeback_single_inoTP_fast_assign (strscpy_pad (__entry->name, - dev_name(inode_to_bdi(inode)->dev), 32); + bdi_dev_name(inode_to_bdi(inode)), 32); __entry->ino = inode->i_ino; __entry->state = inode->i_state; __entry->dirtied_when = inode->dirtied_when;
mm/backing-dev.c +1 -0
@@ -21,6 +21,7 @@ struct backing_dev_info noop_backing_devEXPORT_SYMBOL_GPL (noop_backing_dev_info);static struct class *bdi_class; +const char *bdi_unknown_name ="(unknown)" ;/* * bdi_lock protects bdi_tree and updates to bdi_list. bdi_list has RCU
Greg Kroah-Hartman
maintainerPATCH 52/367 ALSA: usb-audio: Annotate endianess in Scarlett gen2 quirk
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit d8f489355cff55b30731354317739a00cf1238bd upstream.
The Scarlett gen2 mixer quirk code defines a few record types to communicate via USB hub, and those must be all little-endian. This patch changes the field types to LE to annotate endianess properly. It also fixes the incorrect usage of leXX_to_cpu() in a couple of places, which was caught by sparse after this change.
--- sound/usb/mixer_scarlett_gen2.c | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-)
sound/usb/mixer_scarlett_gen2.c +23 -23
@@ -558,11 +558,11 @@ static const struct scarlett2_config/* proprietary request/response format */ struct scarlett2_usb_packet { -u32 cmd; -u16 size; -u16 seq; -u32 error; -u32 pad; +__le32 cmd; +__le16 size; +__le16 seq; +__le32 error; +__le32 pad;u8 data[]; };
@@ -664,11 +664,11 @@ static int scarlett2_usb("Scarlett Gen 2 USB invalid response; " "cmd tx/rx %d/%d seq %d/%d size %d/%d " "error %d pad %d\n" , -le16_to_cpu (req->cmd),le16_to_cpu (resp->cmd), +le32_to_cpu (req->cmd),le32_to_cpu (resp->cmd),le16_to_cpu (req->seq),le16_to_cpu (resp->seq), resp_size,le16_to_cpu (resp->size), -le16_to_cpu (resp->error), - le16_to_cpu(resp->pad)); +le32_to_cpu (resp->error), + le32_to_cpu(resp->pad)); err = -EINVAL ; goto unlock; }
@@ -687,7 +687,7 @@ error:/* Send SCARLETT2_USB_DATA_CMD SCARLETT2_USB_CONFIG_SAVE */ static void scarlett2_config_save (struct usb_mixer_interface *mixer) { -u32 req =cpu_to_le32 (SCARLETT2_USB_CONFIG_SAVE ); +__le32 req =cpu_to_le32 (SCARLETT2_USB_CONFIG_SAVE ); scarlett2_usb(mixer, SCARLETT2_USB_DATA_CMD, &req, sizeof(u32),
@@ -713,11 +713,11 @@ static int scarlett2_usb_set_config(const struct scarlett2_config config_item = scarlett2_config_items[config_item_num];struct { -u32 offset; -u32 bytes; -s32 value; +__le32 offset; +__le32 bytes; +__le32 value; } __packed req; -u32 req2; +__le32 req2;int err;struct scarlett2_mixer_data *private = mixer->private_data;
@@ -753,8 +753,8 @@ static int scarlett2_usb_get( int offset, void *buf, int size) { struct { - u32 offset; -u32 size; + __le32 offset; +__le32 size; }__packed req; req.offset =cpu_to_le32 (offset);
@@ -794,8 +794,8 @@ static int scarlett2_usb_set_mix(structconst struct scarlett2_device_info *info = private->info;struct { -u16 mix_num; -u16 data[SCARLETT2_INPUT_MIX_MAX ]; +__le16 mix_num; +__le16 data[SCARLETT2_INPUT_MIX_MAX ]; } __packed req;int i, j;
@@ -850,9 +850,9 @@ static int scarlett2_usb_set_mux(struct };struct { -u16 pad; -u16 num; -u32 data[SCARLETT2_MUX_MAX ]; +__le16 pad; +__le16 num; +__le32 data[SCARLETT2_MUX_MAX ]; } __packed req; req.pad =0 ;
@@ -911,9 +911,9 @@ static int scarlett2_usb_get_meter_level u16 *levels) {struct { -u16 pad; -u16 num_meters; -u32 magic; +__le16 pad; +__le16 num_meters; +__le32 magic; } __packed req;u32 resp[SCARLETT2_NUM_METERS ];int i, err;
Greg Kroah-Hartman
maintainerPATCH 51/367 ALSA: usb-audio: Fix endianess in descriptor validation
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit f8e5f90b3a53bb75f05124ed19156388379a337d upstream.
I overlooked that some fields are words and need the converts from LE in the recently added USB descriptor validation code. This patch fixes those with the proper macro usages.
--- sound/usb/validate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/usb/validate.c +3 -3
@@ -110,7 +110,7 @@ static bool validate_processing_unit(condefault :if (v->type ==UAC1_EXTENSION_UNIT )return true;/* OK */ -switch (d->wProcessType) { +switch (le16_to_cpu (d->wProcessType)) {case UAC_PROCESS_UP_DOWNMIX :case UAC_PROCESS_DOLBY_PROLOGIC :if (d->bLength < len +1 )/* bNrModes */
@@ -125,7 +125,7 @@ static bool validate_processing_unit(concase UAC_VERSION_2 :if (v->type ==UAC2_EXTENSION_UNIT_V2 )return true;/* OK */ -switch (d->wProcessType) { +switch (le16_to_cpu (d->wProcessType)) {case UAC2_PROCESS_UP_DOWNMIX :case UAC2_PROCESS_DOLBY_PROLOCIC :/* SiC! */ if (d->bLength < len +1 )/* bNrModes */
@@ -142,7 +142,7 @@ static bool validate_processing_unit(con len +=2 ;/* wClusterDescrID */ break ; } -switch (d->wProcessType) { +switch (le16_to_cpu (d->wProcessType)) {case UAC3_PROCESS_UP_DOWNMIX :if (d->bLength < len +1 )/* bNrModes */ return false;
Greg Kroah-Hartman
maintainerPATCH 49/367 usb: gadget: f_ncm: Use atomic_t to track in-flight request
In reply to Greg Kroah-HartmanFrom: Bryan O'Donoghue <[email protected]>
commit 5b24c28cfe136597dc3913e1c00b119307a20c7e upstream.
Currently ncm->notify_req is used to flag when a request is in-flight. ncm->notify_req is set to NULL and when a request completes it is subsequently reset.
This is fundamentally buggy in that the unbind logic of the NCM driver will unconditionally free ncm->notify_req leading to a NULL pointer dereference.
--- drivers/usb/gadget/function/f_ncm.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_ncm.c +13 -4
@@ -53,6 +53,7 @@ struct f_ncm {struct usb_ep *notify;struct usb_request *notify_req;u8 notify_state; +atomic_t notify_count;bool is_open;const struct ndp_parser_opts *parser_opts;
@@ -547,7 +548,7 @@ static void ncm_do_notify(struct f_ncm *int status;/* notification already in flight? */ -if (!req) +if (atomic_read (&ncm->notify_count))return ; event = req->buf;
@@ -587,7 +588,8 @@ static void ncm_do_notify(struct f_ncm * event->bmRequestType =0xA1 ; event->wIndex =cpu_to_le16 (ncm->ctrl_id); - ncm->notify_req =NULL ; +atomic_inc (&ncm->notify_count); +/* * In double buffering if there is a space in FIFO, * completion callback can be called right after the call,
@@ -597,7 +599,7 @@ static void ncm_do_notify(struct f_ncm * status =usb_ep_queue (ncm->notify, req,GFP_ATOMIC );spin_lock (&ncm->lock);if (status <0 ) { - ncm->notify_req = req; +atomic_dec (&ncm->notify_count);DBG (cdev,"notify --> %d\n" , status); } }
@@ -632,17 +634,19 @@ static void ncm_notify_complete(struct ucase 0 :VDBG (cdev,"Notification %02x sent\n" , event->bNotificationType); +atomic_dec (&ncm->notify_count);break ;case -ECONNRESET :case -ESHUTDOWN : +atomic_set (&ncm->notify_count,0 ); ncm->notify_state =NCM_NOTIFY_NONE ;break ;default :DBG (cdev,"event %02x --> %d\n" , event->bNotificationType, req->status); +atomic_dec (&ncm->notify_count);break ; } - ncm->notify_req = req;ncm_do_notify (ncm);spin_unlock (&ncm->lock); }
@@ -1649,6 +1653,11 @@ static void ncm_unbind(struct usb_config ncm_string_defs[0 ].id =0 ;usb_free_all_descriptors (f); +if (atomic_read (&ncm->notify_count)) { +usb_ep_dequeue (ncm->notify, ncm->notify_req); +atomic_set (&ncm->notify_count,0 ); + } +kfree (ncm->notify_req->buf);usb_ep_free_request (ncm->notify, ncm->notify_req); }
Greg Kroah-Hartman
maintainerPATCH 47/367 usb: gadget: f_fs: set req->num_sgs as 0 for non-sg transfer
In reply to Greg Kroah-HartmanFrom: Peter Chen <[email protected]>
commit d2450c6937018d40d4111fe830fa48d4ddceb8d0 upstream.
The UDC core uses req->num_sgs to judge if scatter buffer list is used.
Eg: usb_gadget_map_request_by_dev. For f_fs sync io mode, the request is re-used for each request, so if the 1st request->length > PAGE_SIZE, and the 2nd request->length is <= PAGE_SIZE, the f_fs uses the 1st req->num_sgs for the 2nd request, it causes the UDC core get the wrong req->num_sgs value (The 2nd request doesn't use sg). For f_fs async io mode, it is not harm to initialize req->num_sgs as 0 either, in case, the UDC driver doesn't zeroed request structure.
--- drivers/usb/gadget/function/f_fs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/f_fs.c +2 -0
@@ -1062,6 +1062,7 @@ static ssize_t ffs_epfile_io(struct file req->num_sgs = io_data->sgt.nents; }else { req->buf = data; + req->num_sgs =0 ; } req->length = data_len;
@@ -1105,6 +1106,7 @@ static ssize_t ffs_epfile_io(struct file req->num_sgs = io_data->sgt.nents; }else { req->buf = data; + req->num_sgs =0 ; } req->length = data_len;
Greg Kroah-Hartman
maintainerPATCH 40/367 Bluetooth: btusb: fix memory leak on fw
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
commit 3168c19d7eb17a0108a3b60ad8e8c1b18ea05c63 upstream.
Currently the error return path when the call to btusb_mtk_hci_wmt_sync fails does not free fw. Fix this by returning via the error_release_fw label that performs the free'ing.
Addresses-Coverity: ("Resource leak")
--- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btusb.c +1 -1
@@ -2867,7 +2867,7 @@ static int btusb_mtk_setup_firmware(stru err =btusb_mtk_hci_wmt_sync (hdev, &wmt_params);if (err <0 ) {bt_dev_err (hdev,"Failed to send wmt rst (%d)" , err); -return err; + goto err_release_fw; }/* Wait a few moments for firmware activation done */
Greg Kroah-Hartman
maintainerPATCH 42/367 brcmfmac: Fix memory leak in brcmf_usbdev_qinit
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
commit 4282dc057d750c6a7dd92953564b15c26b54c22c upstream.
In the implementation of brcmf_usbdev_qinit() the allocated memory for reqs is leaking if usb_alloc_urb() fails. Release reqs in the error handling path.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +1 -0
@@ -430,6 +430,7 @@ fail:usb_free_urb (req->urb);list_del (q->next); } +kfree (reqs);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 43/367 usb: dwc3: gadget: Check END_TRANSFER completion
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit c58d8bfc77a2c7f6ff6339b58c9fca7ae6f57e70 upstream.
While the END_TRANSFER command is sent but not completed, any request dequeue during this time will cause the driver to issue the END_TRANSFER command. The driver needs to submit the command only once to stop the controller from processing further. The controller may take more time to process the same command multiple times unnecessarily. Let's add a flag DWC3_EP_END_TRANSFER_PENDING to check for this condition.
--- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ep0.c | 4 +++- drivers/usb/dwc3/gadget.c | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-)
drivers/usb/dwc3/core.h +1 -0
@@ -688,6 +688,7 @@ struct dwc3_ep {#define DWC3_EP_STALL BIT(1)#define DWC3_EP_WEDGE BIT(2)#define DWC3_EP_TRANSFER_STARTED BIT(3) +#define DWC3_EP_END_TRANSFER_PENDING BIT(4)#define DWC3_EP_PENDING_REQUEST BIT(5)/* This last one is specific to EP0 */
drivers/usb/dwc3/ep0.c +3 -1
@@ -1136,8 +1136,10 @@ void dwc3_ep0_interrupt(struct dwc3 *dwccase DWC3_DEPEVT_EPCMDCMPLT : cmd =DEPEVT_PARAMETER_CMD (event->parameters); -if (cmd ==DWC3_DEPCMD_ENDTRANSFER ) +if (cmd ==DWC3_DEPCMD_ENDTRANSFER ) { + dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING ; dep->flags &= ~DWC3_EP_TRANSFER_STARTED ; + }break ; } }
drivers/usb/dwc3/gadget.c +5 -1
@@ -2625,6 +2625,7 @@ static void dwc3_endpoint_interrupt(stru cmd =DEPEVT_PARAMETER_CMD (event->parameters);if (cmd ==DWC3_DEPCMD_ENDTRANSFER ) { + dep->flags &= ~DWC3_EP_END_TRANSFER_PENDING ; dep->flags &= ~DWC3_EP_TRANSFER_STARTED ;dwc3_gadget_ep_cleanup_cancelled_requests (dep); }
@@ -2683,7 +2684,8 @@ static void dwc3_stop_active_transfer(stu32 cmd;int ret; -if (!(dep->flags &DWC3_EP_TRANSFER_STARTED )) +if (!(dep->flags &DWC3_EP_TRANSFER_STARTED ) || + (dep->flags &DWC3_EP_END_TRANSFER_PENDING ))return ;/*
@@ -2728,6 +2730,8 @@ static void dwc3_stop_active_transfer(stif (!interrupt) dep->flags &= ~DWC3_EP_TRANSFER_STARTED ; +else + dep->flags |=DWC3_EP_END_TRANSFER_PENDING ;if (dwc3_is_usb31 (dwc) || dwc->revision <DWC3_REVISION_310A )udelay (100 );
Greg Kroah-Hartman
maintainerPATCH 37/367 rcu: Use READ_ONCE() for ->expmask in rcu_read_unlock_special()
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
commit c51f83c315c392d9776c33eb16a2fe1349d65c7f upstream.
The rcu_node structure's ->expmask field is updated only when holding the ->lock, but is also accessed locklessly. This means that all ->expmask updates must use WRITE_ONCE() and all reads carried out without holding ->lock must use READ_ONCE(). This commit therefore changes the lockless ->expmask read in rcu_read_unlock_special() to use READ_ONCE().
--- kernel/rcu/tree_plugin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
@@ -612,7 +612,7 @@ static void rcu_read_unlock_special(stru t->rcu_read_unlock_special.b.exp_hint = false; exp = (t->rcu_blocked_node && t->rcu_blocked_node->exp_tasks) || - (rdp->grpmask & rnp->expmask) || + (rdp->grpmask &READ_ONCE (rnp->expmask)) ||tick_nohz_full_cpu (rdp->cpu);// Need to defer quiescent state until everything is enabled. if (irqs_were_disabled && use_softirq &&
Greg Kroah-Hartman
maintainerPATCH 36/367 srcu: Apply *_ONCE() to ->srcu_last_gp_end
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
commit 844a378de3372c923909681706d62336d702531e upstream.
The ->srcu_last_gp_end field is accessed from any CPU at any time by synchronize_srcu(), so non-initialization references need to use READ_ONCE() and WRITE_ONCE(). This commit therefore makes that change.
--- kernel/rcu/srcutree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/rcu/srcutree.c +4 -3
@@ -530,7 +530,7 @@ static void srcu_gp_end(struct srcu_stru idx =rcu_seq_state (ssp->srcu_gp_seq);WARN_ON_ONCE (idx !=SRCU_STATE_SCAN2 ); cbdelay =srcu_get_delay (ssp); - ssp->srcu_last_gp_end =ktime_get_mono_fast_ns (); +WRITE_ONCE (ssp->srcu_last_gp_end,ktime_get_mono_fast_ns ());rcu_seq_end (&ssp->srcu_gp_seq); gpseq =rcu_seq_current (&ssp->srcu_gp_seq);if (ULONG_CMP_LT (ssp->srcu_gp_seq_needed_exp, gpseq))
@@ -762,6 +762,7 @@ static bool srcu_might_be_idle(struct srunsigned long flags;struct srcu_data *sdp;unsigned long t; +unsigned long tlast;/* If the local srcu_data structure has callbacks, not idle. */ local_irq_save (flags);
@@ -780,9 +781,9 @@ static bool srcu_might_be_idle(struct sr/* First, see if enough time has passed since the last GP. */ t =ktime_get_mono_fast_ns (); + tlast =READ_ONCE (ssp->srcu_last_gp_end);if (exp_holdoff ==0 || -time_in_range_open (t, ssp->srcu_last_gp_end, - ssp->srcu_last_gp_end + exp_holdoff)) +time_in_range_open (t, tlast, tlast + exp_holdoff))return false;/* Too soon after last GP. */ /* Next, check for probable idleness. */
Greg Kroah-Hartman
maintainerPATCH 35/367 rcu: Avoid data-race in rcu_gp_fqs_check_wake()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 6935c3983b246d5fbfebd3b891c825e65c118f2d upstream.
The rcu_gp_fqs_check_wake() function uses rcu_preempt_blocked_readers_cgp() to read ->gp_tasks while other cpus might overwrite this field.
We need READ_ONCE()/WRITE_ONCE() pairs to avoid compiler tricks and KCSAN splats like the following :
BUG: KCSAN: data-race in rcu_gp_fqs_check_wake / rcu_preempt_deferred_qs_irqrestore
write to 0xffffffff85a7f190 of 8 bytes by task 7317 on cpu 0:
rcu_preempt_deferred_qs_irqrestore+0x43d/0x580 kernel/rcu/tree_plugin.h:507 rcu_read_unlock_special+0xec/0x370 kernel/rcu/tree_plugin.h:659 __rcu_read_unlock+0xcf/0xe0 kernel/rcu/tree_plugin.h:394 rcu_read_unlock include/linux/rcupdate.h:645 [inline] __ip_queue_xmit+0x3b0/0xa40 net/ipv4/ip_output.c:533 ip_queue_xmit+0x45/0x60 include/net/ip.h:236 __tcp_transmit_skb+0xdeb/0x1cd0 net/ipv4/tcp_output.c:1158 __tcp_send_ack+0x246/0x300 net/ipv4/tcp_output.c:3685 tcp_send_ack+0x34/0x40 net/ipv4/tcp_output.c:3691 tcp_cleanup_rbuf+0x130/0x360 net/ipv4/tcp.c:1575 tcp_recvmsg+0x633/0x1a30 net/ipv4/tcp.c:2179 inet_recvmsg+0xbb/0x250 net/ipv4/af_inet.c:838 sock_recvmsg_nosec net/socket.c:871 [inline] sock_recvmsg net/socket.c:889 [inline] sock_recvmsg+0x92/0xb0 net/socket.c:885 sock_read_iter+0x15f/0x1e0 net/socket.c:967 call_read_iter include/linux/fs.h:1864 [inline] new_sync_read+0x389/0x4f0 fs/read_write.c:414
read to 0xffffffff85a7f190 of 8 bytes by task 10 on cpu 1:
rcu_gp_fqs_check_wake kernel/rcu/tree.c:1556 [inline] rcu_gp_fqs_check_wake+0x93/0xd0 kernel/rcu/tree.c:1546 rcu_gp_fqs_loop+0x36c/0x580 kernel/rcu/tree.c:1611 rcu_gp_kthread+0x143/0x220 kernel/rcu/tree.c:1768 kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 10 Comm: rcu_preempt Not tainted 5.3.0+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
--- kernel/rcu/tree_plugin.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
kernel/rcu/tree_plugin.h +6 -5
@@ -220,7 +220,7 @@ static void rcu_preempt_ctxt_queue(struc* blocked tasks. */ if (!rnp->gp_tasks && (blkd_state &RCU_GP_BLKD )) { - rnp->gp_tasks = &t->rcu_node_entry; +WRITE_ONCE (rnp->gp_tasks, &t->rcu_node_entry);WARN_ON_ONCE (rnp->completedqs == rnp->gp_seq); }if (!rnp->exp_tasks && (blkd_state &RCU_EXP_BLKD ))
@@ -340,7 +340,7 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switc*/ static int rcu_preempt_blocked_readers_cgp (struct rcu_node *rnp) { -return rnp->gp_tasks !=NULL ; +return READ_ONCE (rnp->gp_tasks) !=NULL ; }/* Bias and limit values for ->rcu_read_lock_nesting. */
@@ -493,7 +493,7 @@ rcu_preempt_deferred_qs_irqrestore(structrace_rcu_unlock_preempted_task (TPS ("rcu_preempt" ), rnp->gp_seq, t->pid);if (&t->rcu_node_entry == rnp->gp_tasks) - rnp->gp_tasks = np; +WRITE_ONCE (rnp->gp_tasks, np);if (&t->rcu_node_entry == rnp->exp_tasks) rnp->exp_tasks = np;if (IS_ENABLED (CONFIG_RCU_BOOST )) {
@@ -663,7 +663,7 @@ static void rcu_preempt_check_blocked_tadump_blkd_tasks (rnp,10 );if (rcu_preempt_has_tasks (rnp) && (rnp->qsmaskinit || rnp->wait_blkd_tasks)) { - rnp->gp_tasks = rnp->blkd_tasks.next; +WRITE_ONCE (rnp->gp_tasks, rnp->blkd_tasks.next); t = container_of(rnp->gp_tasks, struct task_struct, rcu_node_entry); trace_rcu_unlock_preempted_task(TPS("rcu_preempt-GPS"),
@@ -757,7 +757,8 @@ dump_blkd_tasks(struct rcu_node *rnp, inpr_info ("%s: %d:%d ->qsmask %#lx ->qsmaskinit %#lx ->qsmaskinitnext %#lx\n" , __func__, rnp1->grplo, rnp1->grphi, rnp1->qsmask, rnp1->qsmaskinit, rnp1->qsmaskinitnext);pr_info ("%s: ->gp_tasks %p ->boost_tasks %p ->exp_tasks %p\n" , - __func__, rnp->gp_tasks, rnp->boost_tasks, rnp->exp_tasks); + __func__,READ_ONCE (rnp->gp_tasks), rnp->boost_tasks, + rnp->exp_tasks);pr_info ("%s: ->blkd_tasks" , __func__); i =0 ;list_for_each (lhp, &rnp->blkd_tasks) {
Greg Kroah-Hartman
maintainerPATCH 8/367 net: mvneta: fix XDP support if sw bm is used as fallback
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 44efc78d0e464ce70b45b165c005f8bedc17952e ]
In order to fix XDP support if sw buffer management is used as fallback for hw bm devices, define MVNETA_SKB_HEADROOM as maximum between XDP_PACKET_HEADROOM and NET_SKB_PAD and let the hw aligns the IP header to 4-byte boundary.
Fix rx_offset_correction initialization if mvneta_bm_port_init fails in mvneta_resume routine
--- drivers/net/ethernet/marvell/mvneta.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvneta.c +7 -3
@@ -324,8 +324,7 @@ ETH_HLEN + ETH_FCS_LEN, \ cache_line_size()) -#define MVNETA_SKB_HEADROOM (max(XDP_PACKET_HEADROOM, NET_SKB_PAD) + \ - NET_IP_ALIGN) +#define MVNETA_SKB_HEADROOM max(XDP_PACKET_HEADROOM, NET_SKB_PAD)#define MVNETA_SKB_PAD (SKB_DATA_ALIGN(sizeof(struct skb_shared_info) + \ MVNETA_SKB_HEADROOM))#define MVNETA_SKB_SIZE (len) (SKB_DATA_ALIGN(len) + MVNETA_SKB_PAD)
@@ -1167,6 +1166,7 @@ bm_mtu_err:mvneta_bm_pool_destroy (pp->bm_priv, pp->pool_short,1 << pp->id); pp->bm_priv =NULL ; + pp->rx_offset_correction =MVNETA_SKB_HEADROOM ;mvreg_write (pp,MVNETA_ACC_MODE ,MVNETA_ACC_MODE_EXT1 );netdev_info (pp->dev,"fail to update MTU, fall back to software BM\n" ); }
@@ -4948,7 +4948,6 @@ static int mvneta_probe(struct platform_SET_NETDEV_DEV (dev, &pdev->dev); pp->id = global_port_id++; - pp->rx_offset_correction =MVNETA_SKB_HEADROOM ;/* Obtain access to BM resources if enabled and already initialized */ bm_node =of_parse_phandle (dn,"buffer-manager" ,0 );
@@ -4973,6 +4972,10 @@ static int mvneta_probe(struct platform_ }of_node_put (bm_node); +/* sw buffer management */ +if (!pp->bm_priv) + pp->rx_offset_correction =MVNETA_SKB_HEADROOM ; + err =mvneta_init (&pdev->dev, pp);if (err <0 ) goto err_netdev;
@@ -5130,6 +5133,7 @@ static int mvneta_resume(struct device * err =mvneta_bm_port_init (pdev, pp);if (err <0 ) {dev_info (&pdev->dev,"use SW buffer management\n" ); + pp->rx_offset_correction =MVNETA_SKB_HEADROOM ; pp->bm_priv =NULL ; } }
Greg Kroah-Hartman
maintainerPATCH 9/367 bnxt_en: Fix TC queue mapping.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 18e4960c18f484ac288f41b43d0e6c4c88e6ea78 ]
The driver currently only calls netdev_set_tc_queue when the number of TCs is greater than 1. Instead, the comparison should be greater than or equal to 1. Even with 1 TC, we need to set the queue mapping.
This bug can cause warnings when the number of TCs is changed back to 1.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -7892,7 +7892,7 @@ static void bnxt_setup_msix(struct bnxtint tcs, i; tcs =netdev_get_num_tc (dev); -if (tcs >1 ) { +if (tcs) {int i, off, count;for (i =0 ; i < tcs; i++) {
Greg Kroah-Hartman
maintainerPATCH 6/367 net_sched: fix an OOB access in cls_tcindex
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit 599be01ee567b61f4471ee8078870847d0a11e8e ]
As Eric noticed, tcindex_alloc_perfect_hash() uses cp->hash to compute the size of memory allocation, but cp->hash is set again after the allocation, this caused an out-of-bound access.
So we have to move all cp->hash initialization and computation before the memory allocation. Move cp->mask and cp->shift together as cp->hash may need them for computation too.
--- net/sched/cls_tcindex.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
net/sched/cls_tcindex.c +20 -20
@@ -333,12 +333,31 @@ tcindex_set_parms(struct net *net, struc cp->fall_through = p->fall_through; cp->tp = tp; +if (tb[TCA_TCINDEX_HASH ]) + cp->hash =nla_get_u32 (tb[TCA_TCINDEX_HASH ]); + +if (tb[TCA_TCINDEX_MASK ]) + cp->mask =nla_get_u16 (tb[TCA_TCINDEX_MASK ]); + +if (tb[TCA_TCINDEX_SHIFT ]) + cp->shift =nla_get_u32 (tb[TCA_TCINDEX_SHIFT ]); + +if (!cp->hash) { +/* Hash not specified, use perfect hash if the upper limit +* of the hashing index is below the threshold. +*/ +if ((cp->mask >> cp->shift) <PERFECT_HASH_THRESHOLD ) + cp->hash = (cp->mask >> cp->shift) +1 ; +else + cp->hash =DEFAULT_HASH_SIZE ; + } +if (p->perfect) {int i;if (tcindex_alloc_perfect_hash (net, cp) <0 ) goto errout; -for (i =0 ; i < cp->hash; i++) +for (i =0 ; i <min (cp->hash, p->hash); i++) cp->perfect[i].res = p->perfect[i].res; balloc =1 ; }
@@ -350,15 +369,6 @@ tcindex_set_parms(struct net *net, strucif (old_r) cr = r->res; -if (tb[TCA_TCINDEX_HASH ]) - cp->hash =nla_get_u32 (tb[TCA_TCINDEX_HASH ]); - -if (tb[TCA_TCINDEX_MASK ]) - cp->mask =nla_get_u16 (tb[TCA_TCINDEX_MASK ]); - -if (tb[TCA_TCINDEX_SHIFT ]) - cp->shift =nla_get_u32 (tb[TCA_TCINDEX_SHIFT ]); - err = -EBUSY ;/* Hash already allocated, make sure that we still meet the
@@ -376,16 +386,6 @@ tcindex_set_parms(struct net *net, strucif (tb[TCA_TCINDEX_FALL_THROUGH ]) cp->fall_through =nla_get_u32 (tb[TCA_TCINDEX_FALL_THROUGH ]); -if (!cp->hash) { -/* Hash not specified, use perfect hash if the upper limit -* of the hashing index is below the threshold. -*/ -if ((cp->mask >> cp->shift) <PERFECT_HASH_THRESHOLD ) - cp->hash = (cp->mask >> cp->shift) +1 ; -else - cp->hash =DEFAULT_HASH_SIZE ; - } -if (!cp->perfect && !cp->h) cp->alloc_hash = cp->hash;
Greg Kroah-Hartman
maintainerPATCH 3/367 gtp: use __GFP_NOWARN to avoid memalloc warning
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
[ Upstream commit bd5cd35b782abf5437fbd01dfaee12437d20e832 ]
gtp hashtable size is received by user-space.
So, this hashtable size could be too large. If so, kmalloc will internally print a warning message.
This warning message is actually not necessary for the gtp module. So, this patch adds __GFP_NOWARN to avoid this message.
Splat looks like:
[ 2171.200049][ T1860] WARNING: CPU: 1 PID: 1860 at mm/page_alloc.c:4713 __alloc_pages_nodemask+0x2f3/0x740 [ 2171.238885][ T1860] Modules linked in: gtp veth openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv] [ 2171.262680][ T1860] CPU: 1 PID: 1860 Comm: gtp-link Not tainted 5.5.0+ #321 [ 2171.263567][ T1860] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 2171.264681][ T1860] RIP: 0010:__alloc_pages_nodemask+0x2f3/0x740 [ 2171.265332][ T1860] Code: 64 fe ff ff 65 48 8b 04 25 c0 0f 02 00 48 05 f0 12 00 00 41 be 01 00 00 00 49 89 47 0 [ 2171.267301][ T1860] RSP: 0018:ffff8880b51af1f0 EFLAGS: 00010246 [ 2171.268320][ T1860] RAX: ffffed1016a35e43 RBX: 0000000000000000 RCX: 0000000000000000 [ 2171.269517][ T1860] RDX: 0000000000000000 RSI: 000000000000000b RDI: 0000000000000000 [ 2171.270305][ T1860] RBP: 0000000000040cc0 R08: ffffed1018893109 R09: dffffc0000000000 [ 2171.275973][ T1860] R10: 0000000000000001 R11: ffffed1018893108 R12: 1ffff11016a35e43 [ 2171.291039][ T1860] R13: 000000000000000b R14: 000000000000000b R15: 00000000000f4240 [ 2171.292328][ T1860] FS: 00007f53cbc83740(0000) GS:ffff8880da000000(0000) knlGS:0000000000000000 [ 2171.293409][ T1860] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2171.294586][ T1860] CR2: 000055f540014508 CR3: 00000000b49f2004 CR4: 00000000000606e0 [ 2171.295424][ T1860] Call Trace: [ 2171.295756][ T1860] ? mark_held_locks+0xa5/0xe0 [ 2171.296659][ T1860] ? __alloc_pages_slowpath+0x21b0/0x21b0 [ 2171.298283][ T1860] ? gtp_encap_enable_socket+0x13e/0x400 [gtp] [ 2171.298962][ T1860] ? alloc_pages_current+0xc1/0x1a0 [ 2171.299475][ T1860] kmalloc_order+0x22/0x80 [ 2171.299936][ T1860] kmalloc_order_trace+0x1d/0x140 [ 2171.300437][ T1860] __kmalloc+0x302/0x3a0 [ 2171.300896][ T1860] gtp_newlink+0x293/0xba0 [gtp]
[ ... ]
--- drivers/net/gtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/gtp.c +2 -2
@@ -767,12 +767,12 @@ static int gtp_hashtable_new(struct gtp_int i; gtp->addr_hash =kmalloc_array (hsize,sizeof (struct hlist_head ), -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (gtp->addr_hash ==NULL )return -ENOMEM ; gtp->tid_hash =kmalloc_array (hsize,sizeof (struct hlist_head ), -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (gtp->tid_hash ==NULL ) goto err1;
Greg Kroah-Hartman
maintainerPATCH 4/367 l2tp: Allow duplicate session creation with UDP
In reply to Greg Kroah-HartmanFrom: Ridge Kennedy <[email protected]>
[ Upstream commit 0d0d9a388a858e271bb70e71e99e7fe2a6fd6f64 ]
In the past it was possible to create multiple L2TPv3 sessions with the same session id as long as the sessions belonged to different tunnels. The resulting sessions had issues when used with IP encapsulated tunnels, but worked fine with UDP encapsulated ones. Some applications began to rely on this behaviour to avoid having to negotiate unique session ids.
Some time ago a change was made to require session ids to be unique across all tunnels, breaking the applications making use of this "feature".
This change relaxes the duplicate session id check to allow duplicates if both of the colliding sessions belong to UDP encapsulated tunnels.
--- net/l2tp/l2tp_core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/l2tp/l2tp_core.c +6 -1
@@ -322,8 +322,13 @@ int l2tp_session_register(struct l2tp_sespin_lock_bh (&pn->l2tp_session_hlist_lock); +/* IP encap expects session IDs to be globally unique, while +* UDP encap doesn't. +*/ hlist_for_each_entry (session_walk, g_head, global_hlist) -if (session_walk->session_id == session->session_id) { +if (session_walk->session_id == session->session_id && + (session_walk->tunnel->encap ==L2TP_ENCAPTYPE_IP || + tunnel->encap ==L2TP_ENCAPTYPE_IP )) { err = -EEXIST ; goto err_tlock_pnlock; }
Greg Kroah-Hartman
maintainerPATCH 7/367 net/core: Do not clear VF index for node/port GUIDs query
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 9fbf082f569980ddd7cab348e0a118678db0e47e ]
VF numbers were assigned to node_guid and port_guid, but cleared right before such query calls were issued. It caused to return node/port GUIDs of VF index 0 for all VFs.
--- net/core/rtnetlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/rtnetlink.c +2 -2
@@ -1241,6 +1241,8 @@ static noinline_for_stack int rtnl_fill_return 0 ;memset (&vf_vlan_info,0 ,sizeof (vf_vlan_info)); +memset (&node_guid,0 ,sizeof (node_guid)); +memset (&port_guid,0 ,sizeof (port_guid)); vf_mac.vf = vf_vlan.vf =
@@ -1289,8 +1291,6 @@ static noinline_for_stack int rtnl_fill_ sizeof(vf_trust), &vf_trust)) goto nla_put_vf_failure; -memset (&node_guid,0 ,sizeof (node_guid)); -memset (&port_guid,0 ,sizeof (port_guid));if (dev->netdev_ops->ndo_get_vf_guid && !dev->netdev_ops->ndo_get_vf_guid (dev, vfs_num, &node_guid, &port_guid)) {
Greg Kroah-Hartman
maintainerPATCH 2/367 bnxt_en: Move devlink_register before registering netdev
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit cda2cab0771183932d6ba73c5ac63bb63decdadf ]
Latest kernels get the phys_port_name via devlink, if ndo_get_phys_port_name is not defined. To provide the phys_port_name correctly, register devlink before registering netdev.
Also call devlink_port_type_eth_set() after registering netdev as devlink port updates the netdev structure and notifies user.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 12 ++++++++---- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 1 - 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -4
@@ -11433,9 +11433,9 @@ static void bnxt_remove_one(struct pci_dbnxt_sriov_disable (bp);bnxt_dl_fw_reporters_destroy (bp, true); -bnxt_dl_unregister (bp);pci_disable_pcie_error_reporting (pdev);unregister_netdev (dev); +bnxt_dl_unregister (bp);bnxt_shutdown_tc (bp);bnxt_cancel_sp_work (bp); bp->sp_event =0 ;
@@ -11905,11 +11905,14 @@ static int bnxt_init_one(struct pci_devbnxt_init_tc (bp); } +bnxt_dl_register (bp); + rc =register_netdev (dev);if (rc) - goto init_err_cleanup_tc; + goto init_err_cleanup; -bnxt_dl_register (bp); +if (BNXT_PF (bp)) +devlink_port_type_eth_set (&bp->dl_port, bp->dev);bnxt_dl_fw_reporters_create (bp); netdev_info(dev, "%s found at mem %lx, node addr %pM\n",
@@ -11919,7 +11922,8 @@ static int bnxt_init_one(struct pci_devreturn 0 ; -init_err_cleanup_tc: +init_err_cleanup: +bnxt_dl_unregister (bp);bnxt_shutdown_tc (bp);bnxt_clear_int_mode (bp);
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +0 -1
@@ -526,7 +526,6 @@ int bnxt_dl_register(struct bnxt *bp)netdev_err (bp->dev,"devlink_port_register failed" ); goto err_dl_param_unreg; } -devlink_port_type_eth_set (&bp->dl_port, bp->dev); rc =devlink_port_params_register (&bp->dl_port, bnxt_dl_port_params,ARRAY_SIZE (bnxt_dl_port_params));
Greg Kroah-Hartman
maintainerPATCH 20/367 bnxt_en: Refactor logic to re-enable SRIOV after firmware reset detected.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit c16d4ee0e397163fe7ceac281eaa952e63fadec7 ]
Put the current logic in bnxt_open() to re-enable SRIOV after detecting firmware reset into a new function bnxt_reenable_sriov(). This call needs to be invoked in the firmware reset path also in the next patch.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -7
@@ -9240,6 +9240,17 @@ void bnxt_half_close_nic(struct bnxt *bpbnxt_free_mem (bp, false); } +static void bnxt_reenable_sriov (struct bnxt *bp) +{ +if (BNXT_PF (bp)) { +struct bnxt_pf_info *pf = &bp->pf; +int n = pf->active_vfs; + +if (n) +bnxt_cfg_hw_sriov (bp, &n, true); + } +} +static int bnxt_open (struct net_device *dev) {struct bnxt *bp =netdev_priv (dev);
@@ -9258,13 +9269,7 @@ static int bnxt_open(struct net_device *bnxt_hwrm_if_change (bp, false); }else {if (test_and_clear_bit (BNXT_STATE_FW_RESET_DET , &bp->state)) { -if (BNXT_PF (bp)) { -struct bnxt_pf_info *pf = &bp->pf; -int n = pf->active_vfs; - -if (n) -bnxt_cfg_hw_sriov (bp, &n, true); - } +bnxt_reenable_sriov (bp);if (!test_bit (BNXT_STATE_IN_FW_RESET , &bp->state))bnxt_ulp_start (bp,0 ); }
Greg Kroah-Hartman
maintainerPATCH 19/367 rxrpc: Fix NULL pointer deref due to call->conn being cleared on disconnect
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 5273a191dca65a675dc0bcf3909e59c6933e2831 ]
When a call is disconnected, the connection pointer from the call is cleared to make sure it isn't used again and to prevent further attempted transmission for the call. Unfortunately, there might be a daemon trying to use it at the same time to transmit a packet.
Fix this by keeping call->conn set, but setting a flag on the call to indicate disconnection instead.
Remove also the bits in the transmission functions where the conn pointer is checked and a ref taken under spinlock as this is now redundant.
--- net/rxrpc/ar-internal.h | 1 + net/rxrpc/call_object.c | 4 ++-- net/rxrpc/conn_client.c | 3 +-- net/rxrpc/conn_object.c | 4 ++-- net/rxrpc/output.c | 27 +++++++++------------------ 5 files changed, 15 insertions(+), 24 deletions(-)
net/rxrpc/ar-internal.h +1 -0
@@ -490,6 +490,7 @@ enum rxrpc_call_flag {RXRPC_CALL_RX_HEARD ,/* The peer responded at least once to this call */ RXRPC_CALL_RX_UNDERRUN ,/* Got data underrun */ RXRPC_CALL_IS_INTR ,/* The call is interruptible */ + RXRPC_CALL_DISCONNECTED, /* The call has been disconnected */ };/*
net/rxrpc/call_object.c +2 -2
@@ -493,7 +493,7 @@ void rxrpc_release_call(struct rxrpc_soc_debug ("RELEASE CALL %p (%d CONN %p)" , call, call->debug_id, conn); -if (conn) +if (conn && !test_bit (RXRPC_CALL_DISCONNECTED , &call->flags))rxrpc_disconnect_call (call);if (call->security) call->security->free_call_crypto (call);
@@ -569,6 +569,7 @@ static void rxrpc_rcu_destroy_call(struc struct rxrpc_call *call = container_of(rcu, struct rxrpc_call, rcu);struct rxrpc_net *rxnet = call->rxnet; +rxrpc_put_connection (call->conn);rxrpc_put_peer (call->peer);kfree (call->rxtx_buffer);kfree (call->rxtx_annotations);
@@ -590,7 +591,6 @@ void rxrpc_cleanup_call(struct rxrpc_cal ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);ASSERT (test_bit (RXRPC_CALL_RELEASED , &call->flags)); - ASSERTCMP(call->conn, ==, NULL);rxrpc_cleanup_ring (call);rxrpc_free_skb (call->tx_pending, rxrpc_skb_cleaned);
net/rxrpc/conn_client.c +1 -2
@@ -785,6 +785,7 @@ void rxrpc_disconnect_client_call(structu32 cid;spin_lock (&conn->channel_lock); +set_bit (RXRPC_CALL_DISCONNECTED , &call->flags); cid = call->cid;if (cid) {
@@ -792,7 +793,6 @@ void rxrpc_disconnect_client_call(struct chan = &conn->channels[channel]; }trace_rxrpc_client (conn, channel, rxrpc_client_chan_disconnect); - call->conn =NULL ;/* Calls that have never actually been assigned a channel can simply be * discarded. If the conn didn't get used either, it will follow
@@ -908,7 +908,6 @@ out:spin_unlock (&rxnet->client_conn_cache_lock); out_2:spin_unlock (&conn->channel_lock); -rxrpc_put_connection (conn);_leave ("" );return ;
net/rxrpc/conn_object.c +2 -2
@@ -171,6 +171,8 @@ void __rxrpc_disconnect_call(struct rxrp_enter ("%d,%x" , conn->debug_id, call->cid); +set_bit (RXRPC_CALL_DISCONNECTED , &call->flags); +if (rcu_access_pointer (chan->call) == call) {/* Save the result of the call so that we can repeat it if necessary * through the channel, whilst disposing of the actual call record.
@@ -223,9 +225,7 @@ void rxrpc_disconnect_call(struct rxrpc___rxrpc_disconnect_call (conn, call);spin_unlock (&conn->channel_lock); - call->conn =NULL ; conn->idle_timestamp = jiffies; -rxrpc_put_connection (conn); }/*
net/rxrpc/output.c +9 -18
@@ -129,7 +129,7 @@ static size_t rxrpc_fill_out_ack(structint rxrpc_send_ack_packet (struct rxrpc_call *call,bool ping,rxrpc_serial_t *_serial) { -struct rxrpc_connection *conn =NULL ; +struct rxrpc_connection *conn;struct rxrpc_ack_buffer *pkt;struct msghdr msg;struct kvec iov[2 ];
@@ -139,18 +139,14 @@ int rxrpc_send_ack_packet(struct rxrpc_cint ret;u8 reason; -spin_lock_bh (&call->lock); -if (call->conn) - conn =rxrpc_get_connection_maybe (call->conn); -spin_unlock_bh (&call->lock); -if (!conn) +if (test_bit (RXRPC_CALL_DISCONNECTED , &call->flags))return -ECONNRESET ; pkt =kzalloc (sizeof (*pkt),GFP_KERNEL ); -if (!pkt) { -rxrpc_put_connection (conn); +if (!pkt)return -ENOMEM ; - } + + conn = call->conn; msg.msg_name = &call->peer->srx.transport; msg.msg_namelen = call->peer->srx.transport_len;
@@ -244,7 +240,6 @@ int rxrpc_send_ack_packet(struct rxrpc_c } out: -rxrpc_put_connection (conn);kfree (pkt);return ret; }
@@ -254,7 +249,7 @@ out:*/ int rxrpc_send_abort_packet (struct rxrpc_call *call) { -struct rxrpc_connection *conn =NULL ; +struct rxrpc_connection *conn;struct rxrpc_abort_buffer pkt;struct msghdr msg;struct kvec iov[1 ];
@@ -271,13 +266,11 @@ int rxrpc_send_abort_packet(struct rxrpc test_bit(RXRPC_CALL_TX_LAST, &call->flags))return 0 ; -spin_lock_bh (&call->lock); -if (call->conn) - conn =rxrpc_get_connection_maybe (call->conn); -spin_unlock_bh (&call->lock); -if (!conn) +if (test_bit (RXRPC_CALL_DISCONNECTED , &call->flags))return -ECONNRESET ; + conn = call->conn; + msg.msg_name = &call->peer->srx.transport; msg.msg_namelen = call->peer->srx.transport_len; msg.msg_control =NULL ;
@@ -312,8 +305,6 @@ int rxrpc_send_abort_packet(struct rxrpctrace_rxrpc_tx_packet (call->debug_id, &pkt.whdr, rxrpc_tx_point_call_abort);rxrpc_tx_backoff (call, ret); - -rxrpc_put_connection (conn);return ret; }
Greg Kroah-Hartman
maintainerPATCH 17/367 rxrpc: Fix insufficient receive notification generation
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit f71dbf2fb28489a79bde0dca1c8adfb9cdb20a6b ]
In rxrpc_input_data(), rxrpc_notify_socket() is called if the base sequence number of the packet is immediately following the hard-ack point at the end of the function. However, this isn't sufficient, since the recvmsg side may have been advancing the window and then overrun the position in which we're adding - at which point rx_hard_ack >= seq0 and no notification is generated.
Fix this by always generating a notification at the end of the input function.
Without this, a long call may stall, possibly indefinitely.
--- net/rxrpc/input.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/rxrpc/input.c +2 -4
@@ -599,10 +599,8 @@ ack: false, true, rxrpc_propose_ack_input_data); -if (seq0 ==READ_ONCE (call->rx_hard_ack) +1 ) { -trace_rxrpc_notify_socket (call->debug_id, serial); -rxrpc_notify_socket (call); - } +trace_rxrpc_notify_socket (call->debug_id, serial); +rxrpc_notify_socket (call); unlock:spin_unlock (&call->input_lock);
Greg Kroah-Hartman
maintainerPATCH 16/367 rxrpc: Fix use-after-free in rxrpc_put_local()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit fac20b9e738523fc884ee3ea5be360a321cd8bad ]
Fix rxrpc_put_local() to not access local->debug_id after calling atomic_dec_return() as, unless that returned n==0, we no longer have the right to access the object.
--- net/rxrpc/local_object.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/rxrpc/local_object.c +4 -1
@@ -364,11 +364,14 @@ void rxrpc_queue_local(struct rxrpc_locavoid rxrpc_put_local (struct rxrpc_local *local) {const void *here =__builtin_return_address (0 ); +unsigned int debug_id;int n;if (local) { + debug_id = local->debug_id; + n =atomic_dec_return (&local->usage); -trace_rxrpc_local (local->debug_id, rxrpc_local_put, n, here); +trace_rxrpc_local (debug_id, rxrpc_local_put, n, here);if (n ==0 )call_rcu (&local->rcu, rxrpc_local_rcu);
Greg Kroah-Hartman
maintainerPATCH 14/367 tcp: clear tp->segs_{in|out} in tcp_disconnect()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 784f8344de750a41344f4bbbebb8507a730fc99c ]
tp->segs_in and tp->segs_out need to be cleared in tcp_disconnect().
tcp_disconnect() is rarely used, but it is worth fixing it.
--- net/ipv4/tcp.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/tcp.c +2 -0
@@ -2638,6 +2638,8 @@ int tcp_disconnect(struct sock *sk, int sk->sk_rx_dst =NULL ;tcp_saved_syn_free (tp); tp->compressed_ack =0 ; + tp->segs_in =0 ; + tp->segs_out =0 ; tp->bytes_sent =0 ; tp->bytes_acked =0 ; tp->bytes_received =0 ;
Greg Kroah-Hartman
maintainerPATCH 10/367 net: stmmac: Delete txtimer in suspend()
In reply to Greg Kroah-HartmanFrom: Nicolin Chen <[email protected]>
[ Upstream commit 14b41a2959fbaa50932699d32ceefd6643abacc6 ]
When running v5.5 with a rootfs on NFS, memory abort may happen in the system resume stage:
Unable to handle kernel paging request at virtual address dead00000000012a [dead00000000012a] address between user and kernel address ranges pc : run_timer_softirq+0x334/0x3d8 lr : run_timer_softirq+0x244/0x3d8 x1 : ffff800011cafe80 x0 : dead000000000122 Call trace: run_timer_softirq+0x334/0x3d8 efi_header_end+0x114/0x234 irq_exit+0xd0/0xd8 __handle_domain_irq+0x60/0xb0 gic_handle_irq+0x58/0xa8 el1_irq+0xb8/0x180 arch_cpu_idle+0x10/0x18 do_idle+0x1d8/0x2b0 cpu_startup_entry+0x24/0x40 secondary_start_kernel+0x1b4/0x208 Code: f9000693 a9400660 f9000020 b4000040 (f9000401) ---[ end trace bb83ceeb4c482071 ]--- Kernel panic - not syncing: Fatal exception in interrupt SMP: stopping secondary CPUs SMP: failed to stop secondary CPUs 2-3 Kernel Offset: disabled CPU features: 0x00002,2300aa30 Memory Limit: none ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
It's found that stmmac_xmit() and stmmac_resume() sometimes might run concurrently, possibly resulting in a race condition between mod_timer() and setup_timer(), being called by stmmac_xmit() and stmmac_resume() respectively.
Since the resume() runs setup_timer() every time, it'd be safer to have del_timer_sync() in the suspend() as the counterpart.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +4 -0
@@ -4860,6 +4860,7 @@ int stmmac_suspend(struct device *dev) {struct net_device *ndev =dev_get_drvdata (dev);struct stmmac_priv *priv =netdev_priv (ndev); +u32 chan;if (!ndev || !netif_running (ndev))return 0 ;
@@ -4873,6 +4874,9 @@ int stmmac_suspend(struct device *dev)stmmac_disable_all_queues (priv); +for (chan =0 ; chan < priv->plat->tx_queues_to_use; chan++) +del_timer_sync (&priv->tx_queue[chan].txtimer); +/* Stop TX/RX DMA */ stmmac_stop_all_dma (priv);
Greg Kroah-Hartman
maintainerPATCH 11/367 tcp: clear tp->total_retrans in tcp_disconnect()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit c13c48c00a6bc1febc73902505bdec0967bd7095 ]
total_retrans needs to be cleared in tcp_disconnect().
tcp_disconnect() is rarely used, but it is worth fixing it.
--- net/ipv4/tcp.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp.c +1 -0
@@ -2625,6 +2625,7 @@ int tcp_disconnect(struct sock *sk, inttcp_set_ca_state (sk, TCP_CA_Open); tp->is_sack_reneg =0 ;tcp_clear_retrans (tp); + tp->total_retrans =0 ;inet_csk_delack_init (sk);/* Initialize rcv_mss to TCP_MIN_MSS to avoid division by 0 * issue in __tcp_select_window()
Greg Kroah-Hartman
maintainerPATCH 1/367 sparc32: fix struct ipc64_perm type definition
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 34ca70ef7d3a9fa7e89151597db5e37ae1d429b4 ]
As discussed in the strace issue tracker, it appears that the sparc32 sysvipc support has been broken for the past 11 years. It was however working in compat mode, which is how it must have escaped most of the regular testing.
The problem is that a cleanup patch inadvertently changed the uid/gid fields in struct ipc64_perm from 32-bit types to 16-bit types in uapi headers.
Both glibc and uclibc-ng still use the original types, so they should work fine with compat mode, but not natively. Change the definitions to use __kernel_uid32_t and __kernel_gid32_t again.
--- arch/sparc/include/uapi/asm/ipcbuf.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
arch/sparc/include/uapi/asm/ipcbuf.h +11 -11
@@ -17,19 +17,19 @@struct ipc64_perm { -__kernel_key_t key; -__kernel_uid_t uid; -__kernel_gid_t gid; -__kernel_uid_t cuid; -__kernel_gid_t cgid; +__kernel_key_t key; +__kernel_uid32_t uid; +__kernel_gid32_t gid; +__kernel_uid32_t cuid; +__kernel_gid32_t cgid;#ifndef __arch64__ -unsigned short __pad0; +unsigned short __pad0;#endif -__kernel_mode_t mode; -unsigned short __pad1; -unsigned short seq; -unsigned long long __unused1; -unsigned long long __unused2; +__kernel_mode_t mode; +unsigned short __pad1; +unsigned short seq; +unsigned long long __unused1; +unsigned long long __unused2; };#endif /* __SPARC_IPCBUF_H */
Re: [PATCH 5.5 150/367] tracing: Annotate ftrace_graph_hash pointer with __rcu
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
From: Amol Grover <[email protected]>
[ Upstream commit
24a9729f831462b1d9d61dc85ecc91c59037243f]
Amol, can you send a follow-up patch to annotateftrace_graph_notrace_hash as well?
- Joel
Quoted 71 lines
Fix following instances of sparse error
kernel/trace/ftrace.c:5664:29: error: incompatible types in comparisonkernel/trace/ftrace.c:5785:21: error: incompatible types in comparisonkernel/trace/ftrace.c:5864:36: error: incompatible types in comparisonkernel/trace/ftrace.c:5866:25: error: incompatible types in comparisonUse
rcu_dereference_protectedto access the__rcuannotated pointer.Reviewed-by Joel Fernandes (Google) <[email protected]>Signed-off-by Amol Grover <[email protected]>Signed-off-by Steven Rostedt (VMware) <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.h | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-)kernel/trace/ftrace.c +1
-1@@ -5596,7 +5596,7 @@ static const struct file_operations ftrace_notrace_fops = {static DEFINE_MUTEX (graph_lock); -struct ftrace_hash *ftrace_graph_hash =EMPTY_HASH ; +struct ftrace_hash __rcu *ftrace_graph_hash =EMPTY_HASH ;struct ftrace_hash *ftrace_graph_notrace_hash =EMPTY_HASH ;enum graph_filter_type {kernel/trace/trace.h +6
-4@@ -950,22 +950,25 @@ extern void __trace_graph_return(struct trace_array *tr, unsigned long flags, int pc);#ifdef CONFIG_DYNAMIC_FTRACE -extern struct ftrace_hash *ftrace_graph_hash; +extern struct ftrace_hash __rcu *ftrace_graph_hash;extern struct ftrace_hash *ftrace_graph_notrace_hash;static inline int ftrace_graph_addr (struct ftrace_graph_ent *trace) {unsigned long addr = trace->func;int ret =0 ; +struct ftrace_hash *hash;preempt_disable_notrace (); -if (ftrace_hash_empty (ftrace_graph_hash)) { + hash =rcu_dereference_protected (ftrace_graph_hash, !preemptible ()); + +if (ftrace_hash_empty (hash)) { ret =1 ; goto out; } -if (ftrace_lookup_ip (ftrace_graph_hash, addr)) { +if (ftrace_lookup_ip (hash, addr)) {/* * This needs to be cleared on the return functions -- 2.20.1
Re: [PATCH 5.5 284/367] compat: scsi: sg: fix v3 compat read/write interface
In reply to Greg Kroah-HartmanThe arm64 architecture 64k page size enabled build failed on stable rc 5.5 CONFIG_ARM64_64K_PAGES=y
CROSS_COMPILE=aarch64-linux-gnu-
Toolchain gcc-9
In file included from ../block/scsi_ioctl.c:23:
../include/scsi/sg.h:75:2: error: unknown type name ‘compat_int_t’
compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ ^~~~~~~~~~~~
../include/scsi/sg.h:76:2: error: unknown type name ‘compat_int_t’
compat_int_t dxfer_direction; /* [i] data transfer direction */ ^~~~~~~~~~~~
...
../include/scsi/sg.h:97:2: error: unknown type name ‘compat_uint_t’
compat_uint_t info; /* [o] auxiliary information */ ^~~~~~~~~~~~~
make[2]: *** [../scripts/Makefile.build:266: block/bsg.o] Error
Ref:
https://gitlab.com/Linaro/lkft/kernel-runs/-/jobs/431659186
Quoted 282 lines · Greg Kroah-Hartman
From: Arnd Bergmann <[email protected]>
commit
78ed001d9e7106171e0ee761cd854137dd731302upstream.In the v5.4 merge window, a cleanup patch from Al Viro conflicted with my rework of the compat handling for
sg.cread(). Linus Torvalds did a correct merge but pointed out that the resulting code is still unsatisfactory.I later noticed that the
sg_new_read()function still gets the compat mode wrong, when the 'count' argument is large enough to pass acompat_sg_io_hdrobject, but not a nativsg_io_hdr.To address both of these, move the definition of
compat_sg_io_hdrinto ascsi/sg.hto make it visible tosg.cand rewrite the logic for readingreq_pack_idas well as the size check to a simpler version that gets the expected results.Fixes c35a5cfb4150 ("scsi: sg: sg_read(): simplify reading ->pack_id of userland sg_io_hdr_t")Fixes 98aaaec4a150 ("compat_ioctl: reimplement SG_IO handling")Reviewed-by Ben Hutchings <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- block/scsi_ioctl.c | 29 ------------ drivers/scsi/sg.c | 126 ++++++++++++++++++++++++----------------------------- include/scsi/sg.h | 30 ++++++++++++ 3 files changed, 90 insertions(+), 95 deletions(-)block/scsi_ioctl.c +1
-28@@ -20,6 +20,7 @@#include <scsi/scsi.h> #include <scsi/scsi_ioctl.h> #include <scsi/scsi_cmnd.h> +#include <scsi/sg.h> struct blk_cmd_filter {unsigned long read_ok[BLK_SCSI_CMD_PER_LONG ];@@ -550,34 +551,6 @@ static inline int blk_send_start_stop(streturn __blk_send_generic (q, bd_disk,GPCMD_START_STOP_UNIT , data); } -#ifdef CONFIG_COMPAT -struct compat_sg_io_hdr { -compat_int_t interface_id;/* [i] 'S' for SCSI generic (required) */ -compat_int_t dxfer_direction;/* [i] data transfer direction */ -unsigned char cmd_len;/* [i] SCSI command length ( <= 16 bytes) */ -unsigned char mx_sb_len;/* [i] max length to write to sbp */ -unsigned short iovec_count;/* [i] 0 implies no scatter gather */ -compat_uint_t dxfer_len;/* [i] byte count of data transfer */ -compat_uint_t dxferp;/* [i], [*io] points to data transfer memory -or scatter gather list */ -compat_uptr_t cmdp;/* [i], [*i] points to command to perform */ -compat_uptr_t sbp;/* [i], [*o] points to sense_buffer memory */ -compat_uint_t timeout;/* [i] MAX_UINT->no timeout (unit: millisec) */ -compat_uint_t flags;/* [i] 0 -> default, see SG_FLAG... */ -compat_int_t pack_id;/* [i->o] unused internally (normally) */ -compat_uptr_t usr_ptr;/* [i->o] unused internally */ -unsigned char status;/* [o] scsi status */ -unsigned char masked_status;/* [o] shifted, masked scsi status */ -unsigned char msg_status;/* [o] messaging level data (optional) */ -unsigned char sb_len_wr;/* [o] byte count actually written to sbp */ -unsigned short host_status;/* [o] errors from host adapter */ -unsigned short driver_status;/* [o] errors from software driver */ -compat_int_t resid;/* [o] dxfer_len - actual_transferred */ -compat_uint_t duration;/* [o] time taken by cmd (unit: millisec) */ -compat_uint_t info;/* [o] auxiliary information */ -}; -#endif -int put_sg_io_hdr (const struct sg_io_hdr *hdr,void __user *argp) {#ifdef CONFIG_COMPAT drivers/scsi/sg.c +59
-67@@ -405,6 +405,38 @@ sg_release(struct inode *inode, struct freturn 0 ; } +static int get_sg_io_pack_id (int *pack_id,void __user *buf,size_t count) +{ +struct sg_header __user *old_hdr = buf; +int reply_len; + +if (count >=SZ_SG_HEADER ) { +/* negative reply_len means v3 format, otherwise v1/v2 */ +if (get_user (reply_len, &old_hdr->reply_len)) +return -EFAULT ; + +if (reply_len >=0 ) +return get_user (*pack_id, &old_hdr->pack_id); + +if (in_compat_syscall () && + count >=sizeof (struct compat_sg_io_hdr )) { +struct compat_sg_io_hdr __user *hp = buf; + +return get_user (*pack_id, &hp->pack_id); + } + +if (count >=sizeof (struct sg_io_hdr )) { +struct sg_io_hdr __user *hp = buf; + +return get_user (*pack_id, &hp->pack_id); + } + } + +/* no valid header was passed, so ignore the pack_id */ + *pack_id =-1 ; +return 0 ; +} +static ssize_t sg_read (struct file *filp,char __user *buf,size_t count,loff_t * ppos) {@@ -413,8 +445,8 @@ sg_read(struct file *filp, char __user *Sg_request *srp;int req_pack_id =-1 ;sg_io_hdr_t *hp; -struct sg_header *old_hdr =NULL ; -int retval =0 ; +struct sg_header *old_hdr; +int retval;/* * This could cause a response to be stranded. Close the associated @@ -429,79 +461,34 @@ sg_read(struct file *filp, char __user *SCSI_LOG_TIMEOUT (3 ,sg_printk (KERN_INFO , sdp,"sg_read: count=%d\n" , (int ) count)); -if (sfp->force_packid && (count >=SZ_SG_HEADER )) { - old_hdr =memdup_user (buf,SZ_SG_HEADER ); -if (IS_ERR (old_hdr)) -return PTR_ERR (old_hdr); -if (old_hdr->reply_len <0 ) { -if (count >=SZ_SG_IO_HDR ) { -/* -* This is stupid. -* -* We're copying the whole sg_io_hdr_t from user -* space just to get the 'pack_id' field. But the -* field is at different offsets for the compat -* case, so we'll use "get_sg_io_hdr()" to copy -* the whole thing and convert it. -* -* We could do something like just calculating the -* offset based of 'in_compat_syscall()', but the -* 'compat_sg_io_hdr' definition is in the wrong -* place for that. -*/ -sg_io_hdr_t *new_hdr; - new_hdr =kmalloc (SZ_SG_IO_HDR ,GFP_KERNEL ); -if (!new_hdr) { - retval = -ENOMEM ; - goto free_old_hdr; - } - retval =get_sg_io_hdr (new_hdr, buf); - req_pack_id = new_hdr->pack_id; -kfree (new_hdr); -if (retval) { - retval = -EFAULT ; - goto free_old_hdr; - } - } - }else - req_pack_id = old_hdr->pack_id; - } +if (sfp->force_packid) + retval =get_sg_io_pack_id (&req_pack_id, buf, count); +if (retval) +return retval; + srp =sg_get_rq_mark (sfp, req_pack_id);if (!srp) {/* now wait on packet to arrive */ -if (atomic_read (&sdp->detaching)) { - retval = -ENODEV ; - goto free_old_hdr; - } -if (filp->f_flags &O_NONBLOCK ) { - retval = -EAGAIN ; - goto free_old_hdr; - } +if (atomic_read (&sdp->detaching)) +return -ENODEV ; +if (filp->f_flags &O_NONBLOCK ) +return -EAGAIN ; retval =wait_event_interruptible (sfp->read_wait, (atomic_read (&sdp->detaching) || (srp =sg_get_rq_mark (sfp, req_pack_id)))); -if (atomic_read (&sdp->detaching)) { - retval = -ENODEV ; - goto free_old_hdr; - } -if (retval) { +if (atomic_read (&sdp->detaching)) +return -ENODEV ; +if (retval)/* -ERESTARTSYS as signal hit process */ - goto free_old_hdr; - } - } -if (srp->header.interface_id !='\0' ) { - retval =sg_new_read (sfp, buf, count, srp); - goto free_old_hdr; +return retval; } +if (srp->header.interface_id !='\0' ) +return sg_new_read (sfp, buf, count, srp); hp = &srp->header; -if (old_hdr ==NULL ) { - old_hdr =kmalloc (SZ_SG_HEADER ,GFP_KERNEL ); -if (! old_hdr) { - retval = -ENOMEM ; - goto free_old_hdr; - } - } -memset (old_hdr,0 ,SZ_SG_HEADER ); + old_hdr =kzalloc (SZ_SG_HEADER ,GFP_KERNEL ); +if (!old_hdr) +return -ENOMEM ; + old_hdr->reply_len = (int ) hp->timeout; old_hdr->pack_len = old_hdr->reply_len;/* old, strange behaviour */ old_hdr->pack_id = hp->pack_id;@@ -575,7 +562,12 @@ sg_new_read(Sg_fd * sfp, char __user *buint err =0 , err2;int len; -if (count <SZ_SG_IO_HDR ) { +if (in_compat_syscall ()) { +if (count <sizeof (struct compat_sg_io_hdr )) { + err = -EINVAL ; + goto err_out; + } + }else if (count <SZ_SG_IO_HDR ) { err = -EINVAL ; goto err_out; }include/scsi/sg.h +30
-0@@ -68,6 +68,36 @@ typedef struct sg_io_hdrunsigned int info;/* [o] auxiliary information */ } sg_io_hdr_t;/* 64 bytes long (on i386) */ +#if defined(__KERNEL__) +#include <linux/compat.h> + +struct compat_sg_io_hdr { +compat_int_t interface_id;/* [i] 'S' for SCSI generic (required) */ +compat_int_t dxfer_direction;/* [i] data transfer direction */ +unsigned char cmd_len;/* [i] SCSI command length ( <= 16 bytes) */ +unsigned char mx_sb_len;/* [i] max length to write to sbp */ +unsigned short iovec_count;/* [i] 0 implies no scatter gather */ +compat_uint_t dxfer_len;/* [i] byte count of data transfer */ +compat_uint_t dxferp;/* [i], [*io] points to data transfer memory +or scatter gather list */ +compat_uptr_t cmdp;/* [i], [*i] points to command to perform */ +compat_uptr_t sbp;/* [i], [*o] points to sense_buffer memory */ +compat_uint_t timeout;/* [i] MAX_UINT->no timeout (unit: millisec) */ +compat_uint_t flags;/* [i] 0 -> default, see SG_FLAG... */ +compat_int_t pack_id;/* [i->o] unused internally (normally) */ +compat_uptr_t usr_ptr;/* [i->o] unused internally */ +unsigned char status;/* [o] scsi status */ +unsigned char masked_status;/* [o] shifted, masked scsi status */ +unsigned char msg_status;/* [o] messaging level data (optional) */ +unsigned char sb_len_wr;/* [o] byte count actually written to sbp */ +unsigned short host_status;/* [o] errors from host adapter */ +unsigned short driver_status;/* [o] errors from software driver */ +compat_int_t resid;/* [o] dxfer_len - actual_transferred */ +compat_uint_t duration;/* [o] time taken by cmd (unit: millisec) */ +compat_uint_t info;/* [o] auxiliary information */ +}; +#endif +#define SG_INTERFACE_ID_ORIG 'S'/* Use negative values to flag difference from original sg_header structure */
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Re: [PATCH 5.5 284/367] compat: scsi: sg: fix v3 compat read/write interface
Quoted 14 lines · Naresh Kamboju
The arm64 architecture 64k page size enabled build failed on stable rc 5.5
CONFIG_ARM64_64K_PAGES=y
CROSS_COMPILE=aarch64-linux-gnu-
Toolchain gcc-9In file included from
../block/scsi_ioctl.c:23:
../include/scsi/sg.h:75:2: error: unknown type name ‘compat_int_t’
compat_int_tinterface_id; /* [i] 'S' for SCSI generic (required) */ ^~~~~~~~~~~~
../include/scsi/sg.h:76:2: error: unknown type name ‘compat_int_t’
compat_int_tdxfer_direction; /* [i] data transfer direction */ ^~~~~~~~~~~~
Quoted 3 lines
...
../include/scsi/sg.h:97:2: error: unknown type name ‘compat_uint_t’
compat_uint_tinfo; /* [o] auxiliary information */
Hi Naresh,
Does it work if you backport 071aaa43513a ("compat: ARM64: always include asm-generic/compat.h")?
Arnd
Re: [PATCH 5.5 284/367] compat: scsi: sg: fix v3 compat read/write interface
Helo!
Quoted 16 lines · Arnd Bergmann
Quoted 14 lines · Naresh Kamboju
The arm64 architecture 64k page size enabled build failed on stable rc 5.5
CONFIG_ARM64_64K_PAGES=y
CROSS_COMPILE=aarch64-linux-gnu-
Toolchain gcc-9In file included from
../block/scsi_ioctl.c:23:
../include/scsi/sg.h:75:2: error: unknown type name ‘compat_int_t’
compat_int_tinterface_id; /* [i] 'S' for SCSI generic (required) */ ^~~~~~~~~~~~
../include/scsi/sg.h:76:2: error: unknown type name ‘compat_int_t’
compat_int_tdxfer_direction; /* [i] data transfer direction */ ^~~~~~~~~~~~
Quoted 8 lines
Quoted 3 lines
...
../include/scsi/sg.h:97:2: error: unknown type name ‘compat_uint_t’
compat_uint_tinfo; /* [o] auxiliary information */Hi Naresh,
Does it work if you backport
071aaa43513a("compat: ARM64: always includeasm-generic/compat.h")?
Yes, cherry-picking 556d687a4ccd ("compat: ARM64: always include asm-generic/compat.h") gets it back on track.
Thanks and greetings!
Daniel Díaz
[email protected]
Greg Kroah-Hartman
maintainerRe: [PATCH 5.5 284/367] compat: scsi: sg: fix v3 compat read/write interface
Quoted 23 lines · Daniel Díaz
Helo!
Quoted 20 lines · Arnd Bergmann
Quoted 17 lines · Naresh Kamboju
The arm64 architecture 64k page size enabled build failed on stable rc 5.5
CONFIG_ARM64_64K_PAGES=y
CROSS_COMPILE=aarch64-linux-gnu-
Toolchain gcc-9In file included from
../block/scsi_ioctl.c:23:
../include/scsi/sg.h:75:2: error: unknown type name ‘compat_int_t’
compat_int_tinterface_id; /* [i] 'S' for SCSI generic (required) */ ^~~~~~~~~~~~
../include/scsi/sg.h:76:2: error: unknown type name ‘compat_int_t’
compat_int_tdxfer_direction; /* [i] data transfer direction */ ^~~~~~~~~~~~...
../include/scsi/sg.h:97:2: error: unknown type name ‘compat_uint_t’
compat_uint_tinfo; /* [o] auxiliary information */
Quoted 7 lines
Quoted 4 lines
Hi Naresh,
Does it work if you backport
071aaa43513a("compat: ARM64: always includeasm-generic/compat.h")?Yes, cherry-picking
556d687a4ccd("compat: ARM64: always includeasm-generic/compat.h") gets it back on track.
Great, I'll go add that now and push out a -rc2. Thanks for finding this so quickly.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gz
-rc2 is out to fix an arm64 build issue:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc2.gz
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.5.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.5:
13 builds: 13 pass, 0 fail
22 boots: 22 pass, 0 fail
40 tests: 40 pass, 0 failLinux version: 5.5.3-rc1-g1d9d90e88c9f
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
For v5.5.2-369-gd9c695759fb3:
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 397 pass: 397 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.5.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Sasha Levin
maintainerRe: [PATCH 5.5 150/367] tracing: Annotate ftrace_graph_hash pointer with __rcu
In reply to Joel FernandesQuoted 9 lines · Joel Fernandes
Quoted 4 lines · Greg Kroah-Hartman
From: Amol Grover <[email protected]>
[ Upstream commit
24a9729f831462b1d9d61dc85ecc91c59037243f]Amol, can you send a follow-up patch to annotate
ftrace_graph_notrace_hashas well?
Note that I took this to make later stable tagged patch apply cleanly. I don't expect these annotation changes to be picked up for stable on their own.
Signature · 2 lines
Thanks, Sasha
Quoted 7 lines · Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 5 lines
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gz-rc2 is out to fix an arm64 build issue:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc2.gz
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.5.3-rc2
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.5.y
git commit: d9c695759fb3d975f591901ff86e5ed0c6b99a34
git describe: v5.5.2-369-gd9c695759fb3
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.5-oe/build/v5.5.2-369-gd9c695759fb3
No regressions (compared to build v5.5.2)
No fixes (compared to build v5.5.2)
Ran 25348 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* libhugetlbfs
* linux-log-parser
* ltp-commands-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* kselftest
* ltp-fs-tests
* libgpiod
* ltp-cap_bounds-tests
* ltp-cpuhotplug-tests
* ltp-fcntl-locktests-tests
* ltp-ipc-tests
* ltp-open-posix-tests
* network-basic-tests
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 27 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.5.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.5:
13 builds: 13 pass, 0 fail 22 boots: 22 pass, 0 fail 40 tests: 40 pass, 0 fail
Quoted 5 lines
Linux version: 5.5.3-rc1-g1d9d90e88c9f
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra210-p3450-0000, tegra30-cardhu-a04
Wonderful, thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 15 lines · shuah
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.5.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 4 lines
thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
Great, thanks for testing and letting me know so quickly.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 12 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gz-rc2 is out to fix an arm64 build issue:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc2.gzResults from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
THanks for testing this and the others and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
Quoted 6 lines
For v5.5.2-369-gd9c695759fb3:
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 397 pass: 397 fail: 0
Great, thanks for testing and letting me know.
greg k-h
Re: [PATCH 5.5 150/367] tracing: Annotate ftrace_graph_hash pointer with __rcu
In reply to Sasha LevinQuoted 6 lines · Sasha Levin
Quoted 5 lines · Joel Fernandes
Quoted 3 lines · Greg Kroah-Hartman
From: Amol Grover <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
[ Upstream commit
24a9729f831462b1d9d61dc85ecc91c59037243f]Amol, can you send a follow-up patch to annotate
ftrace_graph_notrace_hashas well?Note that I took this to make later stable tagged patch apply cleanly. I don't expect these annotation changes to be picked up for stable on their own.
Yes, that should be fine.
thanks,
- Joel
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.5.3 release. There are 367 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Wed, 12 Feb 2020 12:18:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.5.3-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.5.y
and the diffstat can be found below.
hello,
compiled and booted 5.5.3-rc2+ . No new error according to "sudo dmesg -l err"