locking/mutex: Fix HANDOFF condition
Subsystems (7)
Sasha Levin
maintainerPATCH 1/23 locking/mutex: Fix HANDOFF condition
From: Peter Zijlstra <[email protected]>
[ Upstream commit 048661a1f963e9517630f080687d48af79ed784c ]
Yanfei reported that setting HANDOFF should not depend on recomputing @first, only on @first state. Which would then give:
if (ww_ctx || !first)
first = __mutex_waiter_is_first(lock, &waiter);
if (first)
__mutex_set_flag(lock, MUTEX_FLAG_HANDOFF);But because 'ww_ctx || !first' is basically 'always' and the test for first is relatively cheap, omit that first branch entirely.
--- kernel/locking/mutex.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
kernel/locking/mutex.c +5 -10
@@ -911,7 +911,6 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx) { struct mutex_waiter waiter; -bool first = false;struct ww_mutex *ww;int ret;
@@ -986,6 +985,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,set_current_state (state);for (;;) { +bool first; +/* * Once we hold wait_lock, we're serialized against * mutex_unlock() handing the lock off to us, do a trylock
@@ -1014,15 +1015,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,spin_unlock (&lock->wait_lock);schedule_preempt_disabled (); -/* -* ww_mutex needs to always recheck its position since its waiter -* list is not FIFO ordered. -*/ -if (ww_ctx || !first) { - first =__mutex_waiter_is_first (lock, &waiter); -if (first) -__mutex_set_flag (lock,MUTEX_FLAG_HANDOFF ); - } + first =__mutex_waiter_is_first (lock, &waiter); +if (first) +__mutex_set_flag (lock,MUTEX_FLAG_HANDOFF );set_current_state (state);/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/23 regmap: fix the offset of register error log
From: Jeongtae Park <[email protected]>
[ Upstream commit 1852f5ed358147095297a09cc3c6f160208a676d ]
This patch fixes the offset of register error log
by using regmap_get_offset().
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1479,7 +1479,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,if (ret) {dev_err (map->dev,"Error in caching of register: %x ret: %d\n" , - reg + i, ret); + reg +regmap_get_offset (map, i), ret);return ret; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/23 crypto: mxs-dcp - Check for DMA mapping errors
In reply to Sasha LevinFrom: Sean Anderson <[email protected]>
[ Upstream commit df6313d707e575a679ada3313358289af24454c0 ]
After calling dma_map_single(), we must also call dma_mapping_error(). This fixes the following warning when compiling with CONFIG_DMA_API_DEBUG:
[ 311.241478] WARNING: CPU: 0 PID: 428 at kernel/dma/debug.c:1027 check_unmap+0x79c/0x96c [ 311.249547] DMA-API: mxs-dcp 2280000.crypto: device driver failed to check map error[device address=0x00000000860cb080] [size=32 bytes] [mapped as single]
--- drivers/crypto/mxs-dcp.c | 45 +++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-)
drivers/crypto/mxs-dcp.c +35 -10
@@ -167,15 +167,19 @@ static struct dcp *global_sdcp;static int mxs_dcp_start_dma (struct dcp_async_ctx *actx) { +int dma_err;struct dcp *sdcp = global_sdcp;const int chan = actx->chan;uint32_t stat;unsigned long ret;struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; -dma_addr_t desc_phys =dma_map_single (sdcp->dev, desc,sizeof (*desc),DMA_TO_DEVICE ); + dma_err =dma_mapping_error (sdcp->dev, desc_phys); +if (dma_err) +return dma_err; +reinit_completion (&sdcp->completion[chan]);/* Clear status register. */
@@ -213,18 +217,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)static int mxs_dcp_run_aes (struct dcp_async_ctx *actx,struct ablkcipher_request *req,int init) { +dma_addr_t key_phys, src_phys, dst_phys;struct dcp *sdcp = global_sdcp;struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];struct dcp_aes_req_ctx *rctx =ablkcipher_request_ctx (req);int ret; -dma_addr_t key_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_key, -2 *AES_KEYSIZE_128 , -DMA_TO_DEVICE ); -dma_addr_t src_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_in_buf, -DCP_BUF_SZ ,DMA_TO_DEVICE ); -dma_addr_t dst_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_out_buf, -DCP_BUF_SZ ,DMA_FROM_DEVICE ); + key_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_key, +2 *AES_KEYSIZE_128 ,DMA_TO_DEVICE ); + ret =dma_mapping_error (sdcp->dev, key_phys); +if (ret) +return ret; + + src_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_in_buf, +DCP_BUF_SZ ,DMA_TO_DEVICE ); + ret =dma_mapping_error (sdcp->dev, src_phys); +if (ret) + goto err_src; + + dst_phys =dma_map_single (sdcp->dev, sdcp->coh->aes_out_buf, +DCP_BUF_SZ ,DMA_FROM_DEVICE ); + ret =dma_mapping_error (sdcp->dev, dst_phys); +if (ret) + goto err_dst;if (actx->fill %AES_BLOCK_SIZE ) {dev_err (sdcp->dev,"Invalid block size!\n" );
@@ -262,10 +277,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, ret =mxs_dcp_start_dma (actx); aes_done_run: +dma_unmap_single (sdcp->dev, dst_phys,DCP_BUF_SZ ,DMA_FROM_DEVICE ); +err_dst: +dma_unmap_single (sdcp->dev, src_phys,DCP_BUF_SZ ,DMA_TO_DEVICE ); +err_src:dma_unmap_single (sdcp->dev, key_phys,2 *AES_KEYSIZE_128 ,DMA_TO_DEVICE ); -dma_unmap_single (sdcp->dev, src_phys,DCP_BUF_SZ ,DMA_TO_DEVICE ); -dma_unmap_single (sdcp->dev, dst_phys,DCP_BUF_SZ ,DMA_FROM_DEVICE );return ret; }
@@ -565,6 +582,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)dma_addr_t buf_phys =dma_map_single (sdcp->dev, sdcp->coh->sha_in_buf,DCP_BUF_SZ ,DMA_TO_DEVICE ); + ret =dma_mapping_error (sdcp->dev, buf_phys); +if (ret) +return ret; +/* Fill in the DMA descriptor. */ desc->control0 =MXS_DCP_CONTROL0_DECR_SEMAPHORE | MXS_DCP_CONTROL0_INTERRUPT |
@@ -597,6 +618,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)if (rctx->fini) { digest_phys =dma_map_single (sdcp->dev, sdcp->coh->sha_out_buf,DCP_SHA_PAY_SZ ,DMA_FROM_DEVICE ); + ret =dma_mapping_error (sdcp->dev, digest_phys); +if (ret) + goto done_run; + desc->control0 |=MXS_DCP_CONTROL0_HASH_TERM ; desc->payload = digest_phys; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/23 sched/deadline: Fix reset_on_fork reporting of DL tasks
In reply to Sasha LevinFrom: Quentin Perret <[email protected]>
[ Upstream commit f95091536f78971b269ec321b057b8d630b0ad8a ]
It is possible for sched_getattr() to incorrectly report the state of the reset_on_fork flag when called on a deadline task.
Indeed, if the flag was set on a deadline task using sched_setattr() with flags (SCHED_FLAG_RESET_ON_FORK | SCHED_FLAG_KEEP_PARAMS), then p->sched_reset_on_fork will be set, but __setscheduler() will bail out early, which means that the dl_se->flags will not get updated by __setscheduler_params()->__setparam_dl(). Consequently, if sched_getattr() is then called on the task, __getparam_dl() will override kattr.sched_flags with the now out-of-date copy in dl_se->flags and report the stale value to userspace.
To fix this, make sure to only copy the flags that are relevant to sched_deadline to and from the dl_se->flags field.
--- kernel/sched/deadline.c | 7 ++++--- kernel/sched/sched.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
kernel/sched/deadline.c +4 -3
@@ -2615,7 +2615,7 @@ void __setparam_dl(struct task_struct *p, const struct sched_attr *attr) dl_se->dl_runtime = attr->sched_runtime; dl_se->dl_deadline = attr->sched_deadline; dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline; - dl_se->flags = attr->sched_flags; + dl_se->flags = attr->sched_flags &SCHED_DL_FLAGS ; dl_se->dl_bw =to_ratio (dl_se->dl_period, dl_se->dl_runtime); dl_se->dl_density =to_ratio (dl_se->dl_deadline, dl_se->dl_runtime); }
@@ -2628,7 +2628,8 @@ void __getparam_dl(struct task_struct *p, struct sched_attr *attr) attr->sched_runtime = dl_se->dl_runtime; attr->sched_deadline = dl_se->dl_deadline; attr->sched_period = dl_se->dl_period; - attr->sched_flags = dl_se->flags; + attr->sched_flags &= ~SCHED_DL_FLAGS ; + attr->sched_flags |= dl_se->flags; }/*
@@ -2703,7 +2704,7 @@ bool dl_param_changed(struct task_struct *p, const struct sched_attr *attr)if (dl_se->dl_runtime != attr->sched_runtime || dl_se->dl_deadline != attr->sched_deadline || dl_se->dl_period != attr->sched_period || - dl_se->flags != attr->sched_flags) + dl_se->flags != (attr->sched_flags &SCHED_DL_FLAGS ))return true;return false;
kernel/sched/sched.h +2 -0
@@ -209,6 +209,8 @@ static inline int task_has_dl_policy(struct task_struct *p)*/ #define SCHED_FLAG_SUGOV 0x10000000 +#define SCHED_DL_FLAGS (SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN | SCHED_FLAG_SUGOV) +static inline bool dl_entity_is_special (struct sched_dl_entity *dl_se) {#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/23 power: supply: axp288_fuel_gauge: Report register-address on readb / writeb errors
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit caa534c3ba40c6e8352b42cbbbca9ba481814ac8 ]
When fuel_gauge_reg_readb()/_writeb() fails, report which register we were trying to read / write when the error happened.
Also reword the message a bit:
- Drop the axp288 prefix, dev_err() already prints this
- Switch from telegram / abbreviated style to a normal sentence, aligning the message with those from fuel_gauge_read_*bit_word()
--- drivers/power/supply/axp288_fuel_gauge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/axp288_fuel_gauge.c +2 -2
@@ -158,7 +158,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg) }if (ret <0 ) { -dev_err (&info->pdev->dev,"axp288 reg read err:%d\n" , ret); +dev_err (&info->pdev->dev,"Error reading reg 0x%02x err: %d\n" , reg, ret);return ret; }
@@ -172,7 +172,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val) ret =regmap_write (info->regmap, reg, (unsigned int )val);if (ret <0 ) -dev_err (&info->pdev->dev,"axp288 reg write err:%d\n" , ret); +dev_err (&info->pdev->dev,"Error writing reg 0x%02x err: %d\n" , reg, ret);return ret; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/23 crypto: omap-sham - clear dma flags only after omap_sham_update_dma_stop()
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit fe28140b3393b0ba1eb95cc109f974a7e58b26fd ]
We should not clear FLAGS_DMA_ACTIVE before omap_sham_update_dma_stop() is done calling dma_unmap_sg(). We already clear FLAGS_DMA_ACTIVE at the end of omap_sham_update_dma_stop().
The early clearing of FLAGS_DMA_ACTIVE is not causing issues as we do not need to defer anything based on FLAGS_DMA_ACTIVE currently. So this can be applied as clean-up.
--- drivers/crypto/omap-sham.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/omap-sham.c +1 -1
@@ -1739,7 +1739,7 @@ static void omap_sham_done_task(unsigned long data)if (test_and_clear_bit (FLAGS_OUTPUT_READY , &dd->flags)) goto finish; }else if (test_bit (FLAGS_DMA_READY , &dd->flags)) { -if (test_and_clear_bit (FLAGS_DMA_ACTIVE , &dd->flags)) { +if (test_bit (FLAGS_DMA_ACTIVE , &dd->flags)) {omap_sham_update_dma_stop (dd);if (dd->err) { err = dd->err;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/23 sched/deadline: Fix missing clock update in migrate_task_rq_dl()
In reply to Sasha LevinFrom: Dietmar Eggemann <[email protected]>
[ Upstream commit b4da13aa28d4fd0071247b7b41c579ee8a86c81a ]
A missing clock update is causing the following warning:
rq->clock_update_flags < RQCF_ACT_SKIP
WARNING: CPU: 112 PID: 2041 at kernel/sched/sched.h:1453 sub_running_bw.isra.0+0x190/0x1a0 ... CPU: 112 PID: 2041 Comm: sugov:112 Tainted: G W 5.14.0-rc1 #1 Hardware name: WIWYNN Mt.Jade Server System B81.030Z1.0007/Mt.Jade Motherboard, BIOS 1.6.20210526 (SCP: 1.06.20210526) 2021/05/26 ... Call trace: sub_running_bw.isra.0+0x190/0x1a0 migrate_task_rq_dl+0xf8/0x1e0 set_task_cpu+0xa8/0x1f0 try_to_wake_up+0x150/0x3d4 wake_up_q+0x64/0xc0 __up_write+0xd0/0x1c0 up_write+0x4c/0x2b0 cppc_set_perf+0x120/0x2d0 cppc_cpufreq_set_target+0xe0/0x1a4 [cppc_cpufreq] __cpufreq_driver_target+0x74/0x140 sugov_work+0x64/0x80 kthread_worker_fn+0xe0/0x230 kthread+0x138/0x140 ret_from_fork+0x10/0x18
The task causing this is the cppc_fie DL task introduced by commit 1eb5dde674f5 ("cpufreq: CPPC: Add support for frequency invariance").
With CONFIG_ACPI_CPPC_CPUFREQ_FIE=y and schedutil cpufreq governor on slow-switching system (like on this Ampere Altra WIWYNN Mt. Jade Arm Server):
DL task curr=sugov:112 lets p=cppc_fie migrate and since the latter is in non_contending state, migrate_task_rq_dl() calls
sub_running_bw()->__sub_running_bw()->cpufreq_update_util()-> rq_clock()->assert_clock_updated()
on p.
Fix this by updating the clock for a non_contending task in migrate_task_rq_dl() before calling sub_running_bw().
--- kernel/sched/deadline.c | 1 + 1 file changed, 1 insertion(+)
kernel/sched/deadline.c +1 -0
@@ -1654,6 +1654,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused*/ raw_spin_lock (&rq->lock);if (p->dl.dl_non_contending) { +update_rq_clock (rq);sub_running_bw (&p->dl, &rq->dl); p->dl.dl_non_contending =0 ;/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/23 posix-cpu-timers: Force next expiration recalc after itimer reset
In reply to Sasha LevinFrom: Frederic Weisbecker <[email protected]>
[ Upstream commit 406dd42bd1ba0c01babf9cde169bb319e52f6147 ]
When an itimer deactivates a previously armed expiration, it simply doesn't do anything. As a result the process wide cputime counter keeps running and the tick dependency stays set until it reaches the old ghost expiration value.
This can be reproduced with the following snippet:
void trigger_process_counter(void)
{
struct itimerval n = {};
n.it_value.tv_sec = 100;
setitimer(ITIMER_VIRTUAL, &n, NULL);
n.it_value.tv_sec = 0;
setitimer(ITIMER_VIRTUAL, &n, NULL);
}Fix this with resetting the relevant base expiration. This is similar to disarming a timer.
--- kernel/time/posix-cpu-timers.c | 2 -- 1 file changed, 2 deletions(-)
kernel/time/posix-cpu-timers.c +0 -2
@@ -1230,8 +1230,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, } } -if (!*newval) -return ; *newval += now; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/23 hrtimer: Avoid double reprogramming in __hrtimer_start_range_ns()
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 627ef5ae2df8eeccb20d5af0e4cfa4df9e61ed28 ]
If __hrtimer_start_range_ns() is invoked with an already armed hrtimer then the timer has to be canceled first and then added back. If the timer is the first expiring timer then on removal the clockevent device is reprogrammed to the next expiring timer to avoid that the pending expiry fires needlessly.
If the new expiry time ends up to be the first expiry again then the clock event device has to reprogrammed again.
Avoid this by checking whether the timer is the first to expire and in that case, keep the timer on the current CPU and delay the reprogramming up to the point where the timer has been enqueued again.
--- kernel/time/hrtimer.c | 60 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 7 deletions(-)
kernel/time/hrtimer.c +53 -7
@@ -1020,12 +1020,13 @@ static void __remove_hrtimer(struct hrtimer *timer,* remove hrtimer, called with base lock held */ static inline int -remove_hrtimer (struct hrtimer *timer,struct hrtimer_clock_base *base,bool restart) +remove_hrtimer (struct hrtimer *timer,struct hrtimer_clock_base *base, +bool restart,bool keep_local) {u8 state = timer->state;if (state &HRTIMER_STATE_ENQUEUED ) { -int reprogram; +bool reprogram;/* * Remove the timer and force reprogramming when high
@@ -1038,8 +1039,16 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restdebug_deactivate (timer); reprogram = base->cpu_base ==this_cpu_ptr (&hrtimer_bases); +/* +* If the timer is not restarted then reprogramming is +* required if the timer is local. If it is local and about +* to be restarted, avoid programming it twice (on removal +* and a moment later when it's requeued). +*/ if (!restart) state =HRTIMER_STATE_INACTIVE ; +else + reprogram &= !keep_local;__remove_hrtimer (timer, base, state, reprogram);return 1 ;
@@ -1093,9 +1102,31 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, struct hrtimer_clock_base *base) {struct hrtimer_clock_base *new_base; +bool force_local, first; -/* Remove an active timer from the queue: */ -remove_hrtimer (timer, base, true); +/* +* If the timer is on the local cpu base and is the first expiring +* timer then this might end up reprogramming the hardware twice +* (on removal and on enqueue). To avoid that by prevent the +* reprogram on removal, keep the timer local to the current CPU +* and enforce reprogramming after it is queued no matter whether +* it is the new first expiring timer again or not. +*/ + force_local = base->cpu_base ==this_cpu_ptr (&hrtimer_bases); + force_local &= base->cpu_base->next_timer == timer; + +/* +* Remove an active timer from the queue. In case it is not queued +* on the current CPU, make sure that remove_hrtimer() updates the +* remote data correctly. +* +* If it's on the current CPU and the first expiring timer, then +* skip reprogramming, keep the timer local and enforce +* reprogramming later if it was the first expiring timer. This +* avoids programming the underlying clock event twice (once at +* removal and once after enqueue). +*/ +remove_hrtimer (timer, base, true, force_local);if (mode &HRTIMER_MODE_REL ) tim =ktime_add_safe (tim, base->get_time ());
@@ -1105,9 +1136,24 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,hrtimer_set_expires_range_ns (timer, tim, delta_ns);/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +if (!force_local) { + new_base =switch_hrtimer_base (timer, base, + mode &HRTIMER_MODE_PINNED ); + }else { + new_base = base; + } + + first =enqueue_hrtimer (timer, new_base, mode); +if (!force_local) +return first; -return enqueue_hrtimer (timer, new_base, mode); +/* +* Timer was forced to stay on the current CPU to avoid +* reprogramming on removal and enqueue. Force reprogram the +* hardware by evaluating the new first expiring timer. +*/ +hrtimer_force_reprogram (new_base->cpu_base,1 ); +return 0 ; }/**
@@ -1168,7 +1214,7 @@ int hrtimer_try_to_cancel(struct hrtimer *timer) base =lock_hrtimer_base (timer, &flags);if (!hrtimer_callback_running (timer)) - ret =remove_hrtimer (timer, base, false); + ret =remove_hrtimer (timer, base, false, false);unlock_hrtimer_base (timer, &flags);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/23 udf: Check LVID earlier
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit 781d2a9a2fc7d0be53a072794dc03ef6de770f3d ]
We were checking validity of LVID entries only when getting implementation use information from LVID in udf_sb_lvidiu(). However if the LVID is suitably corrupted, it can cause problems also to code such as udf_count_free() which doesn't use udf_sb_lvidiu(). So check validity of LVID already when loading it from the disk and just disable LVID altogether when it is not valid.
--- fs/udf/super.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
fs/udf/super.c +16 -9
@@ -112,16 +112,10 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb)return NULL ; lvid = (struct logicalVolIntegrityDesc *)UDF_SB (sb)->s_lvid_bh->b_data; partnum =le32_to_cpu (lvid->numOfPartitions); -if ((sb->s_blocksize -sizeof (struct logicalVolIntegrityDescImpUse ) - - offsetof(struct logicalVolIntegrityDesc , impUse)) / - (2 *sizeof (uint32_t )) < partnum) { -udf_err (sb,"Logical volume integrity descriptor corrupted " -"(numOfPartitions = %u)!\n" , partnum); -return NULL ; - }/* The offset is to skip freeSpaceTable and sizeTable arrays */ offset = partnum *2 *sizeof (uint32_t ); -return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]); +return (struct logicalVolIntegrityDescImpUse *) + (((uint8_t *)(lvid +1 )) + offset); }/* UDF filesystem type */
@@ -1529,6 +1523,7 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_struct udf_sb_info *sbi =UDF_SB (sb);struct logicalVolIntegrityDesc *lvid;int indirections =0 ; +u32 parts, impuselen;while (++indirections <=UDF_MAX_LVID_NESTING ) { final_bh =NULL ;
@@ -1555,15 +1550,27 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ lvid = (struct logicalVolIntegrityDesc *)final_bh->b_data;if (lvid->nextIntegrityExt.extLength ==0 ) -return ; + goto check; loc =leea_to_cpu (lvid->nextIntegrityExt); }udf_warn (sb,"Too many LVID indirections (max %u), ignoring.\n" ,UDF_MAX_LVID_NESTING ); +out_err:brelse (sbi->s_lvid_bh); sbi->s_lvid_bh =NULL ; +return ; +check: + parts =le32_to_cpu (lvid->numOfPartitions); + impuselen =le32_to_cpu (lvid->lengthOfImpUse); +if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize || +sizeof (struct logicalVolIntegrityDesc ) + impuselen + +2 * parts *sizeof (u32) > sb->s_blocksize) { +udf_warn (sb,"Corrupted LVID (parts=%u, impuselen=%u), " +"ignoring.\n" , parts, impuselen); + goto out_err; + } }/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/23 isofs: joliet: Fix iocharset=utf8 mount option
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 28ce50f8d96ec9035f60c9348294ea26b94db944 ]
Currently iocharset=utf8 mount option is broken. To use UTF-8 as iocharset, it is required to use utf8 mount option.
Fix iocharset=utf8 mount option to use be equivalent to the utf8 mount option.
If UTF-8 as iocharset is used then s_nls_iocharset is set to NULL. So simplify code around, remove s_utf8 field as to distinguish between UTF-8 and non-UTF-8 it is needed just to check if s_nls_iocharset is set to NULL or not.
--- fs/isofs/inode.c | 27 +++++++++++++-------------- fs/isofs/isofs.h | 1 - fs/isofs/joliet.c | 4 +--- 3 files changed, 14 insertions(+), 18 deletions(-)
fs/isofs/inode.c +13 -14
@@ -157,7 +157,6 @@ struct iso9660_options{ unsigned int overriderockperm:1; unsigned int uid_set:1; unsigned int gid_set:1; - unsigned int utf8:1;unsigned char map;unsigned char check;unsigned int blocksize;
@@ -357,7 +356,6 @@ static int parse_options(char *options, struct iso9660_options *popt) popt->gid =GLOBAL_ROOT_GID ; popt->uid =GLOBAL_ROOT_UID ; popt->iocharset =NULL ; - popt->utf8 =0 ; popt->overriderockperm =0 ; popt->session=-1 ; popt->sbsector=-1 ;
@@ -390,10 +388,13 @@ static int parse_options(char *options, struct iso9660_options *popt)case Opt_cruft: popt->cruft =1 ;break ; +#ifdef CONFIG_JOLIET case Opt_utf8: - popt->utf8 =1 ; +kfree (popt->iocharset); + popt->iocharset =kstrdup ("utf8" ,GFP_KERNEL ); +if (!popt->iocharset) +return 0 ;break ; -#ifdef CONFIG_JOLIET case Opt_iocharset:kfree (popt->iocharset); popt->iocharset =match_strdup (&args[0 ]);
@@ -496,7 +497,6 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)if (sbi->s_nocompress)seq_puts (m,",nocompress" );if (sbi->s_overriderockperm)seq_puts (m,",overriderockperm" );if (sbi->s_showassoc)seq_puts (m,",showassoc" ); -if (sbi->s_utf8)seq_puts (m,",utf8" );if (sbi->s_check)seq_printf (m,",check=%c" , sbi->s_check);if (sbi->s_mapping)seq_printf (m,",map=%c" , sbi->s_mapping);
@@ -519,9 +519,10 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root)seq_printf (m,",fmode=%o" , sbi->s_fmode);#ifdef CONFIG_JOLIET -if (sbi->s_nls_iocharset && -strcmp (sbi->s_nls_iocharset->charset,CONFIG_NLS_DEFAULT ) !=0 ) +if (sbi->s_nls_iocharset)seq_printf (m,",iocharset=%s" , sbi->s_nls_iocharset->charset); +else +seq_puts (m,",iocharset=utf8" );#endif return 0 ; }
@@ -865,14 +866,13 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) sbi->s_nls_iocharset =NULL ;#ifdef CONFIG_JOLIET -if (joliet_level && opt.utf8 ==0 ) { +if (joliet_level) {char *p = opt.iocharset ? opt.iocharset :CONFIG_NLS_DEFAULT ; - sbi->s_nls_iocharset =load_nls (p); -if (! sbi->s_nls_iocharset) { -/* Fail only if explicit charset specified */ -if (opt.iocharset) +if (strcmp (p,"utf8" ) !=0 ) { + sbi->s_nls_iocharset = opt.iocharset ? +load_nls (opt.iocharset) :load_nls_default (); +if (!sbi->s_nls_iocharset) goto out_freesbi; - sbi->s_nls_iocharset =load_nls_default (); } }#endif
@@ -888,7 +888,6 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) sbi->s_gid = opt.gid; sbi->s_uid_set = opt.uid_set; sbi->s_gid_set = opt.gid_set; - sbi->s_utf8 = opt.utf8; sbi->s_nocompress = opt.nocompress; sbi->s_overriderockperm = opt.overriderockperm;/*
fs/isofs/isofs.h +0 -1
@@ -44,7 +44,6 @@ struct isofs_sb_info {unsigned char s_session; unsigned int s_high_sierra:1; unsigned int s_rock:2; - unsigned int s_utf8:1; unsigned int s_cruft:1; /* Broken disks with high byte of length* containing junk */ unsigned int s_nocompress:1;
fs/isofs/joliet.c +1 -3
@@ -41,14 +41,12 @@ uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls)int get_joliet_filename (struct iso_directory_record * de,unsigned char *outname,struct inode * inode) { -unsigned char utf8;struct nls_table *nls;unsigned char len =0 ; - utf8 =ISOFS_SB (inode->i_sb)->s_utf8; nls =ISOFS_SB (inode->i_sb)->s_nls_iocharset; -if (utf8) { +if (!nls) { len =utf16s_to_utf8s ((const wchar_t *) de->name, de->name_len[0 ] >>1 ,UTF16_BIG_ENDIAN , outname,PAGE_SIZE );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/23 bcache: add proper error unwinding in bcache_device_init
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 224b0683228c5f332f9cee615d85e75e9a347170 ]
Except for the IDA none of the allocations in bcache_device_init is unwound on error, fix that.
--- drivers/md/bcache/super.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/md/bcache/super.c +11 -5
@@ -824,20 +824,20 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, n =BITS_TO_LONGS (d->nr_stripes) *sizeof (unsigned long ); d->full_dirty_stripes =kvzalloc (n,GFP_KERNEL );if (!d->full_dirty_stripes) -return -ENOMEM ; + goto out_free_stripe_sectors_dirty; idx =ida_simple_get (&bcache_device_idx,0 ,BCACHE_DEVICE_IDX_MAX ,GFP_KERNEL );if (idx <0 ) -return idx; + goto out_free_full_dirty_stripes;if (bioset_init (&d->bio_split,4 , offsetof(struct bbio , bio),BIOSET_NEED_BVECS |BIOSET_NEED_RESCUER )) - goto err; + goto out_ida_remove; d->disk =alloc_disk (BCACHE_MINORS );if (!d->disk) - goto err; + goto out_bioset_exit;set_capacity (d->disk, sectors);snprintf (d->disk->disk_name,DISK_NAME_LEN ,"bcache%i" , idx);
@@ -872,8 +872,14 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,return 0 ; -err: +out_bioset_exit: +bioset_exit (&d->bio_split); +out_ida_remove:ida_simple_remove (&bcache_device_idx, idx); +out_free_full_dirty_stripes: +kvfree (d->full_dirty_stripes); +out_free_stripe_sectors_dirty: +kvfree (d->stripe_sectors_dirty);return -ENOMEM ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/23 nvme-rdma: don't update queue count when failing to set io queues
In reply to Sasha LevinFrom: Ruozhu Li <[email protected]>
[ Upstream commit 85032874f80ba17bf187de1d14d9603bf3f582b8 ]
We update ctrl->queue_count and schedule another reconnect when io queue count is zero.But we will never try to create any io queue in next reco- nnection, because ctrl->queue_count already set to zero.We will end up having an admin-only session in Live state, which is exactly what we try to avoid in the original patch.
Update ctrl->queue_count after queue_count zero checking to fix it.
--- drivers/nvme/host/rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/rdma.c +2 -2
@@ -643,13 +643,13 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl)if (ret)return ret; - ctrl->ctrl.queue_count = nr_io_queues +1 ; -if (ctrl->ctrl.queue_count <2 ) { +if (nr_io_queues ==0 ) {dev_err (ctrl->ctrl.device,"unable to set any I/O queues\n" );return -ENOMEM ; } + ctrl->ctrl.queue_count = nr_io_queues +1 ;dev_info (ctrl->ctrl.device,"creating %d I/O queues.\n" , nr_io_queues);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/23 power: supply: max17042_battery: fix typo in MAx17042_TOFF
In reply to Sasha LevinFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit ed0d0a0506025f06061325cedae1bbebd081620a ]
--- drivers/power/supply/max17042_battery.c | 2 +- include/linux/power/max17042_battery.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/max17042_battery.c +1 -1
@@ -740,7 +740,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)struct max17042_config_data *config = chip->pdata->config_data;max17042_override_por (map,MAX17042_TGAIN , config->tgain); -max17042_override_por (map, MAx17042_TOFF, config->toff); +max17042_override_por (map,MAX17042_TOFF , config->toff);max17042_override_por (map,MAX17042_CGAIN , config->cgain);max17042_override_por (map,MAX17042_COFF , config->coff);
include/linux/power/max17042_battery.h +1 -1
@@ -82,7 +82,7 @@ enum max17042_register { MAX17042_RelaxCFG =0x2A , MAX17042_MiscCFG =0x2B ,MAX17042_TGAIN =0x2C , - MAx17042_TOFF =0x2D , +MAX17042_TOFF =0x2D ,MAX17042_CGAIN =0x2E , MAX17042_COFF = 0x2F,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/23 s390/cio: add dev_busid sysfs entry for each subchannel
In reply to Sasha LevinFrom: Vineeth Vijayan <[email protected]>
[ Upstream commit d3683c055212bf910d4e318f7944910ce10dbee6 ]
Introduce dev_busid, which exports the device-id associated with the io-subchannel (and message-subchannel). The dev_busid indicates that of the device which may be physically installed on the corrosponding subchannel. The dev_busid value "none" indicates that the subchannel is not valid, there is no I/O device currently associated with the subchannel.
The dev_busid information would be helpful to write device-specific udev-rules associated with the subchannel. The dev_busid interface would be available even when the sch is not bound to any driver or if there is no operational device connected on it. Hence this attribute can be used to write udev-rules which are specific to the device associated with the subchannel.
--- drivers/s390/cio/css.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/s390/cio/css.c +17 -0
@@ -364,9 +364,26 @@ static ssize_t pimpampom_show(struct device *dev, }static DEVICE_ATTR_RO (pimpampom); +static ssize_t dev_busid_show (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct subchannel *sch =to_subchannel (dev); +struct pmcw *pmcw = &sch->schib.pmcw; + +if ((pmcw->st ==SUBCHANNEL_TYPE_IO || + pmcw->st ==SUBCHANNEL_TYPE_MSG ) && pmcw->dnv) +return sysfs_emit (buf,"0.%x.%04x\n" , sch->schid.ssid, + pmcw->dev); +else +return sysfs_emit (buf,"none\n" ); +} +static DEVICE_ATTR_RO (dev_busid); +static struct attribute *io_subchannel_type_attrs[] = { &dev_attr_chpids.attr, &dev_attr_pimpampom.attr, + &dev_attr_dev_busid.attr,NULL , };ATTRIBUTE_GROUPS (io_subchannel_type);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/23 libata: fix ata_host_start()
In reply to Sasha LevinFrom: Damien Le Moal <[email protected]>
[ Upstream commit 355a8031dc174450ccad2a61c513ad7222d87a97 ]
The loop on entry of ata_host_start() may not initialize host->ops to a non NULL value. The test on the host_stop field of host->ops must then be preceded by a check that host->ops is not NULL.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -6412,7 +6412,7 @@ int ata_host_start(struct ata_host *host) have_stop =1 ; } -if (host->ops->host_stop) +if (host->ops && host->ops->host_stop) have_stop =1 ;if (have_stop) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/23 crypto: qat - do not ignore errors from enable_vf2pf_comms()
In reply to Sasha LevinFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 5147f0906d50a9d26f2b8698cd06b5680e9867ff ]
The function adf_dev_init() ignores the error code reported by enable_vf2pf_comms(). If the latter fails, e.g. the VF is not compatible with the pf, then the load of the VF driver progresses.
This patch changes adf_dev_init() so that the error code from enable_vf2pf_comms() is returned to the caller.
--- drivers/crypto/qat/qat_common/adf_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/qat/qat_common/adf_init.c +3 -2
@@ -105,6 +105,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)struct service_hndl *service;struct list_head *list_itr;struct adf_hw_device_data *hw_data = accel_dev->hw_device; +int ret;if (!hw_data) { dev_err(&GET_DEV(accel_dev),
@@ -171,9 +172,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) } hw_data->enable_error_correction (accel_dev); - hw_data->enable_vf2pf_comms (accel_dev); + ret = hw_data->enable_vf2pf_comms (accel_dev); -return 0 ; +return ret; }EXPORT_SYMBOL_GPL (adf_dev_init);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/23 crypto: qat - handle both source of interrupt in VF ISR
In reply to Sasha LevinFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 0a73c762e1eee33a5e5dc0e3488f1b7cd17249b3 ]
The top half of the VF drivers handled only a source at the time. If an interrupt for PF2VF and bundle occurred at the same time, the ISR scheduled only the bottom half for PF2VF.
This patch fixes the VF top half so that if both sources of interrupt trigger at the same time, both bottom halves are scheduled.
This patch is based on earlier work done by Conor McLoughlin.
--- drivers/crypto/qat/qat_common/adf_vf_isr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_common/adf_vf_isr.c +4 -3
@@ -203,6 +203,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)struct adf_bar *pmisc = &GET_BARS (accel_dev)[hw_data->get_misc_bar_id (hw_data)];void __iomem *pmisc_bar_addr = pmisc->virt_addr; +bool handled = false;u32 v_int;/* Read VF INT source CSR to determine the source of VF interrupt */
@@ -215,7 +216,7 @@ static irqreturn_t adf_isr(int irq, void *privdata)/* Schedule tasklet to handle interrupt BH */ tasklet_hi_schedule (&accel_dev->vf.pf2vf_bh_tasklet); -return IRQ_HANDLED ; + handled = true; }/* Check bundle interrupt */
@@ -227,10 +228,10 @@ static irqreturn_t adf_isr(int irq, void *privdata)WRITE_CSR_INT_FLAG_AND_COL (bank->csr_addr, bank->bank_number,0 );tasklet_hi_schedule (&bank->resp_handler); -return IRQ_HANDLED ; + handled = true; } -return IRQ_NONE ; +return handled ?IRQ_HANDLED :IRQ_NONE ; }static int adf_request_msi_irq (struct adf_accel_dev *accel_dev)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/23 crypto: qat - fix reuse of completion variable
In reply to Sasha LevinFrom: Marco Chiappero <[email protected]>
[ Upstream commit 3d655732b0199562267a05c7ff69ecdd11632939 ]
Use reinit_completion() to set to a clean state a completion variable, used to coordinate the VF to PF request-response flow, before every new VF request.
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +2 -0
@@ -361,6 +361,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) msg |=ADF_PFVF_COMPATIBILITY_VERSION <<ADF_VF2PF_COMPAT_VER_REQ_SHIFT ;BUILD_BUG_ON (ADF_PFVF_COMPATIBILITY_VERSION >255 ); +reinit_completion (&accel_dev->vf.iov_msg_completion); +/* Send request from VF to PF */ ret =adf_iov_putmsg (accel_dev, msg,0 );if (ret) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/23 crypto: qat - fix naming for init/shutdown VF to PF notifications
In reply to Sasha LevinFrom: Marco Chiappero <[email protected]>
[ Upstream commit b90c1c4d3fa8cd90f4e8245b13564380fd0bfad1 ]
At start and shutdown, VFs notify the PF about their state. These notifications are carried out through a message exchange using the PFVF protocol.
Function names lead to believe they do perform init or shutdown logic. This is to fix the naming to better reflect their purpose.
--- drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c | 4 ++-- drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c | 4 ++-- drivers/crypto/qat/qat_common/adf_common_drv.h | 8 ++++---- drivers/crypto/qat/qat_common/adf_vf2pf_msg.c | 12 ++++++------ .../qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-)
drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c +2 -2
@@ -123,10 +123,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c +2 -2
@@ -123,10 +123,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
drivers/crypto/qat/qat_common/adf_common_drv.h +4 -4
@@ -239,8 +239,8 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev,void adf_enable_pf2vf_interrupts (struct adf_accel_dev *accel_dev);void adf_disable_pf2vf_interrupts (struct adf_accel_dev *accel_dev); -int adf_vf2pf_init (struct adf_accel_dev *accel_dev); -void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev); +int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev); +void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev);int adf_init_pf_wq (void );void adf_exit_pf_wq (void );int adf_init_vf_wq (void );
@@ -263,12 +263,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev) { } -static inline int adf_vf2pf_init (struct adf_accel_dev *accel_dev) +static inline int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev) {return 0 ; } -static inline void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev) +static inline void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev) { }
drivers/crypto/qat/qat_common/adf_vf2pf_msg.c +6 -6
@@ -49,14 +49,14 @@#include "adf_pf2vf_msg.h" /** -* adf_vf2pf_init() - send init msg to PF +* adf_vf2pf_notify_init() - send init msg to PF * @accel_dev: Pointer to acceleration VF device. * * Function sends an init messge from the VF to a PF * * Return: 0 on success, error code otherwise. */ -int adf_vf2pf_init (struct adf_accel_dev *accel_dev) +int adf_vf2pf_notify_init (struct adf_accel_dev *accel_dev) {u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | (ADF_VF2PF_MSGTYPE_INIT <<ADF_VF2PF_MSGTYPE_SHIFT ));
@@ -69,17 +69,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev)set_bit (ADF_STATUS_PF_RUNNING , &accel_dev->status);return 0 ; } -EXPORT_SYMBOL_GPL (adf_vf2pf_init); +EXPORT_SYMBOL_GPL (adf_vf2pf_notify_init);/** -* adf_vf2pf_shutdown() - send shutdown msg to PF +* adf_vf2pf_notify_shutdown() - send shutdown msg to PF * @accel_dev: Pointer to acceleration VF device. * * Function sends a shutdown messge from the VF to a PF * * Return: void */ -void adf_vf2pf_shutdown (struct adf_accel_dev *accel_dev) +void adf_vf2pf_notify_shutdown (struct adf_accel_dev *accel_dev) {u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | (ADF_VF2PF_MSGTYPE_SHUTDOWN <<ADF_VF2PF_MSGTYPE_SHIFT ));
@@ -89,4 +89,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev)dev_err (&GET_DEV (accel_dev),"Failed to send Shutdown event to PF\n" ); } -EXPORT_SYMBOL_GPL (adf_vf2pf_shutdown); +EXPORT_SYMBOL_GPL (adf_vf2pf_notify_shutdown);
drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c +2 -2
@@ -123,10 +123,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) hw_data->enable_error_correction = adf_vf_void_noop; hw_data->init_admin_comms = adf_vf_int_noop; hw_data->exit_admin_comms = adf_vf_void_noop; - hw_data->send_admin_init = adf_vf2pf_init; + hw_data->send_admin_init = adf_vf2pf_notify_init; hw_data->init_arb = adf_vf_int_noop; hw_data->exit_arb = adf_vf_void_noop; - hw_data->disable_iov = adf_vf2pf_shutdown; + hw_data->disable_iov = adf_vf2pf_notify_shutdown; hw_data->get_accel_mask = get_accel_mask; hw_data->get_ae_mask = get_ae_mask; hw_data->get_num_accels = get_num_accels;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/23 crypto: qat - do not export adf_iov_putmsg()
In reply to Sasha LevinFrom: Giovanni Cabiddu <[email protected]>
[ Upstream commit 645ae0af1840199086c33e4f841892ebee73f615 ]
The function adf_iov_putmsg() is only used inside the intel_qat module therefore should not be exported.
Remove EXPORT_SYMBOL for the function adf_iov_putmsg().
--- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +0 -1
@@ -231,7 +231,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr)return ret; } -EXPORT_SYMBOL_GPL (adf_iov_putmsg);void adf_vf2pf_req_hndl (struct adf_accel_vf_info *vf_info) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/23 fcntl: fix potential deadlock for &fasync_struct.fa_lock
In reply to Sasha LevinFrom: Desmond Cheong Zhi Xi <[email protected]>
[ Upstream commit 2f488f698fda820f8e6fa0407630154eceb145d6 ]
There is an existing lock hierarchy of &dev->event_lock --> &fasync_struct.fa_lock --> &f->f_owner.lock from the following call chain:
input_inject_event():
spin_lock_irqsave(&dev->event_lock,...);
input_handle_event():
input_pass_values():
input_to_handler():
evdev_events():
evdev_pass_values():
spin_lock(&client->buffer_lock);
__pass_event():
kill_fasync():
kill_fasync_rcu():
read_lock(&fa->fa_lock);
send_sigio():
read_lock_irqsave(&fown->lock,...);&dev->event_lock is HARDIRQ-safe, so interrupts have to be disabled while grabbing &fasync_struct.fa_lock, otherwise we invert the lock hierarchy. However, since kill_fasync which calls kill_fasync_rcu is an exported symbol, it may not necessarily be called with interrupts disabled.
As kill_fasync_rcu may be called with interrupts disabled (for example, in the call chain above), we replace calls to read_lock/read_unlock on &fasync_struct.fa_lock in kill_fasync_rcu with read_lock_irqsave/read_unlock_irqrestore.
--- fs/fcntl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fcntl.c +3 -2
@@ -993,13 +993,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band) {while (fa) {struct fown_struct *fown; +unsigned long flags;if (fa->magic !=FASYNC_MAGIC ) {printk (KERN_ERR "kill_fasync: bad magic number in " "fasync_struct!\n" );return ; } -read_lock (&fa->fa_lock); +read_lock_irqsave (&fa->fa_lock, flags);if (fa->fa_file) { fown = &fa->fa_file->f_owner;/* Don't send SIGURG to processes which have not set a
@@ -1008,7 +1009,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band)if (!(sig ==SIGURG && fown->signum ==0 ))send_sigio (fown, fa->fa_fd, band); } -read_unlock (&fa->fa_lock); +read_unlock_irqrestore (&fa->fa_lock, flags); fa =rcu_dereference (fa->fa_next); } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/23 udf_get_extendedattr() had no boundary checks.
In reply to Sasha LevinFrom: Stian Skjelstad <[email protected]>
[ Upstream commit 58bc6d1be2f3b0ceecb6027dfa17513ec6aa2abb ]
When parsing the ExtendedAttr data, malicous or corrupt attribute length could cause kernel hangs and buffer overruns in some special cases.
--- fs/udf/misc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
fs/udf/misc.c +11 -2
@@ -173,13 +173,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,else offset =le32_to_cpu (eahd->appAttrLocation); -while (offset < iinfo->i_lenEAttr) { +while (offset +sizeof (*gaf) < iinfo->i_lenEAttr) { +uint32_t attrLength; + gaf = (struct genericFormat *)&ea[offset]; + attrLength =le32_to_cpu (gaf->attrLength); + +/* Detect undersized elements and buffer overflows */ +if ((attrLength <sizeof (*gaf)) || + (attrLength > (iinfo->i_lenEAttr - offset))) +break ; +if (le32_to_cpu (gaf->attrType) == type && gaf->attrSubtype == subtype)return gaf;else - offset +=le32_to_cpu (gaf->attrLength); + offset += attrLength; } }
Signature · 1 line
2.30.2