6.1.53-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 428/600 RDMA/rxe: Split rxe_run_task() into two subroutines
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
[ Upstream commit dccb23f6c312e4480fe32ccbc2afac1a5cac7e5e ]
Split rxe_run_task(task, sched) into rxe_run_task(task) and rxe_sched_task(task).
Stable-dep-of: 5d122db2ff80 ("RDMA/rxe: Fix incomplete state save in rxe_requester")
--- drivers/infiniband/sw/rxe/rxe_comp.c | 19 +++++++++++-------- drivers/infiniband/sw/rxe/rxe_net.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_qp.c | 10 +++++----- drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++----- drivers/infiniband/sw/rxe/rxe_resp.c | 5 ++++- drivers/infiniband/sw/rxe/rxe_task.c | 15 ++++++++++----- drivers/infiniband/sw/rxe/rxe_task.h | 7 +++---- drivers/infiniband/sw/rxe/rxe_verbs.c | 8 ++++---- 8 files changed, 44 insertions(+), 34 deletions(-)
drivers/infiniband/sw/rxe/rxe_comp.c +11 -8
@@ -118,7 +118,7 @@ void retransmit_timer(struct timer_list *t)if (qp->valid) { qp->comp.timeout =1 ; -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task); } }
@@ -132,7 +132,10 @@ void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb)if (must_sched !=0 )rxe_counter_inc (SKB_TO_PKT (skb)->rxe,RXE_CNT_COMPLETER_SCHED ); -rxe_run_task (&qp->comp.task, must_sched); +if (must_sched) +rxe_sched_task (&qp->comp.task); +else +rxe_run_task (&qp->comp.task); } static inline enum comp_state get_wqe(struct rxe_qp *qp,
@@ -305,7 +308,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, qp->comp.psn = pkt->psn;if (qp->req.wait_psn) { qp->req.wait_psn =0 ; -rxe_run_task (&qp->req.task,0 ); +rxe_run_task (&qp->req.task); } }return COMPST_ERROR_RETRY ;
@@ -452,7 +455,7 @@ static void do_complete(struct rxe_qp *qp, struct rxe_send_wqe *wqe)*/ if (qp->req.wait_fence) { qp->req.wait_fence =0 ; -rxe_run_task (&qp->req.task,0 ); +rxe_run_task (&qp->req.task); } }
@@ -466,7 +469,7 @@ static inline enum comp_state complete_ack(struct rxe_qp *qp,if (qp->req.need_rd_atomic) { qp->comp.timeout_retry =0 ; qp->req.need_rd_atomic =0 ; -rxe_run_task (&qp->req.task,0 ); +rxe_run_task (&qp->req.task); } }
@@ -512,7 +515,7 @@ static inline enum comp_state complete_wqe(struct rxe_qp *qp,if (qp->req.wait_psn) { qp->req.wait_psn =0 ; -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); } }
@@ -646,7 +649,7 @@ int rxe_completer(void *arg)if (qp->req.wait_psn) { qp->req.wait_psn =0 ; -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); } state =COMPST_DONE ;
@@ -714,7 +717,7 @@ int rxe_completer(void *arg) RXE_CNT_COMP_RETRY); qp->req.need_retry =1 ; qp->comp.started_retry =1 ; -rxe_run_task (&qp->req.task,0 ); +rxe_run_task (&qp->req.task); } goto done;
drivers/infiniband/sw/rxe/rxe_net.c +2 -2
@@ -348,7 +348,7 @@ static void rxe_skb_tx_dtor(struct sk_buff *skb)if (unlikely (qp->need_req_skb && skb_out <RXE_INFLIGHT_SKBS_PER_QP_LOW )) -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task);rxe_put (qp); }
@@ -435,7 +435,7 @@ int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt,if ((qp_type (qp) !=IB_QPT_RC ) && (pkt->mask &RXE_END_MASK )) { pkt->wqe->state = wqe_state_done; -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task); }rxe_counter_inc (rxe,RXE_CNT_SENT_PKTS );
drivers/infiniband/sw/rxe/rxe_qp.c +5 -5
@@ -539,10 +539,10 @@ static void rxe_qp_drain(struct rxe_qp *qp)if (qp->req.state !=QP_STATE_DRAINED ) { qp->req.state =QP_STATE_DRAIN ;if (qp_type (qp) ==IB_QPT_RC ) -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task);else __rxe_do_task (&qp->comp.task); -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); } } }
@@ -556,13 +556,13 @@ void rxe_qp_error(struct rxe_qp *qp) qp->attr.qp_state =IB_QPS_ERR ;/* drain work and packet queues */ -rxe_run_task (&qp->resp.task,1 ); +rxe_sched_task (&qp->resp.task);if (qp_type (qp) ==IB_QPT_RC ) -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task);else __rxe_do_task (&qp->comp.task); -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); }/* called by the modify qp verb */
drivers/infiniband/sw/rxe/rxe_req.c +5 -5
@@ -105,7 +105,7 @@ void rnr_nak_timer(struct timer_list *t)/* request a send queue retry */ qp->req.need_retry =1 ; qp->req.wait_for_rnr_timer =0 ; -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); }static struct rxe_send_wqe *req_next_wqe (struct rxe_qp *qp)
@@ -608,7 +608,7 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe)* which can lead to a deadlock. So go ahead and complete * it now. */ -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task);return 0 ; }
@@ -733,7 +733,7 @@ int rxe_requester(void *arg) qp->req.wqe_index); wqe->state = wqe_state_done; wqe->status =IB_WC_SUCCESS ; -rxe_run_task (&qp->comp.task,0 ); +rxe_run_task (&qp->comp.task); goto done; } payload = mtu;
@@ -795,7 +795,7 @@ int rxe_requester(void *arg)rollback_state (wqe, qp, &rollback_wqe, rollback_psn);if (err == -EAGAIN ) { -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task); goto exit; }
@@ -817,7 +817,7 @@ int rxe_requester(void *arg) qp->req.wqe_index =queue_next_index (qp->sq.queue, qp->req.wqe_index); wqe->state = wqe_state_error; qp->req.state =QP_STATE_ERROR ; -rxe_run_task (&qp->comp.task,0 ); +rxe_run_task (&qp->comp.task); exit: ret = -EAGAIN ; out:
drivers/infiniband/sw/rxe/rxe_resp.c +4 -1
@@ -91,7 +91,10 @@ void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb) must_sched = (pkt->opcode ==IB_OPCODE_RC_RDMA_READ_REQUEST ) || (skb_queue_len (&qp->req_pkts) >1 ); -rxe_run_task (&qp->resp.task, must_sched); +if (must_sched) +rxe_sched_task (&qp->resp.task); +else +rxe_run_task (&qp->resp.task); } static inline enum resp_states get_req(struct rxe_qp *qp,
drivers/infiniband/sw/rxe/rxe_task.c +10 -5
@@ -127,15 +127,20 @@ void rxe_cleanup_task(struct rxe_task *task)tasklet_kill (&task->tasklet); } -void rxe_run_task (struct rxe_task *task,int sched) +void rxe_run_task (struct rxe_task *task) {if (task->destroyed)return ; -if (sched) -tasklet_schedule (&task->tasklet); -else -rxe_do_task (&task->tasklet); +rxe_do_task (&task->tasklet); +} + +void rxe_sched_task (struct rxe_task *task) +{ +if (task->destroyed) +return ; + +tasklet_schedule (&task->tasklet); }void rxe_disable_task (struct rxe_task *task)
drivers/infiniband/sw/rxe/rxe_task.h +3 -4
@@ -52,10 +52,9 @@ int __rxe_do_task(struct rxe_task *task);*/ void rxe_do_task (struct tasklet_struct *t); -/* run a task, else schedule it to run as a tasklet, The decision -* to run or schedule tasklet is based on the parameter sched. -*/ -void rxe_run_task (struct rxe_task *task,int sched); +void rxe_run_task (struct rxe_task *task); + +void rxe_sched_task (struct rxe_task *task);/* keep a task from scheduling */ void rxe_disable_task (struct rxe_task *task);
drivers/infiniband/sw/rxe/rxe_verbs.c +4 -4
@@ -678,9 +678,9 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, wr = next; } -rxe_run_task (&qp->req.task,1 ); +rxe_sched_task (&qp->req.task);if (unlikely (qp->req.state ==QP_STATE_ERROR )) -rxe_run_task (&qp->comp.task,1 ); +rxe_sched_task (&qp->comp.task);return err; }
@@ -702,7 +702,7 @@ static int rxe_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,if (qp->is_user) {/* Utilize process context to do protocol processing */ -rxe_run_task (&qp->req.task,0 ); +rxe_run_task (&qp->req.task);return 0 ; }else return rxe_post_send_kernel (qp, wr, bad_wr);
@@ -740,7 +740,7 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,spin_unlock_irqrestore (&rq->producer_lock, flags);if (qp->resp.state ==QP_STATE_ERROR ) -rxe_run_task (&qp->resp.task,1 ); +rxe_sched_task (&qp->resp.task);return err; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 429/600 RDMA/rxe: Fix incomplete state save in rxe_requester
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Pearson <[email protected]>
[ Upstream commit 5d122db2ff80cd2aed4dcd630befb56b51ddf947 ]
If a send packet is dropped by the IP layer in rxe_requester() the call to rxe_xmit_packet() can fail with err == -EAGAIN. To recover, the state of the wqe is restored to the state before the packet was sent so it can be resent. However, the routines that save and restore the state miss a significnt part of the variable state in the wqe, the dma struct which is used to process through the sge table. And, the state is not saved before the packet is built which modifies the dma struct.
Under heavy stress testing with many QPs on a fast node sending large messages to a slow node dropped packets are observed and the resent packets are corrupted because the dma struct was not restored. This patch fixes this behavior and allows the test cases to succeed.
--- drivers/infiniband/sw/rxe/rxe_req.c | 45 ++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +25 -20
@@ -529,10 +529,11 @@ static void save_state(struct rxe_send_wqe *wqe,struct rxe_send_wqe *rollback_wqe, u32 *rollback_psn) { - rollback_wqe->state = wqe->state; + rollback_wqe->state = wqe->state; rollback_wqe->first_psn = wqe->first_psn; - rollback_wqe->last_psn = wqe->last_psn; - *rollback_psn = qp->req.psn; + rollback_wqe->last_psn = wqe->last_psn; + rollback_wqe->dma = wqe->dma; + *rollback_psn = qp->req.psn; } static void rollback_state(struct rxe_send_wqe *wqe,
@@ -540,10 +541,11 @@ static void rollback_state(struct rxe_send_wqe *wqe, struct rxe_send_wqe *rollback_wqe, u32 rollback_psn) { - wqe->state = rollback_wqe->state; + wqe->state = rollback_wqe->state; wqe->first_psn = rollback_wqe->first_psn; - wqe->last_psn = rollback_wqe->last_psn; - qp->req.psn = rollback_psn; + wqe->last_psn = rollback_wqe->last_psn; + wqe->dma = rollback_wqe->dma; + qp->req.psn = rollback_psn; }static void update_state (struct rxe_qp *qp,struct rxe_pkt_info *pkt)
@@ -746,6 +748,9 @@ int rxe_requester(void *arg) pkt.mask = rxe_opcode[opcode].mask; pkt.wqe = wqe; +/* save wqe state before we build and send packet */ +save_state (wqe, qp, &rollback_wqe, &rollback_psn); + av =rxe_get_av (&pkt, &ah);if (unlikely (!av)) {pr_err ("qp#%d Failed no address vector\n" ,qp_num (qp));
@@ -778,29 +783,29 @@ int rxe_requester(void *arg)if (ah)rxe_put (ah); -/* -* To prevent a race on wqe access between requester and completer, -* wqe members state and psn need to be set before calling -* rxe_xmit_packet(). -* Otherwise, completer might initiate an unjustified retry flow. -*/ -save_state (wqe, qp, &rollback_wqe, &rollback_psn); +/* update wqe state as though we had sent it */ update_wqe_state (qp, wqe, &pkt);update_wqe_psn (qp, wqe, &pkt, payload); err =rxe_xmit_packet (qp, &pkt, skb);if (err) { - qp->need_req_skb =1 ; +if (err != -EAGAIN ) { + wqe->status =IB_WC_LOC_QP_OP_ERR ; + goto err; + } +/* the packet was dropped so reset wqe to the state +* before we sent it so we can try to resend +*/ rollback_state (wqe, qp, &rollback_wqe, rollback_psn); -if (err == -EAGAIN ) { -rxe_sched_task (&qp->req.task); - goto exit; - } +/* force a delay until the dropped packet is freed and +* the send queue is drained below the low water mark +*/ + qp->need_req_skb =1 ; - wqe->status =IB_WC_LOC_QP_OP_ERR ; - goto err; +rxe_sched_task (&qp->req.task); + goto exit; }update_state (qp, &pkt);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 430/600 scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 7d3d20dee4f648ec44e9717d5f647d594d184433 ]
The qedf_dbg_stop_io_on_error_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by using a small on-stack buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_debugfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/qedf/qedf_debugfs.c +3 -4
@@ -185,18 +185,17 @@ qedf_dbg_stop_io_on_error_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { int cnt; +char cbuf[7 ];struct qedf_dbg_ctx *qedf_dbg = (struct qedf_dbg_ctx *)filp->private_data;struct qedf_ctx *qedf =container_of (qedf_dbg, struct qedf_ctx, dbg_ctx);QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"entered\n" ); - cnt =sprintf (buffer,"%s\n" , + cnt =scnprintf (cbuf,sizeof (cbuf),"%s\n" , qedf->stop_io_on_error ?"true" :"false" ); - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; +return simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 431/600 scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 31b5991a9a91ba97237ac9da509d78eec453ff72 ]
The qedf_dbg_debug_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by using a small on-stack buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_debugfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/scsi/qedf/qedf_debugfs.c +3 -4
@@ -138,15 +138,14 @@ qedf_dbg_debug_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) {int cnt; +char cbuf[32 ];struct qedf_dbg_ctx *qedf_dbg = (struct qedf_dbg_ctx *)filp->private_data;QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"debug mask=0x%x\n" , qedf_debug); - cnt =sprintf (buffer,"debug mask = 0x%x\n" , qedf_debug); + cnt =scnprintf (cbuf,sizeof (cbuf),"debug mask = 0x%x\n" , qedf_debug); - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; +return simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 432/600 scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleksandr Natalenko <[email protected]>
[ Upstream commit 25dbc20deab5165f847b4eb42f376f725a986ee8 ]
The qedf_dbg_fp_int_cmd_read() function invokes sprintf() directly on a __user pointer, which may crash the kernel.
Avoid doing that by vmalloc()'ating a buffer for scnprintf() and then calling simple_read_from_buffer() which does a proper copy_to_user() call.
--- drivers/scsi/qedf/qedf_dbg.h | 2 ++ drivers/scsi/qedf/qedf_debugfs.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/scsi/qedf/qedf_dbg.h +2 -0
@@ -59,6 +59,8 @@ extern uint qedf_debug;#define QEDF_LOG_NOTICE 0x40000000/* Notice logs */ #define QEDF_LOG_WARN 0x80000000/* Warning logs */ +#define QEDF_DEBUGFS_LOG_LEN (2 * PAGE_SIZE) +/* Debug context structure */ struct qedf_dbg_ctx {unsigned int host_no;
drivers/scsi/qedf/qedf_debugfs.c +15 -6
@@ -8,6 +8,7 @@#include <linux/uaccess.h> #include <linux/debugfs.h> #include <linux/module.h> +#include <linux/vmalloc.h> #include "qedf.h" #include "qedf_dbg.h"
@@ -98,7 +99,9 @@ static ssize_t qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count, loff_t *ppos) { + ssize_t ret;size_t cnt =0 ; +char *cbuf;int id;struct qedf_fastpath *fp =NULL ; struct qedf_dbg_ctx *qedf_dbg =
@@ -108,19 +111,25 @@ qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count,QEDF_INFO (qedf_dbg,QEDF_LOG_DEBUGFS ,"entered\n" ); - cnt =sprintf (buffer,"\nFastpath I/O completions\n\n" ); + cbuf =vmalloc (QEDF_DEBUGFS_LOG_LEN ); +if (!cbuf) +return 0 ; + + cnt +=scnprintf (cbuf + cnt,QEDF_DEBUGFS_LOG_LEN - cnt,"\nFastpath I/O completions\n\n" );for (id =0 ; id < qedf->num_queues; id++) { fp = &(qedf->fp_array[id]);if (fp->sb_id ==QEDF_SB_ID_NULL )continue ; - cnt +=sprintf ((buffer + cnt),"#%d: %lu\n" , id, - fp->completions); + cnt +=scnprintf (cbuf + cnt,QEDF_DEBUGFS_LOG_LEN - cnt, +"#%d: %lu\n" , id, fp->completions); } - cnt =min_t (int, count, cnt - *ppos); - *ppos += cnt; -return cnt; + ret =simple_read_from_buffer (buffer, count, ppos, cbuf, cnt); + +vfree (cbuf); + +return ret; } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 433/600 RDMA/irdma: Replace one-element array with flexible-array member
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 38313c6d2a02c28162e06753b01bd885caf9386d ]
One-element and zero-length arrays are deprecated. So, replace one-element array in struct irdma_qvlist_info with flexible-array member.
A patch for this was sent a while ago[1]. However, it seems that, at the time, the changes were partially folded[2][3], and the actual flexible-array transformation was omitted. This patch fixes that.
The only binary difference seen before/after changes is shown below:
| drivers/infiniband/hw/irdma/hw.o | @@ -868,7 +868,7 @@ | drivers/infiniband/hw/irdma/hw.c:484 (discriminator 2) | size += struct_size(iw_qvlist, qv_info, rf->msix_count); | 55b: imul $0x45c,%rdi,%rdi |- 562: add $0x10,%rdi |+ 562: add $0x4,%rdi
which is, of course, expected as it reflects the mistake made while folding the patch I've mentioned above.
Worth mentioning is the fact that with this change we save 12 bytes of memory, as can be inferred from the diff snapshot above. Notice that:
$ pahole -C rdma_qv_info idrivers/infiniband/hw/irdma/hw.o
struct irdma_qv_info {
u32 v_idx; /* 0 4 */
u16 ceq_idx; /* 4 2 */
u16 aeq_idx; /* 6 2 */
u8 itr_idx; /* 8 1 *//* size: 12, cachelines: 1, members: 4 */ /* padding: 3 */ /* last cacheline: 12 bytes */ };
--- drivers/infiniband/hw/irdma/main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/irdma/main.h +1 -1
@@ -236,7 +236,7 @@ struct irdma_qv_info {struct irdma_qvlist_info {u32 num_vectors; -struct irdma_qv_info qv_info[1 ]; +struct irdma_qv_info qv_info[]; };struct irdma_gen_ops {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 434/600 coresight: tmc: Explicit type conversions to prevent integer overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruidong Tian <[email protected]>
[ Upstream commit fd380097cdb305582b7a1f9476391330299d2c59 ]
Perf cs_etm session executed unexpectedly when AUX buffer > 1G.
perf record -C 0 -m ,2G -e cs_etm// -- <workload> [ perf record: Captured and wrote 2.615 MB perf.data ]
Perf only collect about 2M perf data rather than 2G. This is becasuse the operation, "nr_pages << PAGE_SHIFT", in coresight tmc driver, will overflow when nr_pages >= 0x80000(correspond to 1G AUX buffer). The overflow cause buffer allocation to fail, and TMC driver will alloc minimal buffer size(1M). You can just get about 2M perf data(1M AUX buffer + perf data header) at least.
Explicit convert nr_pages to 64 bit to avoid overflow.
--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 2 +- drivers/hwtracing/coresight/coresight-tmc-etr.c | 5 +++-- drivers/hwtracing/coresight/coresight-tmc.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
drivers/hwtracing/coresight/coresight-tmc-etf.c +1 -1
@@ -428,7 +428,7 @@ static int tmc_set_etf_buffer(struct coresight_device *csdev,return -EINVAL ;/* wrap head around to the amount of space we have */ - head = handle->head & ((buf->nr_pages <<PAGE_SHIFT ) -1 ); + head = handle->head & (((unsigned long )buf->nr_pages <<PAGE_SHIFT ) -1 );/* find the page to write to */ buf->cur = head /PAGE_SIZE ;
drivers/hwtracing/coresight/coresight-tmc-etr.c +3 -2
@@ -45,7 +45,8 @@ struct etr_perf_buffer { };/* Convert the perf index to an offset within the ETR buffer */ -#define PERF_IDX2OFF (idx, buf) ((idx) % ((buf)->nr_pages << PAGE_SHIFT)) +#define PERF_IDX2OFF (idx, buf) \ + ((idx) % ((unsigned long)(buf)->nr_pages << PAGE_SHIFT))/* Lower limit for ETR hardware buffer */ #define TMC_ETR_PERF_MIN_BUF_SIZE SZ_1M
@@ -1249,7 +1250,7 @@ alloc_etr_buf(struct tmc_drvdata *drvdata, struct perf_event *event,* than the size requested via sysfs. */ if ((nr_pages <<PAGE_SHIFT ) > drvdata->size) { - etr_buf =tmc_alloc_etr_buf (drvdata, (nr_pages <<PAGE_SHIFT ), + etr_buf =tmc_alloc_etr_buf (drvdata, ((ssize_t )nr_pages <<PAGE_SHIFT ),0 , node,NULL );if (!IS_ERR (etr_buf)) goto done;
drivers/hwtracing/coresight/coresight-tmc.h +1 -1
@@ -325,7 +325,7 @@ ssize_t tmc_sg_table_get_data(struct tmc_sg_table *sg_table,static inline unsigned long tmc_sg_table_buf_size (struct tmc_sg_table *sg_table) { -return sg_table->data_pages.nr_pages <<PAGE_SHIFT ; +return (unsigned long )sg_table->data_pages.nr_pages <<PAGE_SHIFT ; }struct coresight_device *tmc_etr_get_catu_device (struct tmc_drvdata *drvdata);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 435/600 interconnect: qcom: qcm2290: Enable sync state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 4e048e9b7a160f7112069c0ec2947be15f3e8154 ]
Enable the generic .sync_state callback to ensure there are no outstanding votes that would waste power.
Generally one would need a bunch of interface clocks to access the QoS registers when trying to go over all possible nodes during sync_state, but QCM2290 surprisingly does not seem to require any such handling.
--- drivers/interconnect/qcom/qcm2290.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/qcm2290.c +1 -0
@@ -1355,6 +1355,7 @@ static struct platform_driver qcm2290_noc_driver = { .driver = { .name = "qnoc-qcm2290", .of_match_table = qcm2290_noc_of_match, + .sync_state = icc_sync_state, }, };module_platform_driver (qcm2290_noc_driver);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 436/600 dma-buf/sync_file: Fix docs syntax
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 05d56d8079d510a2994039470f65bea85f0075ee ]
Fixes the warning:
include/uapi/linux/sync_file.h:77: warning: Function parameter or member 'num_fences' not described in 'sync_file_info'
--- include/uapi/linux/sync_file.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/sync_file.h +1 -1
@@ -52,7 +52,7 @@ struct sync_fence_info {* @name: name of fence * @status: status of fence. 1: signaled 0:active <0:error * @flags: sync_file_info flags -* @num_fences number of fences in the sync_file +* @num_fences: number of fences in the sync_file * @pad: padding for 64-bit alignment, should always be zero * @sync_fence_info: pointer to array of structs sync_fence_info with all * fences in the sync_file
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 437/600 driver core: test_async: fix an error code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 22d2381bbd70a5853c2ee77522f4965139672db9 ]
The test_platform_device_register_node() function should return error pointers instead of NULL. That is what the callers are expecting.
--- drivers/base/test/test_async_driver_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/test/test_async_driver_probe.c +1 -1
@@ -84,7 +84,7 @@ test_platform_device_register_node(char *name, int id, int nid) pdev =platform_device_alloc (name, id);if (!pdev) -return NULL ; +return ERR_PTR (-ENOMEM );if (nid !=NUMA_NO_NODE )set_dev_node (&pdev->dev, nid);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 438/600 driver core: Call dma_cleanup() on the test_remove path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit f429378a9bf84d79a7e2cae05d2e3384cf7d68ba ]
When test_remove is enabled really_probe() does not properly pair dma_configure() with dma_remove(), it will end up calling dma_configure() twice. This corrupts the owner_cnt and renders the group unusable with VFIO/etc.
Add the missing cleanup before going back to re_probe.
--- drivers/base/dd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/dd.c +2 -0
@@ -674,6 +674,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)device_remove (dev);driver_sysfs_remove (dev); +if (dev->bus && dev->bus->dma_cleanup) + dev->bus->dma_cleanup (dev);device_unbind_cleanup (dev); goto re_probe;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 439/600 kernfs: add stub helper for kernfs_generic_poll()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 79038a99445f69c5d28494dd4f8c6f0509f65b2e ]
In some randconfig builds, kernfs ends up being disabled, so there is no prototype for kernfs_generic_poll()
In file included from kernel/sched/build_utility.c:97:kernel/sched/psi.c:1479:3: error: implicit declaration of function 'kernfs_generic_poll' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
kernfs_generic_poll(t->of, wait);
^Add a stub helper for it, as we have it for other kernfs functions.
--- include/linux/kernfs.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/kernfs.h +4 -0
@@ -550,6 +550,10 @@ static inline int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) {return -ENOSYS ; } +static inline __poll_t kernfs_generic_poll (struct kernfs_open_file *of, +struct poll_table_struct *pt) +{return -ENOSYS ; } +static inline void kernfs_notify (struct kernfs_node *kn) { } static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 440/600 extcon: cht_wc: add POWER_SUPPLY dependency
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit d20a3a8a32e3fa564ff25da860c5fc1a97642dfe ]
The driver fails to link when CONFIG_POWER_SUPPLY is disabled:
x86_64-linux-ld: vmlinux.o: in function `cht_wc_extcon_psy_get_prop':
extcon-intel-cht-wc.c:(.text+0x15ccda7): undefined reference to `power_supply_get_drvdata'
x86_64-linux-ld: vmlinux.o: in function `cht_wc_extcon_pwrsrc_event':
extcon-intel-cht-wc.c:(.text+0x15cd3e9): undefined reference to `power_supply_changed'
x86_64-linux-ld: vmlinux.o: in function `cht_wc_extcon_probe':
extcon-intel-cht-wc.c:(.text+0x15cd596): undefined reference to `devm_power_supply_register'
It should be possible to change the driver to not require this at compile time and still provide other functions, but adding a hard Kconfig dependency does not seem to have any practical downsides and is simpler since the option is normally enabled anyway.
--- drivers/extcon/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/extcon/Kconfig +1 -0
@@ -62,6 +62,7 @@ config EXTCON_INTEL_CHT_WC tristate "Intel Cherrytrail Whiskey Cove PMIC extcon driver" depends on INTEL_SOC_PMIC_CHTWC depends on USB_SUPPORT + depends on POWER_SUPPLY select USB_ROLE_SWITCH help Say Y here to enable extcon support for charger detection / control
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 441/600 iommu/mediatek: Remove unused "mapping" member from mtk_iommu_data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yong Wu <[email protected]>
[ Upstream commit 9ff894edd542618dad2fef538f8272c620a501db ]
Just remove a unused variable that only is for mtk_iommu_v1.
Stable-dep-of: cf69ef46dbd9 ("iommu/mediatek: Fix two IOMMU share pagetable issue")
--- drivers/iommu/mtk_iommu.c | 3 --- 1 file changed, 3 deletions(-)
drivers/iommu/mtk_iommu.c +0 -3
@@ -223,10 +223,7 @@ struct mtk_iommu_data {struct device *smicomm_dev;struct mtk_iommu_bank_data *bank; - -struct dma_iommu_mapping *mapping;/* For mtk_iommu_v1.c */ struct regmap *pericfg; -struct mutex mutex;/* Protect m4u_group/m4u_dom above */ /*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 442/600 iommu/mediatek: Fix two IOMMU share pagetable issue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengci.Xu <[email protected]>
[ Upstream commit cf69ef46dbd980a0b1c956d668e066a73e0acd0f ]
Prepare for mt8188 to fix a two IOMMU HWs share pagetable issue.
We have two MM IOMMU HWs in mt8188, one is VPP-IOMMU, the other is VDO-IOMMU. The 2 MM IOMMU HWs share pagetable don't work in this case:
a) VPP-IOMMU probe firstly.
b) VDO-IOMMU probe.
c) The master for VDO-IOMMU probe (means frstdata is vpp-iommu).
d) The master in another domain probe. No matter it is vdo or vpp.
Then it still create a new pagetable in step d). The problem is "frstdata->bank[0]->m4u_dom" was not initialized. Then when d) enter, it still create a new one.
In this patch, we create a new variable "share_dom" for this share pgtable case, it should be helpful for readable. and put all the share pgtable logic in the mtk_iommu_domain_finalise.
In mt8195, the master of VPP-IOMMU probes before than VDO-IOMMU from its dtsi node sequence, we don't see this issue in it. Prepare for mt8188.
--- drivers/iommu/mtk_iommu.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/iommu/mtk_iommu.c +14 -8
@@ -223,6 +223,8 @@ struct mtk_iommu_data {struct device *smicomm_dev;struct mtk_iommu_bank_data *bank; +struct mtk_iommu_domain *share_dom;/* For 2 HWs share pgtable */ +struct regmap *pericfg;struct mutex mutex;/* Protect m4u_group/m4u_dom above */
@@ -574,15 +576,14 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,struct mtk_iommu_data *data, unsigned int region_id) { + struct mtk_iommu_domain *share_dom = data->share_dom;const struct mtk_iommu_iova_region *region; -struct mtk_iommu_domain *m4u_dom; - -/* Always use bank0 in sharing pgtable case */ - m4u_dom = data->bank[0 ].m4u_dom; -if (m4u_dom) { - dom->iop = m4u_dom->iop; - dom->cfg = m4u_dom->cfg; - dom->domain.pgsize_bitmap = m4u_dom->cfg.pgsize_bitmap; + +/* Always use share domain in sharing pgtable case */ +if (MTK_IOMMU_HAS_FLAG (data->plat_data,SHARE_PGTABLE ) && share_dom) { + dom->iop = share_dom->iop; + dom->cfg = share_dom->cfg; + dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap; goto update_iova_region; }
@@ -612,6 +613,9 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom,/* Update our support page sizes bitmap */ dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap; +if (MTK_IOMMU_HAS_FLAG (data->plat_data,SHARE_PGTABLE )) + data->share_dom = dom; + update_iova_region:/* Update the iova region for this domain */ region = data->plat_data->iova_region + region_id;
@@ -662,7 +666,9 @@ static int mtk_iommu_attach_device(struct iommu_domain *domain,/* Data is in the frstdata in sharing pgtable case. */ frstdata =mtk_iommu_get_frst_data (hw_list); +mutex_lock (&frstdata->mutex); ret =mtk_iommu_domain_finalise (dom, frstdata, region_id); +mutex_unlock (&frstdata->mutex);if (ret) {mutex_unlock (&dom->mutex);return -ENODEV ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 443/600 iommu/sprd: Add missing force_aperture
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit d48a51286c698f7fe8efc688f23a532f4fe9a904 ]
force_aperture was intended to false only by GART drivers that have an identity translation outside the aperture. This does not describe sprd, so add the missing 'force_aperture = true'.
--- drivers/iommu/sprd-iommu.c | 1 + 1 file changed, 1 insertion(+)
drivers/iommu/sprd-iommu.c +1 -0
@@ -147,6 +147,7 @@ static struct iommu_domain *sprd_iommu_domain_alloc(unsigned int domain_type) dom->domain.geometry.aperture_start =0 ; dom->domain.geometry.aperture_end =SZ_256M -1 ; + dom->domain.geometry.force_aperture = true;return &dom->domain; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 444/600 RDMA/hns: Fix port active speed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit df1bcf90a66a10967a3a43510b42cb3566208011 ]
HW supports a variety of different speed, but the current speed is fixed.
The real speed should be querried from ethernet.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/hns/hns_roce_main.c +5 -2
@@ -219,6 +219,7 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,unsigned long flags;enum ib_mtu mtu;u32 port; +int ret; port = port_num -1 ;
@@ -231,8 +232,10 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u32 port_num,IB_PORT_BOOT_MGMT_SUP ; props->max_msg_sz =HNS_ROCE_MAX_MSG_LEN ; props->pkey_tbl_len =1 ; - props->active_width =IB_WIDTH_4X ; - props->active_speed =1 ; + ret =ib_get_eth_speed (ib_dev, port_num, &props->active_speed, + &props->active_width); +if (ret) +ibdev_warn (ib_dev,"failed to get speed, ret = %d.\n" , ret);spin_lock_irqsave (&hr_dev->iboe.lock, flags);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 445/600 RDMA/hns: Fix incorrect post-send with direct wqe of wr-list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit 706efac4477cdb8be857f6322457de524acc02ff ]
Currently, direct wqe is not supported for wr-list. RoCE driver excludes direct wqe for wr-list by judging whether the number of wr is 1.
For a wr-list where the second wr is a length-error atomic wr, the post-send driver handles the first wr and adds 1 to the wr number counter firstly. While handling the second wr, the driver finds out a length error and terminates the wr handle process, remaining the counter at 1. This causes the driver mistakenly judges there is only 1 wr and thus enters the direct wqe process, carrying the current length-error atomic wqe.
This patch fixes the error by adding a judgement whether the current wr is a bad wr. If so, use the normal doorbell process but not direct wqe despite the wr number is 1.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +2 -1
@@ -757,7 +757,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, qp->sq.head += nreq; qp->next_sge = sge_idx; -if (nreq ==1 && (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE )) +if (nreq ==1 && !ret && + (qp->en_flags &HNS_ROCE_QP_CAP_DIRECT_WQE ))write_dwqe (hr_dev, qp, wqe);else update_sq_db (hr_dev, qp);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 446/600 RDMA/hns: Fix inaccurate error label name in init instance
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxian Huang <[email protected]>
[ Upstream commit c9c0bd3c177d93d80968f720304087ba83fe8f74 ]
This patch fixes inaccurate error label name in init instance.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +4 -4
@@ -6865,14 +6865,14 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle) ret =hns_roce_init (hr_dev);if (ret) {dev_err (hr_dev->dev,"RoCE Engine init failed!\n" ); - goto error_failed_cfg; + goto error_failed_roce_init; }if (hr_dev->pci_dev->revision ==PCI_REVISION_ID_HIP08 ) { ret =free_mr_init (hr_dev);if (ret) {dev_err (hr_dev->dev,"failed to init free mr!\n" ); - goto error_failed_roce_init; + goto error_failed_free_mr_init; } }
@@ -6880,10 +6880,10 @@ static int __hns_roce_hw_v2_init_instance(struct hnae3_handle *handle)return 0 ; -error_failed_roce_init: +error_failed_free_mr_init:hns_roce_exit (hr_dev); -error_failed_cfg: +error_failed_roce_init:kfree (hr_dev->priv); error_failed_kzalloc:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 447/600 RDMA/hns: Fix CQ and QP cache affinity
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengchang Tang <[email protected]>
[ Upstream commit 9e03dbea2b0634b21a45946b4f8097e0dc86ebe1 ]
Currently, the affinity between QP cache and CQ cache is not considered when assigning QPN, it will affect the message rate of HW.
Allocate QPN from QP cache with better CQ affinity to get better performance.
--- drivers/infiniband/hw/hns/hns_roce_device.h | 1 + drivers/infiniband/hw/hns/hns_roce_qp.c | 28 ++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +1 -0
@@ -97,6 +97,7 @@#define HNS_ROCE_CQ_BANK_NUM 4#define CQ_BANKID_SHIFT 2 +#define CQ_BANKID_MASK GENMASK(1, 0)enum {SERV_TYPE_RC ,
drivers/infiniband/hw/hns/hns_roce_qp.c +22 -6
@@ -170,14 +170,29 @@ static void hns_roce_ib_qp_event(struct hns_roce_qp *hr_qp, } } -static u8 get_least_load_bankid_for_qp (struct hns_roce_bank *bank) +static u8 get_affinity_cq_bank (u8 qp_bank) { -u32 least_load = bank[0 ].inuse; +return (qp_bank >>1 ) &CQ_BANKID_MASK ; +} + +static u8 get_least_load_bankid_for_qp (struct ib_qp_init_attr *init_attr, +struct hns_roce_bank *bank) +{ +#define INVALID_LOAD_QPNUM 0xFFFFFFFF +struct ib_cq *scq = init_attr->send_cq; +u32 least_load =INVALID_LOAD_QPNUM ; +unsigned long cqn =0 ;u8 bankid =0 ;u32 bankcnt;u8 i; -for (i =1 ; i <HNS_ROCE_QP_BANK_NUM ; i++) { +if (scq) + cqn =to_hr_cq (scq)->cqn; + +for (i =0 ; i <HNS_ROCE_QP_BANK_NUM ; i++) { +if (scq && (get_affinity_cq_bank (i) != (cqn &CQ_BANKID_MASK ))) +continue ; + bankcnt = bank[i].inuse;if (bankcnt < least_load) { least_load = bankcnt;
@@ -209,7 +224,8 @@ static int alloc_qpn_with_bankid(struct hns_roce_bank *bank, u8 bankid,return 0 ; } -static int alloc_qpn (struct hns_roce_dev *hr_dev,struct hns_roce_qp *hr_qp) +static int alloc_qpn (struct hns_roce_dev *hr_dev,struct hns_roce_qp *hr_qp, +struct ib_qp_init_attr *init_attr) {struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;unsigned long num =0 ;
@@ -220,7 +236,7 @@ static int alloc_qpn(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) num =1 ; }else {mutex_lock (&qp_table->bank_mutex); - bankid =get_least_load_bankid_for_qp (qp_table->bank); + bankid =get_least_load_bankid_for_qp (init_attr, qp_table->bank); ret =alloc_qpn_with_bankid (&qp_table->bank[bankid], bankid, &num);
@@ -1146,7 +1162,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev, goto err_buf; } - ret =alloc_qpn (hr_dev, hr_qp); + ret =alloc_qpn (hr_dev, hr_qp, init_attr);if (ret) {ibdev_err (ibdev,"failed to alloc QPN, ret = %d.\n" , ret); goto err_qpn;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 448/600 IB/uverbs: Fix an potential error pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiang Yang <[email protected]>
[ Upstream commit 26b7d1a27167e7adf75b150755e05d2bc123ce55 ]
smatch reports the warning below:drivers/infiniband/core/uverbs_std_types_counters.c:110 ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() error: 'uattr' dereferencing possible ERR_PTR()
The return value of uattr maybe ERR_PTR(-ENOENT), fix this by checking the value of uattr before using it.
--- drivers/infiniband/core/uverbs_std_types_counters.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/core/uverbs_std_types_counters.c +2 -0
@@ -107,6 +107,8 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(return ret; uattr =uverbs_attr_get (attrs,UVERBS_ATTR_READ_COUNTERS_BUFF ); +if (IS_ERR (uattr)) +return PTR_ERR (uattr); read_attr.ncounters = uattr->ptr_attr.len /sizeof (u64); read_attr.counters_buff =uverbs_zalloc ( attrs,array_size (read_attr.ncounters,sizeof (u64)));
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 449/600 fsi: aspeed: Reset master errors after CFAM reset
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eddie James <[email protected]>
[ Upstream commit 52300909f4670ac552bfeb33c1355b896eac8c06 ]
It has been observed that sometimes the FSI master will return all 0xffs after a CFAM has been taken out of reset, without presenting any error. Resetting the FSI master errors resolves the issue.
--- drivers/fsi/fsi-master-aspeed.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fsi/fsi-master-aspeed.c +2 -0
@@ -454,6 +454,8 @@ static ssize_t cfam_reset_store(struct device *dev, struct device_attribute *attgpiod_set_value (aspeed->cfam_reset_gpio,1 );usleep_range (900 ,1000 );gpiod_set_value (aspeed->cfam_reset_gpio,0 ); +usleep_range (900 ,1000 ); +opb_writel (aspeed, ctrl_base +FSI_MRESP0 ,cpu_to_be32 (FSI_MRESP_RST_ALL_MASTER ));mutex_unlock (&aspeed->lock);trace_fsi_master_aspeed_cfam_reset (false);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 450/600 iommu/qcom: Disable and reset context bank before programming
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 9f3fef23d9b5a858a6e6d5f478bb1b6b76265e76 ]
Writing the new TTBRs, TCRs and MAIRs on a previously enabled
context bank may trigger a context fault, resulting in firmware driven AP resets: change the domain initialization programming sequence to disable the context bank(s) and to also clear the related fault address (CB_FAR) and fault status (CB_FSR) registers before writing new values to TTBR0/1, TCR/TCR2, MAIR0/1.
--- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu/qcom_iommu.c +7 -0
@@ -273,6 +273,13 @@ static int qcom_iommu_init_domain(struct iommu_domain *domain, ctx->secure_init = true; } +/* Disable context bank before programming */ +iommu_writel (ctx,ARM_SMMU_CB_SCTLR ,0 ); + +/* Clear context bank fault address fault status registers */ +iommu_writel (ctx,ARM_SMMU_CB_FAR ,0 ); +iommu_writel (ctx,ARM_SMMU_CB_FSR ,ARM_SMMU_FSR_FAULT ); +/* TTBRs */ iommu_writeq(ctx, ARM_SMMU_CB_TTBR0, pgtbl_cfg.arm_lpae_s1_cfg.ttbr |
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 451/600 iommu/vt-d: Fix to flush cache of PASID directory table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yanfei Xu <[email protected]>
[ Upstream commit 8a3b8e63f8371c1247b7aa24ff9c5312f1a6948b ]
Even the PCI devices don't support pasid capability, PASID table is mandatory for a PCI device in scalable mode. However flushing cache of pasid directory table for these devices are not taken after pasid table is allocated as the "size" of table is zero. Fix it by calculating the size by page order.
Found this when reading the code, no real problem encountered for now.
--- drivers/iommu/intel/pasid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/pasid.c +1 -1
@@ -127,7 +127,7 @@ int intel_pasid_alloc_table(struct device *dev) info->pasid_table = pasid_table;if (!ecap_coherent (info->iommu->ecap)) -clflush_cache_range (pasid_table->table, size); +clflush_cache_range (pasid_table->table, (1 << order) *PAGE_SIZE );return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 452/600 platform/x86: dell-sysman: Fix reference leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 7295a996fdab7bf83dc3d4078fa8b139b8e0a1bf ]
If a duplicate attribute is found using kset_find_obj(), a reference to that attribute is returned. This means that we need to dispose it accordingly. Use kobject_put() to dispose the duplicate attribute in such a case.
Compile-tested only.
--- drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/platform/x86/dell/dell-wmi-sysman/sysman.c +6 -3
@@ -396,6 +396,7 @@ static int init_bios_attributes(int attr_type, const char *guid)struct kobject *attr_name_kobj;//individual attribute names union acpi_object *obj =NULL ;union acpi_object *elements; +struct kobject *duplicate;struct kset *tmp_set;int min_elements;
@@ -454,9 +455,11 @@ static int init_bios_attributes(int attr_type, const char *guid)else tmp_set = wmi_priv.main_dir_kset; -if (kset_find_obj (tmp_set, elements[ATTR_NAME ].string.pointer)) { -pr_debug ("duplicate attribute name found - %s\n" , - elements[ATTR_NAME ].string.pointer); + duplicate =kset_find_obj (tmp_set, elements[ATTR_NAME ].string.pointer); +if (duplicate) { +pr_debug ("Duplicate attribute name found - %s\n" , + elements[ATTR_NAME ].string.pointer); +kobject_put (duplicate); goto nextobj; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 453/600 media: cec: core: add adap_nb_transmit_canceled() callback
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit da53c36ddd3f118a525a04faa8c47ca471e6c467 ]
A potential deadlock was found by Zheng Zhang with a local syzkaller instance.
The problem is that when a non-blocking CEC transmit is canceled by calling cec_data_cancel, that in turn can call the high-level received() driver callback, which can call cec_transmit_msg() to transmit a new message.
The cec_data_cancel() function is called with the adap->lock mutex held, and cec_transmit_msg() tries to take that same lock.
The root cause is that the received() callback can either be used to pass on a received message (and then adap->lock is not held), or to report a canceled transmit (and then adap->lock is held).
This is confusing, so create a new low-level adap_nb_transmit_canceled callback that reports back that a non-blocking transmit was canceled.
And the received() callback is only called when a message is received, as was the case before commit f9d0ecbf56f4 ("media: cec: correctly pass on reply results") complicated matters.
--- drivers/media/cec/core/cec-adap.c | 4 ++-- include/media/cec.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/media/cec/core/cec-adap.c +2 -2
@@ -385,8 +385,8 @@ static void cec_data_cancel(struct cec_data *data, u8 tx_status, u8 rx_status)cec_queue_msg_monitor (adap, &data->msg,1 );if (!data->blocking && data->msg.sequence) -/* Allow drivers to process the message first */ -call_op (adap, received, &data->msg); +/* Allow drivers to react to a canceled transmit */ +call_void_op (adap, adap_nb_transmit_canceled, &data->msg);cec_data_completed (data); }
include/media/cec.h +4 -2
@@ -121,14 +121,16 @@ struct cec_adap_ops {void (*adap_configured)(struct cec_adapter *adap,bool configured);int (*adap_transmit)(struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg); +void (*adap_nb_transmit_canceled)(struct cec_adapter *adap, +const struct cec_msg *msg);void (*adap_status)(struct cec_adapter *adap,struct seq_file *file);void (*adap_free)(struct cec_adapter *adap); -/* Error injection callbacks */ +/* Error injection callbacks, called without adap->lock held */ int (*error_inj_show)(struct cec_adapter *adap,struct seq_file *sf);bool (*error_inj_parse_line)(struct cec_adapter *adap,char *line); -/* High-level CEC message callback */ +/* High-level CEC message callback, called without adap->lock held */ int (*received)(struct cec_adapter *adap,struct cec_msg *msg); };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 454/600 media: cec: core: add adap_unconfigured() callback
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 948a77aaecf202f722cf2264025f9987e5bd5c26 ]
The adap_configured() callback was called with the adap->lock mutex held if the 'configured' argument was false, and without the adap->lock mutex held if that argument was true.
That was very confusing, and so split this up in a adap_unconfigured() callback and a high-level configured() callback.
This also makes it easier to understand when the mutex is held: all low-level adap_* callbacks are called with the mutex held. All other callbacks are called without that mutex held.
--- drivers/media/cec/core/cec-adap.c | 4 ++-- include/media/cec.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/media/cec/core/cec-adap.c +2 -2
@@ -1345,7 +1345,7 @@ static void cec_adap_unconfigure(struct cec_adapter *adap)cec_flush (adap);wake_up_interruptible (&adap->kthread_waitq);cec_post_state_event (adap); -call_void_op (adap, adap_configured, false); +call_void_op (adap, adap_unconfigured); }/*
@@ -1536,7 +1536,7 @@ static int cec_config_thread_func(void *arg) adap->kthread_config =NULL ;complete (&adap->config_completion);mutex_unlock (&adap->lock); -call_void_op (adap, adap_configured, true); +call_void_op (adap, configured);return 0 ; unconfigure:
include/media/cec.h +3 -2
@@ -113,12 +113,12 @@ struct cec_fh {#define CEC_FREE_TIME_TO_USEC (ft) ((ft) * 2400)struct cec_adap_ops { -/* Low-level callbacks */ +/* Low-level callbacks, called with adap->lock held */ int (*adap_enable)(struct cec_adapter *adap,bool enable);int (*adap_monitor_all_enable)(struct cec_adapter *adap,bool enable);int (*adap_monitor_pin_enable)(struct cec_adapter *adap,bool enable);int (*adap_log_addr)(struct cec_adapter *adap,u8 logical_addr); -void (*adap_configured)(struct cec_adapter *adap,bool configured); +void (*adap_unconfigured)(struct cec_adapter *adap);int (*adap_transmit)(struct cec_adapter *adap,u8 attempts,u32 signal_free_time,struct cec_msg *msg); void (*adap_nb_transmit_canceled)(struct cec_adapter *adap,
@@ -131,6 +131,7 @@ struct cec_adap_ops {bool (*error_inj_parse_line)(struct cec_adapter *adap,char *line);/* High-level CEC message callback, called without adap->lock held */ +void (*configured)(struct cec_adapter *adap);int (*received)(struct cec_adapter *adap,struct cec_msg *msg); };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 455/600 media: go7007: Remove redundant if statement
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit f33cb49081da0ec5af0888f8ecbd566bd326eed1 ]
The if statement that compares msgs[i].len != 3 is always false because it is in a code block where msg[i].len is equal to 3. The check is redundant and can be removed.
As detected by cppcheck static analysis:drivers/media/usb/go7007/go7007-i2c.c:168:20: warning: Opposite inner 'if' condition leads to a dead code block. [oppositeInnerCondition]
--- drivers/media/usb/go7007/go7007-i2c.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/usb/go7007/go7007-i2c.c +0 -2
@@ -165,8 +165,6 @@ static int go7007_i2c_master_xfer(struct i2c_adapter *adapter, }else if (msgs[i].len ==3 ) {if (msgs[i].flags &I2C_M_RD )return -EIO ; -if (msgs[i].len !=3 ) -return -EIO ;if (go7007_i2c_xfer (go, msgs[i].addr,0 , (msgs[i].buf[0 ] <<8 ) | msgs[i].buf[1 ],0x01 , &msgs[i].buf[2 ]) <0 )
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 456/600 media: venus: hfi_venus: Only consider sys_idle_indicator on V1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 6283e4834c69fa93a108efa18c6aa09c7e626f49 ]
As per information from Qualcomm [1], this property is not really supported beyond msm8916 (HFI V1) and some newer HFI versions really dislike receiving it, going as far as crashing the device.
Only consider toggling it (via the module option) on HFIV1. While at it, get rid of the global static variable (which defaulted to zero) which was never explicitly assigned to for V1.
Note: [1] is a reply to the actual message in question, as lore did not properly receive some of the emails..
[1] https://lore.kernel.org/lkml/[email protected]/
--- drivers/media/platform/qcom/venus/hfi_venus.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/media/platform/qcom/venus/hfi_venus.c +6 -12
@@ -131,7 +131,6 @@ struct venus_hfi_device {static bool venus_pkt_debug;int venus_fw_debug =HFI_DEBUG_MSG_ERROR |HFI_DEBUG_MSG_FATAL ; -static bool venus_sys_idle_indicator;static bool venus_fw_low_power_mode = true;static int venus_hw_rsp_timeout =1000 ;static bool venus_fw_coverage;
@@ -947,17 +946,12 @@ static int venus_sys_set_default_properties(struct venus_hfi_device *hdev)if (ret)dev_warn (dev,"setting fw debug msg ON failed (%d)\n" , ret); -/* -* Idle indicator is disabled by default on some 4xx firmware versions, -* enable it explicitly in order to make suspend functional by checking -* WFI (wait-for-interrupt) bit. -*/ -if (IS_V4 (hdev->core) ||IS_V6 (hdev->core)) - venus_sys_idle_indicator = true; - - ret =venus_sys_set_idle_message (hdev, venus_sys_idle_indicator); -if (ret) -dev_warn (dev,"setting idle response ON failed (%d)\n" , ret); +/* HFI_PROPERTY_SYS_IDLE_INDICATOR is not supported beyond 8916 (HFI V1) */ +if (IS_V1 (hdev->core)) { + ret =venus_sys_set_idle_message (hdev, false); +if (ret) +dev_warn (dev,"setting idle response ON failed (%d)\n" , ret); + } ret =venus_sys_set_power_control (hdev, venus_fw_low_power_mode);if (ret)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 457/600 docs: ABI: fix spelling/grammar in SBEFIFO timeout interface
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 2cd9ec2a51474d4c0b4d2a061f2de7da34eff476 ]
Correct spelling problems as identified by codespell. Correct one grammar error.
--- Documentation/ABI/testing/sysfs-bus-fsi-devices-sbefifo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-bus-fsi-devices-sbefifo +3 -3
@@ -5,6 +5,6 @@ Description: Indicates whether or not this SBE device has experienced a timeout; i.e. the SBE did not respond within the time allotted by the driver. A value of 1 indicates that a timeout has - ocurred and no transfers have completed since the timeout. A - value of 0 indicates that no timeout has ocurred, or if one - has, more recent transfers have completed successful. + occurred and no transfers have completed since the timeout. A + value of 0 indicates that no timeout has occurred, or if one + has, more recent transfers have completed successfully.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 458/600 USB: gadget: core: Add missing kerneldoc for vbus_work
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 159a98afc88e88f588077afe818081d67f50a5e0 ]
Add a missing kerneldoc description of the vbus_work field in struct usb_udc.
--- drivers/usb/gadget/udc/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/core.c +1 -0
@@ -40,6 +40,7 @@ static struct bus_type gadget_bus_type;* @allow_connect: Indicates whether UDC is allowed to be pulled up. * Set/cleared by gadget_(un)bind_driver() after gadget driver is bound or * unbound. +* @vbus_work: work routine to handle VBUS status change notifications. * @connect_lock: protects udc->started, gadget->connect, * gadget->allow_connect and gadget->deactivate. The routines * usb_gadget_connect_locked(), usb_gadget_disconnect_locked(),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 459/600 USB: gadget: f_mass_storage: Fix unused variable warning
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 55c3e571d2a0aabef4f1354604443f1c415d2e85 ]
Fix a "variable set but not used" warning in f_mass_storage.c. rc is
used if verbose debugging is enabled but not otherwise.
--- drivers/usb/gadget/function/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_mass_storage.c +1 -1
@@ -926,7 +926,7 @@ static void invalidate_sub(struct fsg_lun *curlun) {struct file *filp = curlun->filp;struct inode *inode =file_inode (filp); -unsigned long rc; +unsigned long __maybe_unused rc; rc =invalidate_mapping_pages (inode->i_mapping,0 ,-1 );VLDBG (curlun,"invalidate_mapping_pages -> %ld\n" , rc);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 460/600 drivers: base: Free devm resources when unregistering a device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gow <[email protected]>
[ Upstream commit 699fb50d99039a50e7494de644f96c889279aca3 ]
In the current code, devres_release_all() only gets called if the device has a bus and has been probed.
This leads to issues when using bus-less or driver-less devices where the device might never get freed if a managed resource holds a reference to the device. This is happening in the DRM framework for example.
We should thus call devres_release_all() in the device_del() function to make sure that the device-managed actions are properly executed when the device is unregistered, even if it has neither a bus nor a driver.
This is effectively the same change than commit 2f8d16a996da ("devres:
release resources on device_del()") that got reverted by commit a525a3ddeaca ("driver core: free devres in device_release") over memory leaks concerns.
This patch effectively combines the two commits mentioned above to release the resources both on device_del() and device_release() and get the best of both worlds.
--- drivers/base/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/base/core.c +11 -0
@@ -3855,6 +3855,17 @@ void device_del(struct device *dev)device_platform_notify_remove (dev);device_links_purge (dev); +/* +* If a device does not have a driver attached, we need to clean +* up any managed resources. We do this in device_release(), but +* it's never called (and we leak the device) if a managed +* resource holds a reference to the device. So release all +* managed resources here, like we do in driver_detach(). We +* still need to do so again in device_release() in case someone +* adds a new resource after this point, though. +*/ +devres_release_all (dev); +if (dev->bus)blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_REMOVED_DEVICE , dev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 461/600 HID: input: Support devices sending Eraser without Invert
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Illia Ostapyshyn <[email protected]>
[ Upstream commit 276e14e6c3993317257e1787e93b7166fbc30905 ]
Some digitizers (notably XP-Pen Artist 24) do not report the Invert usage when erasing. This causes the device to be permanently stuck with the BTN_TOOL_RUBBER tool after sending Eraser, as Invert is the only usage that can release the tool. In this state, Touch and Inrange are no longer reported to userspace, rendering the pen unusable.
Prior to commit 87562fcd1342 ("HID: input: remove the need for HID_QUIRK_INVERT"), BTN_TOOL_RUBBER was never set and Eraser events were simply translated into BTN_TOUCH without causing an inconsistent state.
Introduce HID_QUIRK_NOINVERT for such digitizers and detect them during hidinput_configure_usage(). This quirk causes the tool to be released as soon as Eraser is reported as not set. Set BTN_TOOL_RUBBER in input->keybit when mapping Eraser.
--- drivers/hid/hid-input.c | 18 ++++++++++++++++-- include/linux/hid.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)
drivers/hid/hid-input.c +16 -2
@@ -961,6 +961,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielreturn ;case 0x3c :/* Invert */ + device->quirks &= ~HID_QUIRK_NOINVERT ;map_key_clear (BTN_TOOL_RUBBER );break ;
@@ -986,9 +987,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielcase 0x45 :/* ERASER */ /* * This event is reported when eraser tip touches the surface. -* Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when -* tool gets in proximity. +* Actual eraser (BTN_TOOL_RUBBER) is set and released either +* by Invert if tool reports proximity or by Eraser directly. */ +if (!test_bit (BTN_TOOL_RUBBER , input->keybit)) { + device->quirks |=HID_QUIRK_NOINVERT ; +set_bit (BTN_TOOL_RUBBER , input->keybit); + }map_key_clear (BTN_TOUCH );break ;
@@ -1532,6 +1537,15 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, structelse if (report->tool !=BTN_TOOL_RUBBER )/* value is off, tool is not rubber, ignore */ return ; +else if (*quirks &HID_QUIRK_NOINVERT && + !test_bit (BTN_TOUCH , input->key)) { +/* +* There is no invert to release the tool, let hid_input +* send BTN_TOUCH with scancode and release the tool after. +*/ +hid_report_release_tool (report, input,BTN_TOOL_RUBBER ); +return ; + }/* let hid-input set BTN_TOUCH */ break ;
include/linux/hid.h +1 -0
@@ -357,6 +357,7 @@ struct hid_item {#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)#define HID_QUIRK_HAVE_SPECIAL_DRIVER BIT(19)#define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE BIT(20) +#define HID_QUIRK_NOINVERT BIT(21)#define HID_QUIRK_FULLSPEED_INTERVAL BIT(28)#define HID_QUIRK_NO_INIT_REPORTS BIT(29)#define HID_QUIRK_NO_IGNORE BIT(30)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 462/600 media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 98cb72d3b9c5e03b10fa993752ecfcbd9c572d8c ]
Set OV5640_REG_IO_MIPI_CTRL00 bit 2 to 1 instead of 0, since 1 means MIPI CSI2 interface, while 0 means CPI parallel interface.
In the ov5640_set_power_mipi() the interface should obviously be set to MIPI CSI2 since this functions is used to power up the sensor when operated in MIPI CSI2 mode. The sensor should not be in CPI mode in that case.
This fixes a corner case where capturing the first frame on i.MX8MN with CSI/ISI resulted in corrupted frame.
--- drivers/media/i2c/ov5640.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +2 -2
@@ -2531,9 +2531,9 @@ static int ov5640_set_power_mipi(struct ov5640_dev *sensor, bool on)* "ov5640_set_stream_mipi()") * [4] = 0 : Power up MIPI HS Tx * [3] = 0 : Power up MIPI LS Rx -* [2] = 0 : MIPI interface disabled +* [2] = 1 : MIPI interface enabled */ - ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x40 ); + ret =ov5640_write_reg (sensor,OV5640_REG_IO_MIPI_CTRL00 ,0x44 );if (ret)return ret;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 463/600 media: ov5640: Fix initial RESETB state and annotate timings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit a210df337c5f5c2cd82f36c9dbb154ec63365c80 ]
The initial state of RESETB input signal of OV5640 should be asserted, i.e. the sensor should be in reset. This is not the case, make it so.
Since the subsequent assertion of RESETB signal is no longer necessary and the timing of the power sequencing could be slightly adjusted, add annotations to the delays which match OV5640 datasheet rev. 2.03, both:
figure 2-3 power up timing with internal DVDD figure 2-4 power up timing with external DVDD source
The 5..10ms delay between PWDN assertion and RESETB assertion is not even documented in the power sequencing diagram, and with this reset fix, it is no longer even necessary.
--- drivers/media/i2c/ov5640.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/media/i2c/ov5640.c +4 -7
@@ -2441,16 +2441,13 @@ static void ov5640_power(struct ov5640_dev *sensor, bool enable)static void ov5640_powerup_sequence (struct ov5640_dev *sensor) {if (sensor->pwdn_gpio) { -gpiod_set_value_cansleep (sensor->reset_gpio,0 ); +gpiod_set_value_cansleep (sensor->reset_gpio,1 );/* camera power cycle */ ov5640_power (sensor, false); -usleep_range (5000 ,10000 ); +usleep_range (5000 ,10000 );/* t2 */ ov5640_power (sensor, true); -usleep_range (5000 ,10000 ); - -gpiod_set_value_cansleep (sensor->reset_gpio,1 ); -usleep_range (1000 ,2000 ); +usleep_range (1000 ,2000 );/* t3 */ gpiod_set_value_cansleep (sensor->reset_gpio,0 ); }else {
@@ -2458,7 +2455,7 @@ static void ov5640_powerup_sequence(struct ov5640_dev *sensor)ov5640_write_reg (sensor,OV5640_REG_SYS_CTRL0 ,OV5640_REG_SYS_CTRL0_SW_RST ); } -usleep_range (20000 ,25000 ); +usleep_range (20000 ,25000 );/* t4 */ /* * software standby: allows registers programming;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 464/600 media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Stevenson <[email protected]>
[ Upstream commit 66274280b2c745d380508dc27b9a4dfd736e5eda ]
The driver changes the Bayer order based on the flips, but does not define the control correctly with the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
Add the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag.
Stable-dep-of: 7b5a42e6ae71 ("media: ov2680: Remove auto-gain and auto-exposure controls")
--- drivers/media/i2c/ov2680.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov2680.c +2 -0
@@ -967,6 +967,8 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) ctrls->gain->flags |=V4L2_CTRL_FLAG_VOLATILE ; ctrls->exposure->flags |=V4L2_CTRL_FLAG_VOLATILE ; + ctrls->vflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; + ctrls->hflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ;v4l2_ctrl_auto_cluster (2 , &ctrls->auto_gain,0 , true);v4l2_ctrl_auto_cluster (2 , &ctrls->auto_exp,1 , true);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 465/600 media: ov2680: Remove auto-gain and auto-exposure controls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 7b5a42e6ae71927359ea67a2c22570ba97fa4059 ]
Quoting the OV2680 datasheet:
"3.2 exposure and gain control
In the OV2680, the exposure time and gain are set manually from an external controller. The OV2680 supports manual gain and exposure control only for normal applications, no auto mode."
And indeed testing with the atomisp_ov2680 fork of ov2680.c has shown that auto-exposure and auto-gain do not work.
Note that the code setting the auto-exposure flag was broken, callers of ov2680_exposure_set() were directly passing !!ctrls->auto_exp->val as "bool auto_exp" value, but ctrls->auto_exp is a menu control with:
enum v4l2_exposure_auto_type {
V4L2_EXPOSURE_AUTO = 0,
V4L2_EXPOSURE_MANUAL = 1,
...So instead of passing !!ctrls->auto_exp->val they should have been passing ctrls->auto_exp->val == V4L2_EXPOSURE_AUTO, iow the passed value was inverted of what it should have been.
Also remove ov2680_g_volatile_ctrl() since without auto support the gain and exposure controls are not volatile.
This also fixes the control values not being properly applied in ov2680_mode_set(). The 800x600 mode register-list also sets gain, exposure and vflip overriding the last set ctrl values.
ov2680_mode_set() does call ov2680_gain_set() and ov2680_exposure_set() but did this before writing the mode register-list, so these values would still be overridden by the mode register-list.
Add a v4l2_ctrl_handler_setup() call after writing the mode register-list to restore all ctrl values. Also remove the ctrls->gain->is_new check from ov2680_gain_set() so that the gain always gets restored properly.
Last since ov2680_mode_set() now calls v4l2_ctrl_handler_setup(), remove the v4l2_ctrl_handler_setup() call after ov2680_mode_restore() since ov2680_mode_restore() calls ov2680_mode_set().
--- drivers/media/i2c/ov2680.c | 161 ++++--------------------------------- 1 file changed, 17 insertions(+), 144 deletions(-)
drivers/media/i2c/ov2680.c +17 -144
@@ -85,15 +85,8 @@ struct ov2680_mode_info {struct ov2680_ctrls {struct v4l2_ctrl_handler handler; -struct { -struct v4l2_ctrl *auto_exp; -struct v4l2_ctrl *exposure; - }; -struct { -struct v4l2_ctrl *auto_gain; -struct v4l2_ctrl *gain; - }; - +struct v4l2_ctrl *exposure; +struct v4l2_ctrl *gain;struct v4l2_ctrl *hflip;struct v4l2_ctrl *vflip;struct v4l2_ctrl *test_pattern;
@@ -143,6 +136,7 @@ static const struct reg_value ov2680_setting_30fps_QUXGA_800_600[] = { {0x380e, 0x02}, {0x380f, 0x84}, {0x3811, 0x04}, {0x3813, 0x04}, {0x3814, 0x31}, {0x3815, 0x31}, {0x3820, 0xc0}, {0x4008, 0x00}, {0x4009, 0x03}, {0x4837, 0x1e}, {0x3501, 0x4e}, {0x3502, 0xe0}, + {0x3503, 0x03}, }; static const struct reg_value ov2680_setting_30fps_720P_1280_720[] = {
@@ -405,69 +399,15 @@ static int ov2680_test_pattern_set(struct ov2680_dev *sensor, int value)return 0 ; } -static int ov2680_gain_set (struct ov2680_dev *sensor,bool auto_gain) -{ -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 gain; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (1 ), - auto_gain ?0 :BIT (1 )); -if (ret <0 ) -return ret; - -if (auto_gain || !ctrls->gain->is_new) -return 0 ; - - gain = ctrls->gain->val; - - ret =ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); - -return 0 ; -} - -static int ov2680_gain_get (struct ov2680_dev *sensor) -{ -u32 gain; -int ret; - - ret =ov2680_read_reg16 (sensor,OV2680_REG_GAIN_PK , &gain); -if (ret) -return ret; - -return gain; -} - -static int ov2680_exposure_set (struct ov2680_dev *sensor,bool auto_exp) +static int ov2680_gain_set (struct ov2680_dev *sensor,u32 gain) { -struct ov2680_ctrls *ctrls = &sensor->ctrls; -u32 exp; -int ret; - - ret =ov2680_mod_reg (sensor,OV2680_REG_R_MANUAL ,BIT (0 ), - auto_exp ?0 :BIT (0 )); -if (ret <0 ) -return ret; - -if (auto_exp || !ctrls->exposure->is_new) -return 0 ; - - exp = (u32 )ctrls->exposure->val; - exp <<=4 ; - -return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , exp); +return ov2680_write_reg16 (sensor,OV2680_REG_GAIN_PK , gain); } -static int ov2680_exposure_get (struct ov2680_dev *sensor) +static int ov2680_exposure_set (struct ov2680_dev *sensor,u32 exp) { -int ret; -u32 exp; - - ret =ov2680_read_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , &exp); -if (ret) -return ret; - -return exp >>4 ; +return ov2680_write_reg24 (sensor,OV2680_REG_EXPOSURE_PK_HIGH , + exp <<4 ); }static int ov2680_stream_enable (struct ov2680_dev *sensor)
@@ -482,33 +422,17 @@ static int ov2680_stream_disable(struct ov2680_dev *sensor)static int ov2680_mode_set (struct ov2680_dev *sensor) { -struct ov2680_ctrls *ctrls = &sensor->ctrls;int ret; - ret =ov2680_gain_set (sensor, false); -if (ret <0 ) -return ret; - - ret =ov2680_exposure_set (sensor, false); + ret =ov2680_load_regs (sensor, sensor->current_mode);if (ret <0 )return ret; - ret =ov2680_load_regs (sensor, sensor->current_mode); +/* Restore value of all ctrls */ + ret =__v4l2_ctrl_handler_setup (&sensor->ctrls.handler);if (ret <0 )return ret; -if (ctrls->auto_gain->val) { - ret =ov2680_gain_set (sensor, true); -if (ret <0 ) -return ret; - } - -if (ctrls->auto_exp->val ==V4L2_EXPOSURE_AUTO ) { - ret =ov2680_exposure_set (sensor, true); -if (ret <0 ) -return ret; - } - sensor->mode_pending_changes = false;return 0 ;
@@ -590,15 +514,10 @@ static int ov2680_s_power(struct v4l2_subdev *sd, int on)else ret =ov2680_power_off (sensor); -mutex_unlock (&sensor->lock); - -if (on && ret ==0 ) { - ret =v4l2_ctrl_handler_setup (&sensor->ctrls.handler); -if (ret <0 ) -return ret; - +if (on && ret ==0 ) ret =ov2680_mode_restore (sensor); - } + +mutex_unlock (&sensor->lock);return ret; }
@@ -794,52 +713,19 @@ static int ov2680_enum_frame_interval(struct v4l2_subdev *sd,return 0 ; } -static int ov2680_g_volatile_ctrl (struct v4l2_ctrl *ctrl) -{ -struct v4l2_subdev *sd =ctrl_to_sd (ctrl); -struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls; -int val; - -if (!sensor->is_enabled) -return 0 ; - -switch (ctrl->id) { -case V4L2_CID_GAIN : - val =ov2680_gain_get (sensor); -if (val <0 ) -return val; - ctrls->gain->val = val; -break ; -case V4L2_CID_EXPOSURE : - val =ov2680_exposure_get (sensor); -if (val <0 ) -return val; - ctrls->exposure->val = val; -break ; - } - -return 0 ; -} -static int ov2680_s_ctrl (struct v4l2_ctrl *ctrl) {struct v4l2_subdev *sd =ctrl_to_sd (ctrl);struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct ov2680_ctrls *ctrls = &sensor->ctrls;if (!sensor->is_enabled)return 0 ;switch (ctrl->id) { -case V4L2_CID_AUTOGAIN : -return ov2680_gain_set (sensor, !!ctrl->val);case V4L2_CID_GAIN : -return ov2680_gain_set (sensor, !!ctrls->auto_gain->val); -case V4L2_CID_EXPOSURE_AUTO : -return ov2680_exposure_set (sensor, !!ctrl->val); +return ov2680_gain_set (sensor, ctrl->val);case V4L2_CID_EXPOSURE : -return ov2680_exposure_set (sensor, !!ctrls->auto_exp->val); +return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP :if (sensor->is_streaming)return -EBUSY ;
@@ -864,7 +750,6 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl) }static const struct v4l2_ctrl_ops ov2680_ctrl_ops = { - .g_volatile_ctrl = ov2680_g_volatile_ctrl, .s_ctrl = ov2680_s_ctrl, };
@@ -936,7 +821,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)if (ret <0 )return ret; -v4l2_ctrl_handler_init (hdl,7 ); +v4l2_ctrl_handler_init (hdl,5 ); hdl->lock = &sensor->lock;
@@ -948,16 +833,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)ARRAY_SIZE (test_pattern_menu) -1 , 0, 0, test_pattern_menu); - ctrls->auto_exp =v4l2_ctrl_new_std_menu (hdl, ops, -V4L2_CID_EXPOSURE_AUTO , -V4L2_EXPOSURE_MANUAL ,0 , -V4L2_EXPOSURE_AUTO ); - ctrls->exposure =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_EXPOSURE ,0 ,32767 ,1 ,0 ); - ctrls->auto_gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_AUTOGAIN , -0 ,1 ,1 ,1 ); ctrls->gain =v4l2_ctrl_new_std (hdl, ops,V4L2_CID_GAIN ,0 ,2047 ,1 ,0 );if (hdl->error) {
@@ -965,14 +843,9 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor) goto cleanup_entity; } - ctrls->gain->flags |=V4L2_CTRL_FLAG_VOLATILE ; - ctrls->exposure->flags |=V4L2_CTRL_FLAG_VOLATILE ; ctrls->vflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; ctrls->hflip->flags |=V4L2_CTRL_FLAG_MODIFY_LAYOUT ; -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_gain,0 , true); -v4l2_ctrl_auto_cluster (2 , &ctrls->auto_exp,1 , true); - sensor->sd.ctrl_handler = hdl; ret =v4l2_async_register_subdev (&sensor->sd);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 466/600 media: ov2680: Fix ov2680_bayer_order()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 50a7bad4e0a37d7018ab6fe843dd84bc6b2ecf72 ]
The index into ov2680_hv_flip_bayer_order[] should be 0-3, but ov2680_bayer_order() was using 0 + BIT(2) + (BIT(2) << 1) as max index, while the intention was to use: 0 + 1 + 2 as max index.
Fix the index calculation in ov2680_bayer_order(), while at it also just use the ctrl values rather then reading them back using a slow i2c-read transaction.
This also allows making the function void, since there now are no more i2c-reads to error check.
Note the check for the ctrls being NULL is there to allow adding an ov2680_fill_format() helper later, which will call ov2680_set_bayer_order() during probe() before the ctrls are created.
[Sakari Ailus: Change all users of ov2680_set_bayer_order() here]
--- drivers/media/i2c/ov2680.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
drivers/media/i2c/ov2680.c +14 -19
@@ -315,26 +315,17 @@ static void ov2680_power_down(struct ov2680_dev *sensor)usleep_range (5000 ,10000 ); } -static int ov2680_bayer_order (struct ov2680_dev *sensor) +static void ov2680_set_bayer_order (struct ov2680_dev *sensor) { -u32 format1; -u32 format2; -u32 hv_flip; -int ret; - - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT1 , &format1); -if (ret <0 ) -return ret; +int hv_flip =0 ; - ret =ov2680_read_reg (sensor,OV2680_REG_FORMAT2 , &format2); -if (ret <0 ) -return ret; +if (sensor->ctrls.vflip && sensor->ctrls.vflip->val) + hv_flip +=1 ; - hv_flip = (format2 &BIT (2 ) <<1 ) | (format1 &BIT (2 )); +if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) + hv_flip +=2 ; sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; - -return 0 ; }static int ov2680_vflip_enable (struct ov2680_dev *sensor)
@@ -345,7 +336,8 @@ static int ov2680_vflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_vflip_disable (struct ov2680_dev *sensor)
@@ -356,7 +348,8 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_enable (struct ov2680_dev *sensor)
@@ -367,7 +360,8 @@ static int ov2680_hflip_enable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_hflip_disable (struct ov2680_dev *sensor)
@@ -378,7 +372,8 @@ static int ov2680_hflip_disable(struct ov2680_dev *sensor)if (ret <0 )return ret; -return ov2680_bayer_order (sensor); +ov2680_set_bayer_order (sensor); +return 0 ; }static int ov2680_test_pattern_set (struct ov2680_dev *sensor,int value)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 467/600 media: ov2680: Fix vflip / hflip set functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit d5d08ad330c9ccebc5e066fda815423a290f48b0 ]
ov2680_vflip_disable() / ov2680_hflip_disable() pass BIT(0) instead of 0 as value to ov2680_mod_reg().
While fixing this also:
1. Stop having separate enable/disable functions for hflip / vflip
2. Move the is_streaming check, which is unique to hflip / vflip into the ov2680_set_?flip() functions.
for a nice code cleanup.
--- drivers/media/i2c/ov2680.c | 50 +++++++++----------------------------- 1 file changed, 12 insertions(+), 38 deletions(-)
drivers/media/i2c/ov2680.c +12 -38
@@ -328,23 +328,15 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor) sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; } -static int ov2680_vflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_vflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_vflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT1 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -352,23 +344,15 @@ static int ov2680_vflip_disable(struct ov2680_dev *sensor)return 0 ; } -static int ov2680_hflip_enable (struct ov2680_dev *sensor) +static int ov2680_set_hflip (struct ov2680_dev *sensor,s32 val) {int ret; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (2 )); -if (ret <0 ) -return ret; - -ov2680_set_bayer_order (sensor); -return 0 ; -} - -static int ov2680_hflip_disable (struct ov2680_dev *sensor) -{ -int ret; +if (sensor->is_streaming) +return -EBUSY ; - ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 ,BIT (2 ),BIT (0 )); + ret =ov2680_mod_reg (sensor,OV2680_REG_FORMAT2 , +BIT (2 ), val ?BIT (2 ) :0 );if (ret <0 )return ret;
@@ -722,19 +706,9 @@ static int ov2680_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_EXPOSURE :return ov2680_exposure_set (sensor, ctrl->val);case V4L2_CID_VFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_vflip_enable (sensor); -else -return ov2680_vflip_disable (sensor); +return ov2680_set_vflip (sensor, ctrl->val);case V4L2_CID_HFLIP : -if (sensor->is_streaming) -return -EBUSY ; -if (ctrl->val) -return ov2680_hflip_enable (sensor); -else -return ov2680_hflip_disable (sensor); +return ov2680_set_hflip (sensor, ctrl->val);case V4L2_CID_TEST_PATTERN :return ov2680_test_pattern_set (sensor, ctrl->val);default :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 468/600 media: ov2680: Remove VIDEO_V4L2_SUBDEV_API ifdef-s
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 49c282d5a8c5f4d1d9088622bec792294c716010 ]
VIDEO_V4L2_SUBDEV_API is now automatically selected in Kconfig for all sensor drivers. Remove the ifdef CONFIG_VIDEO_V4L2_SUBDEV_API checks.
This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct.
--- drivers/media/i2c/ov2680.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/media/i2c/ov2680.c +2 -14
@@ -562,7 +562,6 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, {struct ov2680_dev *sensor =to_ov2680_dev (sd);struct v4l2_mbus_framefmt *fmt =NULL ; -int ret =0 ;if (format->pad !=0 )return -EINVAL ;
@@ -570,22 +569,17 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,mutex_lock (&sensor->lock);if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API fmt =v4l2_subdev_get_try_format (&sensor->sd, sd_state, format->pad); -#else - ret = -EINVAL ; -#endif }else { fmt = &sensor->fmt; } -if (fmt) - format->format = *fmt; + format->format = *fmt;mutex_unlock (&sensor->lock); -return ret; +return 0 ; } static int ov2680_set_fmt(struct v4l2_subdev *sd,
@@ -594,9 +588,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, {struct ov2680_dev *sensor =to_ov2680_dev (sd);struct v4l2_mbus_framefmt *fmt = &format->format; -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API struct v4l2_mbus_framefmt *try_fmt; -#endif const struct ov2680_mode_info *mode;int ret =0 ;
@@ -619,10 +611,8 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, }if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); format->format = *try_fmt; -#endif goto unlock; }
@@ -780,9 +770,7 @@ static int ov2680_v4l2_register(struct ov2680_dev *sensor)v4l2_i2c_subdev_init (&sensor->sd, sensor->i2c_client, &ov2680_subdev_ops); -#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API sensor->sd.flags =V4L2_SUBDEV_FL_HAS_DEVNODE ; -#endif sensor->pad.flags =MEDIA_PAD_FL_SOURCE ; sensor->sd.entity.function =MEDIA_ENT_F_CAM_SENSOR ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 469/600 media: ov2680: Dont take the lock for try_fmt calls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit e521b9cc1a49de677f4fc65909ce4877fbf7b113 ]
On ov2680_set_fmt() calls with format->which == V4L2_SUBDEV_FORMAT_TRY, ov2680_set_fmt() does not talk to the sensor.
So in this case there is no need to lock the sensor->lock mutex or to check that the sensor is streaming.
--- drivers/media/i2c/ov2680.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/media/i2c/ov2680.c +9 -11
@@ -595,24 +595,22 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,if (format->pad !=0 )return -EINVAL ; -mutex_lock (&sensor->lock); - -if (sensor->is_streaming) { - ret = -EBUSY ; - goto unlock; - } - mode =v4l2_find_nearest_size (ov2680_mode_data,ARRAY_SIZE (ov2680_mode_data), width, height, fmt->width, fmt->height); -if (!mode) { - ret = -EINVAL ; - goto unlock; - } +if (!mode) +return -EINVAL ;if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); format->format = *try_fmt; +return 0 ; + } + +mutex_lock (&sensor->lock); + +if (sensor->is_streaming) { + ret = -EBUSY ; goto unlock; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 470/600 media: ov2680: Add ov2680_fill_format() helper function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 6d6849b2203f3244b575ba01d3e41ee19aa2cadf ]
Add a ov2680_fill_format() helper function and use this everywhere were a v4l2_mbus_framefmt struct needs to be filled in so that the driver always fills it consistently.
This is a preparation patch for fixing ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY calls not properly filling in the passed in v4l2_mbus_framefmt struct.
Note that for ov2680_init_cfg() this now simply always fills the try_fmt struct of the passed in sd_state. This is correct because ov2680_init_cfg() is never called with a NULL sd_state so the old sd_state check is not necessary.
--- drivers/media/i2c/ov2680.c | 49 +++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 22 deletions(-)
drivers/media/i2c/ov2680.c +27 -22
@@ -54,6 +54,9 @@#define OV2680_WIDTH_MAX 1600#define OV2680_HEIGHT_MAX 1200 +#define OV2680_DEFAULT_WIDTH 800 +#define OV2680_DEFAULT_HEIGHT 600 +enum ov2680_mode_id {OV2680_MODE_QUXGA_800_600 ,OV2680_MODE_720P_1280_720 ,
@@ -315,7 +318,8 @@ static void ov2680_power_down(struct ov2680_dev *sensor)usleep_range (5000 ,10000 ); } -static void ov2680_set_bayer_order (struct ov2680_dev *sensor) +static void ov2680_set_bayer_order (struct ov2680_dev *sensor, +struct v4l2_mbus_framefmt *fmt) {int hv_flip =0 ;
@@ -325,7 +329,19 @@ static void ov2680_set_bayer_order(struct ov2680_dev *sensor)if (sensor->ctrls.hflip && sensor->ctrls.hflip->val) hv_flip +=2 ; - sensor->fmt.code = ov2680_hv_flip_bayer_order[hv_flip]; + fmt->code = ov2680_hv_flip_bayer_order[hv_flip]; +} + +static void ov2680_fill_format (struct ov2680_dev *sensor, +struct v4l2_mbus_framefmt *fmt, +unsigned int width,unsigned int height) +{ +memset (fmt,0 ,sizeof (*fmt)); + fmt->width = width; + fmt->height = height; + fmt->field =V4L2_FIELD_NONE ; + fmt->colorspace =V4L2_COLORSPACE_SRGB ; +ov2680_set_bayer_order (sensor, fmt); }static int ov2680_set_vflip (struct ov2680_dev *sensor,s32 val)
@@ -340,7 +356,7 @@ static int ov2680_set_vflip(struct ov2680_dev *sensor, s32 val)if (ret <0 )return ret; -ov2680_set_bayer_order (sensor); +ov2680_set_bayer_order (sensor, &sensor->fmt);return 0 ; }
@@ -356,7 +372,7 @@ static int ov2680_set_hflip(struct ov2680_dev *sensor, s32 val)if (ret <0 )return ret; -ov2680_set_bayer_order (sensor); +ov2680_set_bayer_order (sensor, &sensor->fmt);return 0 ; }
@@ -614,10 +630,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } - fmt->width = mode->width; - fmt->height = mode->height; - fmt->code = sensor->fmt.code; - fmt->colorspace = sensor->fmt.colorspace; +ov2680_fill_format (sensor, fmt, mode->width, mode->height); sensor->current_mode = mode; sensor->fmt = format->format;
@@ -632,16 +645,11 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,static int ov2680_init_cfg (struct v4l2_subdev *sd,struct v4l2_subdev_state *sd_state) { -struct v4l2_subdev_format fmt = { - .which = sd_state ?V4L2_SUBDEV_FORMAT_TRY - :V4L2_SUBDEV_FORMAT_ACTIVE , - .format = { - .width =800 , - .height =600 , - } - }; +struct ov2680_dev *sensor =to_ov2680_dev (sd); -return ov2680_set_fmt (sd, sd_state, &fmt); +ov2680_fill_format (sensor, &sd_state->pads[0 ].try_fmt, +OV2680_DEFAULT_WIDTH ,OV2680_DEFAULT_HEIGHT ); +return 0 ; } static int ov2680_enum_frame_size(struct v4l2_subdev *sd,
@@ -740,11 +748,8 @@ static int ov2680_mode_init(struct ov2680_dev *sensor)const struct ov2680_mode_info *init_mode;/* set initial mode */ - sensor->fmt.code =MEDIA_BUS_FMT_SBGGR10_1X10 ; - sensor->fmt.width =800 ; - sensor->fmt.height =600 ; - sensor->fmt.field =V4L2_FIELD_NONE ; - sensor->fmt.colorspace =V4L2_COLORSPACE_SRGB ; +ov2680_fill_format (sensor, &sensor->fmt, +OV2680_DEFAULT_WIDTH ,OV2680_DEFAULT_HEIGHT ); sensor->frame_interval.denominator =OV2680_FRAME_RATE ; sensor->frame_interval.numerator =1 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 471/600 media: ov2680: Fix ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY not working
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit c0e97a4b4f20639f74cd5809b42ba6cbf9736a7d ]
ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY was getting the try_fmt v4l2_mbus_framefmt struct from the passed in sd_state and then storing the contents of that into the return by reference format->format struct.
While the right thing to do would be filling format->format based on the just looked up mode and then store the results of that in sd_state->pads[0].try_fmt .
Before the previous change introducing ov2680_fill_format() this resulted in ov2680_set_fmt() which == V4L2_SUBDEV_FORMAT_TRY always returning the zero-ed out sd_state->pads[0].try_fmt in format->format breaking callers using this.
After the introduction of ov2680_fill_format() which at least initializes sd_state->pads[0].try_fmt properly, format->format is now always being filled with the default 800x600 mode set by ov2680_init_cfg() independent of the actual requested mode.
Move the filling of format->format with ov2680_fill_format() to before the if (which == V4L2_SUBDEV_FORMAT_TRY) and then store the filled in format->format in sd_state->pads[0].try_fmt to fix this.
Note this removes the fmt local variable because IMHO having a local variable which points to a sub-struct of one of the function arguments just leads to confusion when reading the code.
--- drivers/media/i2c/ov2680.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/media/i2c/ov2680.c +7 -6
@@ -603,7 +603,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_format *format) {struct ov2680_dev *sensor =to_ov2680_dev (sd); -struct v4l2_mbus_framefmt *fmt = &format->format;struct v4l2_mbus_framefmt *try_fmt;const struct ov2680_mode_info *mode;int ret =0 ;
@@ -612,14 +611,18 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,return -EINVAL ; mode =v4l2_find_nearest_size (ov2680_mode_data, -ARRAY_SIZE (ov2680_mode_data), width, - height, fmt->width, fmt->height); +ARRAY_SIZE (ov2680_mode_data), + width, height, + format->format.width, + format->format.height);if (!mode)return -EINVAL ; +ov2680_fill_format (sensor, &format->format, mode->width, mode->height); +if (format->which ==V4L2_SUBDEV_FORMAT_TRY ) { try_fmt =v4l2_subdev_get_try_format (sd, sd_state,0 ); - format->format = *try_fmt; + *try_fmt = format->format;return 0 ; }
@@ -630,8 +633,6 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd, goto unlock; } -ov2680_fill_format (sensor, fmt, mode->width, mode->height); - sensor->current_mode = mode; sensor->fmt = format->format; sensor->mode_pending_changes = true;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 472/600 media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 84b4bd7e0d98166aa32fd470e672721190492eae ]
When the ov2680_power_on() "sensor soft reset failed" path is hit during probe() the WARN() about putting an enabled regulator at drivers/regulator/core.c:2398 triggers 3 times (once for each regulator), filling dmesg with backtraces.
Fix this by properly disabling the regulators on ov2680_power_on() errors.
--- drivers/media/i2c/ov2680.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/i2c/ov2680.c +6 -2
@@ -475,7 +475,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =ov2680_write_reg (sensor,OV2680_REG_SOFT_RESET ,0x01 );if (ret !=0 ) {dev_err (dev,"sensor soft reset failed\n" ); -return ret; + goto err_disable_regulators; }usleep_range (1000 ,2000 ); }else {
@@ -485,7 +485,7 @@ static int ov2680_power_on(struct ov2680_dev *sensor) ret =clk_prepare_enable (sensor->xvclk);if (ret <0 ) -return ret; + goto err_disable_regulators; sensor->is_enabled = true;
@@ -495,6 +495,10 @@ static int ov2680_power_on(struct ov2680_dev *sensor)ov2680_stream_disable (sensor);return 0 ; + +err_disable_regulators: +regulator_bulk_disable (OV2680_NUM_SUPPLIES , sensor->supplies); +return ret; }static int ov2680_s_power (struct v4l2_subdev *sd,int on)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 473/600 media: i2c: rdacm21: Fix uninitialized value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit 33c7ae8f49e3413c81e879e1fdfcea4c5516e37b ]
Fix the following smatch warning:
drivers/media/i2c/rdacm21.c:373 ov10640_check_id() error: uninitialized symbol 'val'.
Initialize 'val' to 0 in the ov10640_check_id() function.
--- drivers/media/i2c/rdacm21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/rdacm21.c +1 -1
@@ -351,7 +351,7 @@ static void ov10640_power_up(struct rdacm21_device *dev)static int ov10640_check_id (struct rdacm21_device *dev) {unsigned int i; -u8 val; +u8 val =0 ;/* Read OV10640 ID to test communications. */ for (i =0 ; i <OV10640_PID_TIMEOUT ; ++i) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 474/600 f2fs: fix to avoid mmap vs set_compress_option case
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit b5ab3276eb69cacf44ecfb11b2bfab73096ff4e4 ]
Compression option in inode should not be changed after they have been used, however, it may happen in below race case:
Thread A Thread B
- f2fs_ioc_set_compress_option
- check f2fs_is_mmap_file()
- check get_dirty_pages()
- check F2FS_HAS_BLOCKS()
- f2fs_file_mmap
- set_inode_flag(FI_MMAP_FILE)
- fault
- do_page_mkwrite
- f2fs_vm_page_mkwrite
- f2fs_get_block_locked
- fault_dirty_shared_page
- set_page_dirty
- update i_compress_algorithm
- update i_log_cluster_size
- update i_cluster_size
Avoid such race condition by covering f2fs_file_mmap() w/ i_sem lock, meanwhile add mmap file check condition in f2fs_may_compress() as well.
--- fs/f2fs/f2fs.h | 3 ++- fs/f2fs/file.c | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-)
fs/f2fs/f2fs.h +2 -1
@@ -4453,7 +4453,8 @@ static inline bool f2fs_low_mem_mode(struct f2fs_sb_info *sbi)static inline bool f2fs_may_compress (struct inode *inode) {if (IS_SWAPFILE (inode) ||f2fs_is_pinned_file (inode) || -f2fs_is_atomic_file (inode) ||f2fs_has_inline_data (inode)) +f2fs_is_atomic_file (inode) ||f2fs_has_inline_data (inode) || +f2fs_is_mmap_file (inode))return false;return S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode); }
fs/f2fs/file.c +18 -5
@@ -530,7 +530,11 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)file_accessed (file); vma->vm_ops = &f2fs_file_vm_ops; + +f2fs_down_read (&F2FS_I (inode)->i_sem);set_inode_flag (inode,FI_MMAP_FILE ); +f2fs_up_read (&F2FS_I (inode)->i_sem); +return 0 ; }
@@ -1927,12 +1931,19 @@ static int f2fs_setflags_common(struct inode *inode, u32 iflags, u32 mask)int err =f2fs_convert_inline_inode (inode);if (err)return err; -if (!f2fs_may_compress (inode)) -return -EINVAL ; -if (S_ISREG (inode->i_mode) &&F2FS_HAS_BLOCKS (inode)) + +f2fs_down_write (&F2FS_I (inode)->i_sem); +if (!f2fs_may_compress (inode) || + (S_ISREG (inode->i_mode) && +F2FS_HAS_BLOCKS (inode))) { +f2fs_up_write (&F2FS_I (inode)->i_sem);return -EINVAL ; -if (set_compress_context (inode)) -return -EOPNOTSUPP ; + } + err =set_compress_context (inode); +f2fs_up_write (&F2FS_I (inode)->i_sem); + +if (err) +return err; } }
@@ -3958,6 +3969,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)file_start_write (filp);inode_lock (inode); +f2fs_down_write (&F2FS_I (inode)->i_sem);if (f2fs_is_mmap_file (inode) ||get_dirty_pages (inode)) { ret = -EBUSY ; goto out;
@@ -3977,6 +3989,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)f2fs_warn (sbi,"compression algorithm is successfully set, " "but current kernel doesn't support this algorithm." ); out: +f2fs_up_write (&F2FS_I (inode)->i_sem);inode_unlock (inode);file_end_write (filp);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 475/600 f2fs: judge whether discard_unit is section only when have CONFIG_BLK_DEV_ZONED
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yangtao Li <[email protected]>
[ Upstream commit b5a711acab305e04278c136c841ba37c589c16a1 ]
The current logic, regardless of whether CONFIG_BLK_DEV_ZONED is enabled or not, will judge whether discard_unit is SECTION, when f2fs_sb_has_blkzoned.
In fact, when CONFIG_BLK_DEV_ZONED is not enabled, this judgment is a path that will never be accessed. At this time, -EINVAL will be returned in the parse_options function, accompanied by the message "Zoned block device support is not enabled".
Let's wrap this discard_unit judgment with CONFIG_BLK_DEV_ZONED.
Stable-dep-of: 2bd4df8fcbc7 ("f2fs: Only lfs mode is allowed with zoned block device feature")
--- fs/f2fs/super.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/f2fs/super.c +5 -6
@@ -1285,19 +1285,18 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)* zone alignment optimization. This is optional for host-aware * devices, but mandatory for host-managed zoned block devices. */ -#ifndef CONFIG_BLK_DEV_ZONED -if (f2fs_sb_has_blkzoned (sbi)) { -f2fs_err (sbi,"Zoned block device support is not enabled" ); -return -EINVAL ; - } -#endif if (f2fs_sb_has_blkzoned (sbi)) { +#ifdef CONFIG_BLK_DEV_ZONED if (F2FS_OPTION (sbi).discard_unit !=DISCARD_UNIT_SECTION ) {f2fs_info (sbi,"Zoned block device doesn't need small discard, set discard_unit=section by default" );F2FS_OPTION (sbi).discard_unit =DISCARD_UNIT_SECTION ; } +#else +f2fs_err (sbi,"Zoned block device support is not enabled" ); +return -EINVAL ; +#endif }#ifdef CONFIG_F2FS_FS_COMPRESSION
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 476/600 f2fs: Only lfs mode is allowed with zoned block device feature
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunhai Guo <[email protected]>
[ Upstream commit 2bd4df8fcbc72f58ce3c62ed021ab291ca42de0b ]
Now f2fs support four block allocation modes: lfs, adaptive, fragment:segment, fragment:block. Only lfs mode is allowed with zoned block device feature.
--- fs/f2fs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/f2fs/super.c +5 -5
@@ -858,11 +858,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)if (!name)return -ENOMEM ;if (!strcmp (name,"adaptive" )) { -if (f2fs_sb_has_blkzoned (sbi)) { -f2fs_warn (sbi,"adaptive mode is not allowed with zoned block device feature" ); -kfree (name); -return -EINVAL ; - }F2FS_OPTION (sbi).fs_mode =FS_MODE_ADAPTIVE ; }else if (!strcmp (name,"lfs" )) {F2FS_OPTION (sbi).fs_mode =FS_MODE_LFS ;
@@ -1293,6 +1288,11 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)F2FS_OPTION (sbi).discard_unit = DISCARD_UNIT_SECTION; } + +if (F2FS_OPTION (sbi).fs_mode !=FS_MODE_LFS ) { +f2fs_info (sbi,"Only lfs mode is allowed with zoned block device feature" ); +return -EINVAL ; + }#else f2fs_err (sbi,"Zoned block device support is not enabled" );return -EINVAL ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 477/600 Revert "f2fs: fix to do sanity check on extent cache correctly"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 958ccbbf1ce716d77c7cfa79ace50a421c1eed73 ]
syzbot reports a f2fs bug as below:
UBSAN: array-index-out-of-bounds in fs/f2fs/f2fs.h:3275:19 index 1409 is out of range for type '__le32[923]' (aka 'unsigned int[923]') Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0x11c/0x150 lib/ubsan.c:348 inline_data_addr fs/f2fs/f2fs.h:3275 [inline] __recover_inline_status fs/f2fs/inode.c:113 [inline] do_read_inode fs/f2fs/inode.c:480 [inline] f2fs_iget+0x4730/0x48b0 fs/f2fs/inode.c:604 f2fs_fill_super+0x640e/0x80c0 fs/f2fs/super.c:4601 mount_bdev+0x276/0x3b0 fs/super.c:1391 legacy_get_tree+0xef/0x190 fs/fs_context.c:611 vfs_get_tree+0x8c/0x270 fs/super.c:1519 do_new_mount+0x28f/0xae0 fs/namespace.c:3335 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The issue was bisected to:
commit d48a7b3a72f121655d95b5157c32c7d555e44c05
Author: Chao Yu <[email protected]> Date: Mon Jan 9 03:49:20 2023 +0000
f2fs: fix to do sanity check on extent cache correctly
The root cause is we applied both v1 and v2 of the patch, v2 is the right fix, so it needs to revert v1 in order to fix reported issue.
v1:
commit d48a7b3a72f1 ("f2fs: fix to do sanity check on extent cache correctly")
https://lore.kernel.org/lkml/[email protected]/
v2:
commit 269d11948100 ("f2fs: fix to do sanity check on extent cache correctly")
https://lore.kernel.org/lkml/[email protected]/
--- fs/f2fs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/f2fs/inode.c +6 -6
@@ -397,6 +397,12 @@ static int do_read_inode(struct inode *inode) fi->i_inline_xattr_size =0 ; } +if (!sanity_check_inode (inode, node_page)) { +f2fs_put_page (node_page,1 ); +f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE ); +return -EFSCORRUPTED ; + } +/* check data exist */ if (f2fs_has_inline_data (inode) && !f2fs_exist_data (inode))__recover_inline_status (inode, node_page);
@@ -459,12 +465,6 @@ static int do_read_inode(struct inode *inode)/* Need all the flag bits */ f2fs_init_read_extent_tree (inode, node_page); -if (!sanity_check_inode (inode, node_page)) { -f2fs_put_page (node_page,1 ); -f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE ); -return -EFSCORRUPTED ; - } -if (!sanity_check_extent_cache (inode)) {f2fs_put_page (node_page,1 );f2fs_handle_error (sbi,ERROR_CORRUPTED_INODE );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 478/600 cgroup:namespace: Remove unused cgroup_namespaces_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lu Jialin <[email protected]>
[ Upstream commit 82b90b6c5b38e457c7081d50dff11ecbafc1e61a ]
cgroup_namspace_init() just return 0. Therefore, there is no need to call it during start_kernel. Just remove it.
--- kernel/cgroup/namespace.c | 6 ------ 1 file changed, 6 deletions(-)
kernel/cgroup/namespace.c +0 -6
@@ -149,9 +149,3 @@ const struct proc_ns_operations cgroupns_operations = { .install = cgroupns_install, .owner = cgroupns_owner, }; - -static __init int cgroup_namespaces_init (void ) -{ -return 0 ; -} -subsys_initcall (cgroup_namespaces_init);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 479/600 coresight: trbe: Fix TRBE potential sleep in atomic context
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junhao He <[email protected]>
[ Upstream commit c0a232f1e19e378c5c4e5973a996392942c80090 ]
smp_call_function_single() will allocate an IPI interrupt vector to the target processor and send a function call request to the interrupt vector. After the target processor receives the IPI interrupt, it will execute arm_trbe_remove_coresight_cpu() call request in the interrupt handler.
According to the device_unregister() stack information, if other process is useing the device, the down_write() may sleep, and trigger deadlocks or unexpected errors.
arm_trbe_remove_coresight_cpu
coresight_unregister
device_unregister
device_del
kobject_del
__kobject_del
sysfs_remove_dir
kernfs_remove
down_write ---------> it may sleepAdd a helper arm_trbe_disable_cpu() to disable TRBE precpu irq and reset per TRBE.
Simply call arm_trbe_remove_coresight_cpu() directly without useing the smp_call_function_single(), which is the same as registering the TRBE coresight device.
--- drivers/hwtracing/coresight/coresight-trbe.c | 32 +++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/hwtracing/coresight/coresight-trbe.c +17 -15
@@ -1223,6 +1223,16 @@ static void arm_trbe_enable_cpu(void *info)enable_percpu_irq (drvdata->irq,IRQ_TYPE_NONE ); } +static void arm_trbe_disable_cpu (void *info) +{ +struct trbe_drvdata *drvdata = info; +struct trbe_cpudata *cpudata =this_cpu_ptr (drvdata->cpudata); + +disable_percpu_irq (drvdata->irq); +trbe_reset_local (cpudata); +} + +static void arm_trbe_register_coresight_cpu (struct trbe_drvdata *drvdata,int cpu) {struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu);
@@ -1324,18 +1334,12 @@ static void arm_trbe_probe_cpu(void *info)cpumask_clear_cpu (cpu, &drvdata->supported_cpus); } -static void arm_trbe_remove_coresight_cpu (void *info) +static void arm_trbe_remove_coresight_cpu (struct trbe_drvdata *drvdata,int cpu) { -int cpu =smp_processor_id (); -struct trbe_drvdata *drvdata = info; -struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu);struct coresight_device *trbe_csdev =coresight_get_percpu_sink (cpu); -disable_percpu_irq (drvdata->irq); -trbe_reset_local (cpudata);if (trbe_csdev) {coresight_unregister (trbe_csdev); - cpudata->drvdata =NULL ;coresight_set_percpu_sink (cpu,NULL ); } }
@@ -1364,8 +1368,10 @@ static int arm_trbe_remove_coresight(struct trbe_drvdata *drvdata) {int cpu; -for_each_cpu (cpu, &drvdata->supported_cpus) -smp_call_function_single (cpu, arm_trbe_remove_coresight_cpu, drvdata,1 ); +for_each_cpu (cpu, &drvdata->supported_cpus) { +smp_call_function_single (cpu, arm_trbe_disable_cpu, drvdata,1 ); +arm_trbe_remove_coresight_cpu (drvdata, cpu); + }free_percpu (drvdata->cpudata);return 0 ; }
@@ -1404,12 +1410,8 @@ static int arm_trbe_cpu_teardown(unsigned int cpu, struct hlist_node *node) { struct trbe_drvdata *drvdata = hlist_entry_safe(node, struct trbe_drvdata, hotplug_node); -if (cpumask_test_cpu (cpu, &drvdata->supported_cpus)) { -struct trbe_cpudata *cpudata =per_cpu_ptr (drvdata->cpudata, cpu); - -disable_percpu_irq (drvdata->irq); -trbe_reset_local (cpudata); - } +if (cpumask_test_cpu (cpu, &drvdata->supported_cpus)) +arm_trbe_disable_cpu (drvdata);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 480/600 RDMA/irdma: Prevent zero-length STAG registration
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Bednarz <[email protected]>
[ Upstream commit bb6d73d9add68ad270888db327514384dfa44958 ]
Currently irdma allows zero-length STAGs to be programmed in HW during the kernel mode fast register flow. Zero-length MR or STAG registration disable HW memory length checks.
Improve gaps in bounds checking in irdma by preventing zero-length STAG or MR registrations except if the IB_PD_UNSAFE_GLOBAL_RKEY is set.
This addresses the disclosure CVE-2023-25775.
--- drivers/infiniband/hw/irdma/ctrl.c | 6 ++++++ drivers/infiniband/hw/irdma/type.h | 2 ++ drivers/infiniband/hw/irdma/verbs.c | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/ctrl.c +6 -0
@@ -1061,6 +1061,9 @@ static int irdma_sc_alloc_stag(struct irdma_sc_dev *dev,u64 hdr;enum irdma_page_size page_size; +if (!info->total_len && !info->all_memory) +return -EINVAL ; +if (info->page_size ==0x40000000 ) page_size =IRDMA_PAGE_SIZE_1G ;else if (info->page_size ==0x200000 )
@@ -1126,6 +1129,9 @@ static int irdma_sc_mr_reg_non_shared(struct irdma_sc_dev *dev,u8 addr_type;enum irdma_page_size page_size; +if (!info->total_len && !info->all_memory) +return -EINVAL ; +if (info->page_size ==0x40000000 ) page_size =IRDMA_PAGE_SIZE_1G ;else if (info->page_size ==0x200000 )
drivers/infiniband/hw/irdma/type.h +2 -0
@@ -1015,6 +1015,7 @@ struct irdma_allocate_stag_info { bool remote_access:1; bool use_hmc_fcn_index:1; bool use_pf_rid:1; + bool all_memory:1;u8 hmc_fcn_index; };
@@ -1042,6 +1043,7 @@ struct irdma_reg_ns_stag_info { bool use_hmc_fcn_index:1;u8 hmc_fcn_index; bool use_pf_rid:1; + bool all_memory:1; };struct irdma_fast_reg_stag_info {
drivers/infiniband/hw/irdma/verbs.c +8 -2
@@ -2557,7 +2557,8 @@ static int irdma_hw_alloc_stag(struct irdma_device *iwdev, struct irdma_mr *iwmr) {struct irdma_allocate_stag_info *info; -struct irdma_pd *iwpd =to_iwpd (iwmr->ibmr.pd); +struct ib_pd *pd = iwmr->ibmr.pd; +struct irdma_pd *iwpd =to_iwpd (pd);int status;struct irdma_cqp_request *cqp_request;struct cqp_cmds_info *cqp_info;
@@ -2573,6 +2574,7 @@ static int irdma_hw_alloc_stag(struct irdma_device *iwdev, info->stag_idx = iwmr->stag >>IRDMA_CQPSQ_STAG_IDX_S ; info->pd_id = iwpd->sc_pd.pd_id; info->total_len = iwmr->len; + info->all_memory = pd->flags &IB_PD_UNSAFE_GLOBAL_RKEY ; info->remote_access = true; cqp_info->cqp_cmd =IRDMA_OP_ALLOC_STAG ; cqp_info->post_sq =1 ;
@@ -2620,6 +2622,8 @@ static struct ib_mr *irdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, iwmr->type =IRDMA_MEMREG_TYPE_MEM ; palloc = &iwpbl->pble_alloc; iwmr->page_cnt = max_num_sg; +/* Use system PAGE_SIZE as the sg page sizes are unknown at this point */ + iwmr->len = max_num_sg *PAGE_SIZE ; err_code =irdma_get_pble (iwdev->rf->pble_rsrc, palloc, iwmr->page_cnt, false);if (err_code)
@@ -2699,7 +2703,8 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr, {struct irdma_pbl *iwpbl = &iwmr->iwpbl;struct irdma_reg_ns_stag_info *stag_info; -struct irdma_pd *iwpd =to_iwpd (iwmr->ibmr.pd); +struct ib_pd *pd = iwmr->ibmr.pd; +struct irdma_pd *iwpd =to_iwpd (pd);struct irdma_pble_alloc *palloc = &iwpbl->pble_alloc;struct irdma_cqp_request *cqp_request;struct cqp_cmds_info *cqp_info;
@@ -2718,6 +2723,7 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr, stag_info->total_len = iwmr->len; stag_info->access_rights =irdma_get_mr_access (access); stag_info->pd_id = iwpd->sc_pd.pd_id; + stag_info->all_memory = pd->flags &IB_PD_UNSAFE_GLOBAL_RKEY ;if (stag_info->access_rights &IRDMA_ACCESS_FLAGS_ZERO_BASED ) stag_info->addr_type =IRDMA_ADDR_TYPE_ZERO_BASED ;else
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 481/600 scsi: core: Use 32-bit hostnum in scsi_host_lookup()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Battersby <[email protected]>
[ Upstream commit 62ec2092095b678ff89ce4ba51c2938cd1e8e630 ]
Change scsi_host_lookup() hostnum argument type from unsigned short to unsigned int to match the type used everywhere else.
--- drivers/scsi/hosts.c | 4 ++-- include/scsi/scsi_host.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hosts.c +2 -2
@@ -535,7 +535,7 @@ EXPORT_SYMBOL(scsi_host_alloc);static int __scsi_host_match (struct device *dev,const void *data) {struct Scsi_Host *p; -const unsigned short *hostnum = data; +const unsigned int *hostnum = data; p =class_to_shost (dev);return p->host_no == *hostnum;
@@ -552,7 +552,7 @@ static int __scsi_host_match(struct device *dev, const void *data)* that scsi_host_get() took. The put_device() below dropped * the reference from class_find_device(). **/ -struct Scsi_Host *scsi_host_lookup (unsigned short hostnum) +struct Scsi_Host *scsi_host_lookup (unsigned int hostnum) {struct device *cdev;struct Scsi_Host *shost =NULL ;
include/scsi/scsi_host.h +1 -1
@@ -757,7 +757,7 @@ extern void scsi_remove_host(struct Scsi_Host *);extern struct Scsi_Host *scsi_host_get (struct Scsi_Host *);extern int scsi_host_busy (struct Scsi_Host *shost);extern void scsi_host_put (struct Scsi_Host *t); -extern struct Scsi_Host *scsi_host_lookup (unsigned short ); +extern struct Scsi_Host *scsi_host_lookup (unsigned int hostnum);extern const char *scsi_host_state_name (enum scsi_host_state );extern void scsi_host_complete_all_commands (struct Scsi_Host *shost,enum scsi_host_status status);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 482/600 scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 1a1975551943f681772720f639ff42fbaa746212 ]
There is a long call chain that &fip->ctlr_lock is acquired by isr fnic_isr_msix_wq_copy() under hard IRQ context. Thus other process context code acquiring the lock should disable IRQ, otherwise deadlock could happen if the IRQ preempts the execution while the lock is held in process context on the same CPU.
[ISR]fnic_isr_msix_wq_copy()
-> fnic_wq_copy_cmpl_handler()
-> fnic_fcpio_cmpl_handler()
-> fnic_fcpio_flogi_reg_cmpl_handler()
-> fnic_flush_tx()
-> fnic_send_frame()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
[Process Context]
1. fcoe_ctlr_timer_work()
-> fcoe_ctlr_flogi_send()
-> spin_lock_bh(&fip->ctlr_lock)
2. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_announce()
-> spin_lock_bh(&fip->ctlr_lock)
3. fcoe_ctlr_recv_work()
-> fcoe_ctlr_recv_handler()
-> fcoe_ctlr_recv_els()
-> fcoe_ctlr_flogi_retry()
-> spin_lock_bh(&fip->ctlr_lock)
4. -> fcoe_xmit()
-> fcoe_ctlr_els_send()
-> spin_lock_bh(&fip->ctlr_lock)
spin_lock_bh() is not enough since fnic_isr_msix_wq_copy() is a hardirq.
These flaws were found by an experimental static analysis tool I am developing for irq-related deadlock.
The patch fix the potential deadlocks by spin_lock_irqsave() to disable hard irq.
--- drivers/scsi/fcoe/fcoe_ctlr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/scsi/fcoe/fcoe_ctlr.c +12 -8
@@ -319,16 +319,17 @@ static void fcoe_ctlr_announce(struct fcoe_ctlr *fip) {struct fcoe_fcf *sel;struct fcoe_fcf *fcf; +unsigned long flags;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req =NULL ;list_for_each_entry (fcf, &fip->fcfs, list) fcf->flogi_sent =0 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); sel = fip->sel_fcf;if (sel &ðer_addr_equal (sel->fcf_mac, fip->dest_addr))
@@ -699,6 +700,7 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, {struct fc_frame *fp;struct fc_frame_header *fh; +unsigned long flags;u16 old_xid;u8 op;u8 mac[ETH_ALEN ];
@@ -732,11 +734,11 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport, op =FIP_DT_FLOGI ;if (fip->mode ==FIP_MODE_VN2VN )break ; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);kfree_skb (fip->flogi_req); fip->flogi_req = skb; fip->flogi_req_send =1 ; -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);schedule_work (&fip->timer_work);return -EINPROGRESS ;case ELS_FDISC :
@@ -1705,10 +1707,11 @@ static int fcoe_ctlr_flogi_send_locked(struct fcoe_ctlr *fip)static int fcoe_ctlr_flogi_retry (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags;int error;mutex_lock (&fip->ctlr_mutex); -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags);LIBFCOE_FIP_DBG (fip,"re-sending FLOGI - reselect\n" ); fcf =fcoe_ctlr_select (fip);if (!fcf || fcf->flogi_sent) {
@@ -1719,7 +1722,7 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)fcoe_ctlr_solicit (fip,NULL ); error =fcoe_ctlr_flogi_send_locked (fip); } -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags);mutex_unlock (&fip->ctlr_mutex);return error; }
@@ -1736,8 +1739,9 @@ static int fcoe_ctlr_flogi_retry(struct fcoe_ctlr *fip)static void fcoe_ctlr_flogi_send (struct fcoe_ctlr *fip) {struct fcoe_fcf *fcf; +unsigned long flags; -spin_lock_bh (&fip->ctlr_lock); +spin_lock_irqsave (&fip->ctlr_lock, flags); fcf = fip->sel_fcf;if (!fcf || !fip->flogi_req_send) goto unlock;
@@ -1764,7 +1768,7 @@ static void fcoe_ctlr_flogi_send(struct fcoe_ctlr *fip) }else /* XXX */ LIBFCOE_FIP_DBG (fip,"No FCF selected - defer send\n" ); unlock: -spin_unlock_bh (&fip->ctlr_lock); +spin_unlock_irqrestore (&fip->ctlr_lock, flags); }/**
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 483/600 interconnect: qcom: sm8450: Enable sync_state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 16862f1b2110eca6330e5be6d804e1a08e06a202 ]
Enable sync_state on sm8450 so that the interconnect votes actually mean anything and aren't just pinned to INT_MAX.
--- drivers/interconnect/qcom/sm8450.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm8450.c +1 -0
@@ -1886,6 +1886,7 @@ static struct platform_driver qnoc_driver = { .driver = { .name = "qnoc-sm8450", .of_match_table = qnoc_of_match, + .sync_state = icc_sync_state, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 484/600 interconnect: qcom: bcm-voter: Improve enable_mask handling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit a1f4170dec440f023601d57e49227b784074d218 ]
We don't need all the complex arithmetic for BCMs utilizing enable_mask, as all we need to do is to determine whether there's any user (or keepalive) asking for it to be on.
Separate the logic for such BCMs for a small speed boost.
Stable-dep-of: 1a70ca71547b ("interconnect: qcom: bcm-voter: Use enable_maks for keepalive voting")
--- drivers/interconnect/qcom/bcm-voter.c | 43 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-)
drivers/interconnect/qcom/bcm-voter.c +36 -7
@@ -58,6 +58,36 @@ static u64 bcm_div(u64 num, u32 base)return num; } +/* BCMs with enable_mask use one-hot-encoding for on/off signaling */ +static void bcm_aggregate_mask (struct qcom_icc_bcm *bcm) +{ +struct qcom_icc_node *node; +int bucket, i; + +for (bucket =0 ; bucket <QCOM_ICC_NUM_BUCKETS ; bucket++) { + bcm->vote_x[bucket] =0 ; + bcm->vote_y[bucket] =0 ; + +for (i =0 ; i < bcm->num_nodes; i++) { + node = bcm->nodes[i]; + +/* If any vote in this bucket exists, keep the BCM enabled */ +if (node->sum_avg[bucket] || node->max_peak[bucket]) { + bcm->vote_x[bucket] =0 ; + bcm->vote_y[bucket] = bcm->enable_mask; +break ; + } + } + } + +if (bcm->keepalive) { + bcm->vote_x[QCOM_ICC_BUCKET_AMC ] =1 ; + bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] =1 ; + bcm->vote_y[QCOM_ICC_BUCKET_AMC ] =1 ; + bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] =1 ; + } +} +static void bcm_aggregate (struct qcom_icc_bcm *bcm) {struct qcom_icc_node *node;
@@ -83,11 +113,6 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) temp = agg_peak[bucket] * bcm->vote_scale; bcm->vote_y[bucket] =bcm_div (temp, bcm->aux_data.unit); - -if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) { - bcm->vote_x[bucket] =0 ; - bcm->vote_y[bucket] = bcm->enable_mask; - } } if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 &&
@@ -260,8 +285,12 @@ int qcom_icc_bcm_voter_commit(struct bcm_voter *voter)return 0 ;mutex_lock (&voter->lock); -list_for_each_entry (bcm, &voter->commit_list, list) -bcm_aggregate (bcm); +list_for_each_entry (bcm, &voter->commit_list, list) { +if (bcm->enable_mask) +bcm_aggregate_mask (bcm); +else +bcm_aggregate (bcm); + }/* * Pre sort the BCMs based on VCD for ease of generating a command list
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 485/600 interconnect: qcom: bcm-voter: Use enable_maks for keepalive voting
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 1a70ca71547be051769f0628aa09717694f508f0 ]
BCMs with an enable_mask expect to only have that specific value written to them. The current implementation only works by miracle for BCMs with enable mask == BIT(0), as the minimal vote we've been using so far just so happens to be equal to that.
Use the correct value with keepalive voting.
--- drivers/interconnect/qcom/bcm-voter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/interconnect/qcom/bcm-voter.c +4 -4
@@ -81,10 +81,10 @@ static void bcm_aggregate_mask(struct qcom_icc_bcm *bcm) }if (bcm->keepalive) { - bcm->vote_x[QCOM_ICC_BUCKET_AMC ] =1 ; - bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] =1 ; - bcm->vote_y[QCOM_ICC_BUCKET_AMC ] =1 ; - bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] =1 ; + bcm->vote_x[QCOM_ICC_BUCKET_AMC ] = bcm->enable_mask; + bcm->vote_x[QCOM_ICC_BUCKET_WAKE ] = bcm->enable_mask; + bcm->vote_y[QCOM_ICC_BUCKET_AMC ] = bcm->enable_mask; + bcm->vote_y[QCOM_ICC_BUCKET_WAKE ] = bcm->enable_mask; } }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 486/600 serial: tegra: handle clk prepare error in tegra_uart_hw_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit 5abd01145d0cc6cd1b7c2fe6ee0b9ea0fa13671e ]
In tegra_uart_hw_init(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/tty/serial/serial-tegra.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/serial-tegra.c +5 -1
@@ -999,7 +999,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup) tup->ier_shadow =0 ; tup->current_baud =0 ; -clk_prepare_enable (tup->uart_clk); + ret =clk_prepare_enable (tup->uart_clk); +if (ret) { +dev_err (tup->uport.dev,"could not enable clk\n" ); +return ret; + }/* Reset the UART controller to clear all previous status.*/ reset_control_assert (tup->rst);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 487/600 amba: bus: fix refcount leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit e312cbdc11305568554a9e18a2ea5c2492c183f3 ]
commit 5de1540b7bc4 ("drivers/amba: create devices from device tree") increases the refcount of of_node, but not releases it in amba_device_release, so there is refcount leak. By using of_node_put to avoid refcount leak.
--- drivers/amba/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/amba/bus.c +1 -0
@@ -534,6 +534,7 @@ static void amba_device_release(struct device *dev) {struct amba_device *d =to_amba_device (dev); +of_node_put (d->dev.of_node);if (d->res.parent)release_resource (&d->res);mutex_destroy (&d->periphid_lock);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 488/600 Revert "IB/isert: Fix incorrect release of isert connection"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Romanovsky <[email protected]>
[ Upstream commit dfe261107c080709459c32695847eec96238852b ]
Commit: 699826f4e30a ("IB/isert: Fix incorrect release of isert connection") is causing problems on OPA when DEVICE_REMOVAL is happening.
------------[ cut here ]------------ WARNING: CPU: 52 PID: 2117247 at drivers/infiniband/core/cq.c:359 ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Modules linked in: nfsd nfs_acl target_core_user uio tcm_fc libfc
scsi_transport_fc tcm_loop target_core_pscsi target_core_iblock target_core_file rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lockd grace fscache netfs rfkill rpcrdma rdma_ucm ib_srpt sunrpc ib_isert iscsi_target_mod target_core_mod opa_vnic ib_iser libiscsi ib_umad scsi_transport_iscsi rdma_cm ib_ipoib iw_cm ib_cm hfi1(-) rdmavt ib_uverbs intel_rapl_msr intel_rapl_common sb_edac ib_core x86_pkg_temp_thermal intel_powerclamp coretemp i2c_i801 mxm_wmi rapl iTCO_wdt ipmi_si iTCO_vendor_support mei_me ipmi_devintf mei intel_cstate ioatdma intel_uncore i2c_smbus joydev pcspkr lpc_ich ipmi_msghandler acpi_power_meter acpi_pad xfs libcrc32c sr_mod sd_mod cdrom t10_pi sg crct10dif_pclmul crc32_pclmul crc32c_intel drm_kms_helper drm_shmem_helper ahci libahci ghash_clmulni_intel igb drm libata dca i2c_algo_bit wmi fuse
CPU: 52 PID: 2117247 Comm: modprobe Not tainted 6.5.0-rc1+ #1 Hardware name: Intel Corporation S2600CWR/S2600CW, BIOS SE5C610.86B.01.01.0014.121820151719 12/18/2015 RIP: 0010:ib_cq_pool_cleanup+0xac/0xb0 [ib_core] Code: ff 48 8b 43 40 48 8d 7b 40 48 83 e8 40 4c 39 e7 75 b3 49 83
c4 10 4d 39 fc 75 94 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc <0f> 0b eb a1 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f
RSP: 0018:ffffc10bea13fc80 EFLAGS: 00010206
RAX: 000000000000010c RBX: ffff9bf5c7e66c00 RCX: 000000008020001d
RDX: 000000008020001e RSI: fffff175221f9900 RDI: ffff9bf5c7e67640
RBP: ffff9bf5c7e67600 R08: ffff9bf5c7e64400 R09: 000000008020001d
R10: 0000000040000000 R11: 0000000000000000 R12: ffff9bee4b1e8a18
R13: dead000000000122 R14: dead000000000100 R15: ffff9bee4b1e8a38
FS: 00007ff1e6d38740(0000) GS:ffff9bfd9fb00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005652044ecc68 CR3: 0000000889b5c005 CR4: 00000000001706e0
Call Trace: <TASK> ? __warn+0x80/0x130 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] ? report_bug+0x195/0x1a0 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? ib_cq_pool_cleanup+0xac/0xb0 [ib_core] disable_device+0x9d/0x160 [ib_core] __ib_unregister_device+0x42/0xb0 [ib_core] ib_unregister_device+0x22/0x30 [ib_core] rvt_unregister_device+0x20/0x90 [rdmavt] hfi1_unregister_ib_device+0x16/0xf0 [hfi1] remove_one+0x55/0x1a0 [hfi1] pci_device_remove+0x36/0xa0 device_release_driver_internal+0x193/0x200 driver_detach+0x44/0x90 bus_remove_driver+0x69/0xf0 pci_unregister_driver+0x2a/0xb0 hfi1_mod_cleanup+0xc/0x3c [hfi1] __do_sys_delete_module.constprop.0+0x17a/0x2f0 ? exit_to_user_mode_prepare+0xc4/0xd0 ? syscall_trace_enter.constprop.0+0x126/0x1a0 do_syscall_64+0x5c/0x90 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? syscall_exit_work+0x103/0x130 ? syscall_exit_to_user_mode+0x12/0x30 ? do_syscall_64+0x69/0x90 ? exc_page_fault+0x65/0x150 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7ff1e643f5ab Code: 73 01 c3 48 8b 0d 75 a8 1b 00 f7 d8 64 89 01 48 83 c8 ff c3
66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 45 a8 1b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffec9103cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
RAX: ffffffffffffffda RBX: 00005615267fdc50 RCX: 00007ff1e643f5ab
RDX: 0000000000000000 RSI: 0000000000000800 RDI: 00005615267fdcb8
RBP: 00005615267fdc50 R08: 0000000000000000 R09: 0000000000000000
R10: 00007ff1e659eac0 R11: 0000000000000206 R12: 00005615267fdcb8
R13: 0000000000000000 R14: 00005615267fdcb8 R15: 00007ffec9105ff8
</TASK> ---[ end trace 0000000000000000 ]---
And...
restrack: ------------[ cut here ]------------ infiniband hfi1_0: BUG: RESTRACK detected leak of resources
restrack: Kernel PD object allocated by ib_isert is not freed
restrack: Kernel CQ object allocated by ib_core is not freed
restrack: Kernel QP object allocated by rdma_cm is not freed
restrack: ------------[ cut here ]------------
--- drivers/infiniband/ulp/isert/ib_isert.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/ulp/isert/ib_isert.c +2 -0
@@ -2571,6 +2571,8 @@ static void isert_wait_conn(struct iscsit_conn *conn)isert_put_unsol_pending_cmds (conn);isert_wait4cmds (conn);isert_wait4logout (isert_conn); + +queue_work (isert_release_wq, &isert_conn->release_work); }static void isert_free_conn (struct iscsit_conn *conn)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 489/600 RDMA/siw: Balance the reference of cep->kref in the error path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit b056327bee09e6b86683d3f709a438ccd6031d72 ]
The siw_connect can go to err in below after cep is allocated successfully:
1. If siw_cm_alloc_work returns failure. In this case socket is not assoicated with cep so siw_cep_put can't be called by siw_socket_disassoc. We need to call siw_cep_put twice since cep->kref is increased once after it was initialized.
2. If siw_cm_queue_work can't find a work, which means siw_cep_get is not called in siw_cm_queue_work, so cep->kref is increased twice by siw_cep_get and when associate socket with cep after it was initialized. So we need to call siw_cep_put three times (one in siw_socket_disassoc).
3. siw_send_mpareqrep returns error, this scenario is similar as 2.
So we need to remove one siw_cep_put in the error path.
--- drivers/infiniband/sw/siw/siw_cm.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/sw/siw/siw_cm.c +0 -1
@@ -1496,7 +1496,6 @@ int siw_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params) cep->cm_id =NULL ; id->rem_ref (id); -siw_cep_put (cep); qp->cep =NULL ;siw_cep_put (cep);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 490/600 RDMA/siw: Correct wrong debug message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoqing Jiang <[email protected]>
[ Upstream commit bee024d20451e4ce04ea30099cad09f7f75d288b ]
We need to print num_sle first then pbl->max_buf per the condition. Also replace mem->pbl with pbl while at it.
--- drivers/infiniband/sw/siw/siw_verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_verbs.c +1 -1
@@ -1494,7 +1494,7 @@ int siw_map_mr_sg(struct ib_mr *base_mr, struct scatterlist *sl, int num_sle,if (pbl->max_buf < num_sle) {siw_dbg_mem (mem,"too many SGE's: %d > %d\n" , - mem->pbl->max_buf, num_sle); + num_sle, pbl->max_buf);return -ENOMEM ; }for_each_sg (sl, slp, num_sle, i) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 491/600 RDMA/efa: Fix wrong resources deallocation order
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yonatan Nachum <[email protected]>
[ Upstream commit dc202c57e9a1423aed528e4b8dc949509cd32191 ]
When trying to destroy QP or CQ, we first decrease the refcount and potentially free memory regions allocated for the object and then request the device to destroy the object. If the device fails, the object isn't fully destroyed so the user/IB core can try to destroy the object again which will lead to underflow when trying to decrease an already zeroed refcount.
Deallocate resources in reverse order of allocating them to safely free them.
--- drivers/infiniband/hw/efa/efa_verbs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/efa/efa_verbs.c +3 -3
@@ -443,12 +443,12 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)ibdev_dbg (&dev->ibdev,"Destroy qp[%u]\n" , ibqp->qp_num); -efa_qp_user_mmap_entries_remove (qp); - err =efa_destroy_qp_handle (dev, qp->qp_handle);if (err)return err; +efa_qp_user_mmap_entries_remove (qp); +if (qp->rq_cpu_addr) { ibdev_dbg(&dev->ibdev, "qp->cpu_addr[0x%p] freed: size[%lu], dma[%pad]\n",
@@ -1007,8 +1007,8 @@ int efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)"Destroy cq[%d] virt[0x%p] freed: size[%lu], dma[%pad]\n" , cq->cq_idx, cq->cpu_addr, cq->size, &cq->dma_addr); -efa_cq_user_mmap_entries_remove (cq);efa_destroy_cq_idx (dev, cq->cq_idx); +efa_cq_user_mmap_entries_remove (cq);if (cq->eq) {xa_erase (&dev->cqs_xa, cq->cq_idx);synchronize_irq (cq->eq->irq.irqn);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 492/600 HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 6f20d3261265885f6a6be4cda49d7019728760e0 ]
Presently, if a call to logi_dj_recv_send_report() fails, we do not learn about the error until after sending short HID_OUTPUT_REPORT with hid_hw_raw_request().
To handle this somewhat unlikely issue, return on error in logi_dj_recv_send_report() (minding ugly sleep workaround) and take into account the result of hid_hw_raw_request().
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/hid/hid-logitech-dj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-logitech-dj.c +4 -1
@@ -1285,6 +1285,9 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,* 50 msec should gives enough time to the receiver to be ready. */ msleep (50 ); + +if (retval) +return retval; }/*
@@ -1306,7 +1309,7 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, buf[5 ] =0x09 ; buf[6 ] =0x00 ; -hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf, + retval =hid_hw_raw_request (hdev,REPORT_ID_HIDPP_SHORT , buf,HIDPP_REPORT_SHORT_LENGTH ,HID_OUTPUT_REPORT ,HID_REQ_SET_REPORT );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 493/600 HID: uclogic: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit dd613a4e45f8d35f49a63a2064e5308fa5619e29 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-uclogic-core.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-uclogic-core.c +3 -10
@@ -85,10 +85,8 @@ static int uclogic_input_configured(struct hid_device *hdev, {struct uclogic_drvdata *drvdata =hid_get_drvdata (hdev);struct uclogic_params *params = &drvdata->params; -char *name;const char *suffix =NULL ;struct hid_field *field; -size_t len;size_t i;const struct uclogic_params_frame *frame;
@@ -146,14 +144,9 @@ static int uclogic_input_configured(struct hid_device *hdev, } } -if (suffix) { - len =strlen (hdev->name) +2 +strlen (suffix); - name =devm_kzalloc (&hi->input->dev, len,GFP_KERNEL ); -if (name) { -snprintf (name, len,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 494/600 HID: multitouch: Correct devm device reference for hidinput input_dev name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 4794394635293a3e74591351fff469cea7ad15a2 ]
Reference the HID device rather than the input device for the devm allocation of the input_dev name. Referencing the input_dev would lead to a use-after-free when the input_dev was unregistered and subsequently fires a uevent that depends on the name. At the point of firing the uevent, the name would be freed by devres management.
Use devm_kasprintf to simplify the logic for allocating memory and formatting the input_dev name string.
--- drivers/hid/hid-multitouch.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/hid/hid-multitouch.c +3 -10
@@ -1594,7 +1594,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app)static int mt_input_configured (struct hid_device *hdev,struct hid_input *hi) {struct mt_device *td =hid_get_drvdata (hdev); -char *name;const char *suffix =NULL ;struct mt_report_data *rdata;struct mt_application *mt_application =NULL ;
@@ -1645,15 +1644,9 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)break ; } -if (suffix) { - name =devm_kzalloc (&hi->input->dev, -strlen (hdev->name) +strlen (suffix) +2 , -GFP_KERNEL ); -if (name) { -sprintf (name,"%s %s" , hdev->name, suffix); - hi->input->name = name; - } - } +if (suffix) + hi->input->name =devm_kasprintf (&hdev->dev,GFP_KERNEL , +"%s %s" , hdev->name, suffix);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 495/600 platform/x86/amd/pmf: Fix a missing cleanup path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 4dbd6e61adc7e52dd1c9165f0ccaa90806611e40 ]
On systems that support slider notifications but don't otherwise support granular slider the SPS cleanup path doesn't run.
This means that loading/unloading/loading leads to failures because the sysfs files don't get setup properly when reloaded.
Add the missing cleanup path.
--- drivers/platform/x86/amd/pmf/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/amd/pmf/core.c +2 -1
@@ -322,7 +322,8 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)static void amd_pmf_deinit_features (struct amd_pmf_dev *dev) { -if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR )) { +if (is_apmf_func_supported (dev,APMF_FUNC_STATIC_SLIDER_GRANULAR ) || +is_apmf_func_supported (dev,APMF_FUNC_OS_POWER_SLIDER_UPDATE )) {power_supply_unreg_notifier (&dev->pwr_src_notifier);amd_pmf_deinit_sps (dev); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 496/600 tick/rcu: Fix false positive "softirq work is pending" messages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
[ Upstream commit 96c1fa04f089a7e977a44e4e8fdc92e81be20bef ]
In commit 0345691b24c0 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle") the new function report_idle_softirq() was created by breaking code out of the existing can_stop_idle_tick() for kernels v5.18 and newer.
In doing so, the code essentially went from a one conditional:
if (a && b && c) warn();
to a three conditional:
if (!a) return; if (!b) return; if (!c) return; warn();
But that conversion got the condition for the RT specific local_bh_blocked() wrong. The original condition was:
!local_bh_blocked()
but the conversion failed to negate it so it ended up as:
if (!local_bh_blocked()) return false;
This issue lay dormant until another fixup for the same commit was added in commit a7e282c77785 ("tick/rcu: Fix bogus ratelimit condition"). This commit realized the ratelimit was essentially set to zero instead of ten, and hence *no* softirq pending messages would ever be issued.
Once this commit was backported via linux-stable, both the v6.1 and v6.4 preempt-rt kernels started printing out 10 instances of this at boot:
NOHZ tick-stop error: local softirq work is pending, handler #80!!!
Remove the negation and return when local_bh_blocked() evaluates to true to bring the correct behaviour back.
--- kernel/time/tick-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
@@ -1050,7 +1050,7 @@ static bool report_idle_softirq(void)return false;/* On RT, softirqs handling may be waiting on some lock */ -if (!local_bh_blocked ()) +if (local_bh_blocked ())return false; pr_warn("NOHZ tick-stop error: local softirq work is pending, handler #%02x!!!\n",
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 497/600 x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
[ Upstream commit c9f4c45c8ec3f07f4f083f9750032a1ec3eab6b2 ]
The Gather Data Sampling (GDS) vulnerability is common to all Skylake processors. However, the "client" Skylakes* are now in this list:
https://www.intel.com/content/www/us/en/support/articles/000022396/processors.html
which means they are no longer included for new vulnerabilities here:
or in other GDS documentation. Thus, they were not included in the original GDS mitigation patches.
Mark SKYLAKE and SKYLAKE_L as vulnerable to GDS to match all the other Skylake CPUs (which include Kaby Lake). Also group the CPUs so that the ones that share the exact same vulnerabilities are next to each other.
Last, move SRBDS to the end of each line. This makes it clear at a glance that SKYLAKE_X is unique. Of the five Skylakes, it is the only "server" CPU and has a different implementation from the clients of the "special register" hardware, making it immune to SRBDS.
This makes the diff much harder to read, but the resulting table is worth it.
I very much appreciate the report from Michael Zhivich about this issue. Despite what level of support a hardware vendor is providing, the kernel very much needs an accurate and up-to-date list of vulnerable CPUs. More reports like this are very welcome.
* Client Skylakes are CPUID 406E3/506E3 which is family 6, models 0x4E and 0x5E, aka INTEL_FAM6_SKYLAKE and INTEL_FAM6_SKYLAKE_L.
--- arch/x86/kernel/cpu/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/common.c +4 -4
@@ -1259,11 +1259,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = {VULNBL_INTEL_STEPPINGS (BROADWELL_G ,X86_STEPPING_ANY ,SRBDS ),VULNBL_INTEL_STEPPINGS (BROADWELL_X ,X86_STEPPING_ANY ,MMIO ),VULNBL_INTEL_STEPPINGS (BROADWELL ,X86_STEPPING_ANY ,SRBDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ),VULNBL_INTEL_STEPPINGS (SKYLAKE_X ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED ), -VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), -VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,SRBDS |MMIO |RETBLEED |GDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (SKYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE_L ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ), +VULNBL_INTEL_STEPPINGS (KABYLAKE ,X86_STEPPING_ANY ,MMIO |RETBLEED |GDS |SRBDS ),VULNBL_INTEL_STEPPINGS (CANNONLAKE_L ,X86_STEPPING_ANY ,RETBLEED ),VULNBL_INTEL_STEPPINGS (ICELAKE_L ,X86_STEPPING_ANY ,MMIO |MMIO_SBDS |RETBLEED |GDS ), VULNBL_INTEL_STEPPINGS(ICELAKE_D, X86_STEPPING_ANY, MMIO | GDS),
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 498/600 tracing: Remove extra space at the end of hwlat_detector/mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Kobuk <[email protected]>
[ Upstream commit 2cf0dee989a8b2501929eaab29473b6b1fa11057 ]
Space is printed after each mode value including the last one:
$ echo \"$(sudo cat /sys/kernel/tracing/hwlat_detector/mode)\" "none [round-robin] per-cpu "
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- kernel/trace/trace_hwlat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_hwlat.c +1 -1
@@ -635,7 +635,7 @@ static int s_mode_show(struct seq_file *s, void *v)else seq_printf (s,"%s" , thread_mode_str[mode]); -if (mode !=MODE_MAX ) +if (mode <MODE_MAX -1 )/* if mode is any but last */ seq_puts (s," " );return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 499/600 tracing: Fix race issue between cpu buffer write and swap
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yejian <[email protected]>
[ Upstream commit 3163f635b20e9e1fb4659e74f47918c9dddfe64e ]
Warning happened in rb_end_commit() at code:
if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing)))
WARNING: CPU: 0 PID: 139 at kernel/trace/ring_buffer.c:3142 rb_commit+0x402/0x4a0 Call Trace: ring_buffer_unlock_commit+0x42/0x250 trace_buffer_unlock_commit_regs+0x3b/0x250 trace_event_buffer_commit+0xe5/0x440 trace_event_buffer_reserve+0x11c/0x150 trace_event_raw_event_sched_switch+0x23c/0x2c0 __traceiter_sched_switch+0x59/0x80 __schedule+0x72b/0x1580 schedule+0x92/0x120 worker_thread+0xa0/0x6f0
It is because the race between writing event into cpu buffer and swapping cpu buffer through file per_cpu/cpu0/snapshot:
Write on CPU 0 Swap buffer by per_cpu/cpu0/snapshot on CPU 1
-------- --------
tracing_snapshot_write()
[...] ring_buffer_lock_reserve()
cpu_buffer = buffer->buffers[cpu]; // 1. Suppose find 'cpu_buffer_a';
[...]
rb_reserve_next_event()
[...] ring_buffer_swap_cpu()
if (local_read(&cpu_buffer_a->committing))
goto out_dec;
if (local_read(&cpu_buffer_b->committing))
goto out_dec;
buffer_a->buffers[cpu] = cpu_buffer_b;
buffer_b->buffers[cpu] = cpu_buffer_a;
// 2. cpu_buffer has swapped here.
rb_start_commit(cpu_buffer);
if (unlikely(READ_ONCE(cpu_buffer->buffer)
!= buffer)) { // 3. This check passed due to 'cpu_buffer->buffer'
[...] // has not changed here.
return NULL;
}
cpu_buffer_b->buffer = buffer_a;
cpu_buffer_a->buffer = buffer_b;
[...]
// 4. Reserve event from 'cpu_buffer_a'. ring_buffer_unlock_commit()
[...]
cpu_buffer = buffer->buffers[cpu]; // 5. Now find 'cpu_buffer_b' !!!
rb_commit(cpu_buffer)
rb_end_commit() // 6. WARN for the wrong 'committing' state !!!Based on above analysis, we can easily reproduce by following testcase:
``` bash
#!/bin/bash
dmesg -n 7
sysctl -w kernel.panic_on_warn=1
TR=/sys/kernel/tracing
echo 7 > ${TR}/buffer_size_kb
echo "sched:sched_switch" > ${TR}/set_event
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
while [ true ]; do
echo 1 > ${TR}/per_cpu/cpu0/snapshot
done &
```To fix it, IIUC, we can use smp_call_function_single() to do the swap on the target cpu where the buffer is located, so that above race would be avoided.
--- kernel/trace/trace.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/trace/trace.c +12 -5
@@ -7516,6 +7516,11 @@ static int tracing_snapshot_open(struct inode *inode, struct file *file)return ret; } +static void tracing_swap_cpu_buffer (void *tr) +{ +update_max_tr_single ((struct trace_array *)tr, current,smp_processor_id ()); +} +static ssize_t tracing_snapshot_write (struct file *filp,const char __user *ubuf,size_t cnt,loff_t *ppos)
@@ -7574,13 +7579,15 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt, ret =tracing_alloc_snapshot_instance (tr);if (ret <0 )break ; -local_irq_disable ();/* Now, we're going to swap */ -if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) +if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) { +local_irq_disable ();update_max_tr (tr, current,smp_processor_id (),NULL ); -else -update_max_tr_single (tr, current, iter->cpu_file); -local_irq_enable (); +local_irq_enable (); + }else { +smp_call_function_single (iter->cpu_file, tracing_swap_cpu_buffer, + (void *)tr,1 ); + }break ;default :if (tr->allocated_snapshot) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 500/600 mtd: rawnand: brcmnand: Fix mtd oobsize
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Zhang <[email protected]>
[ Upstream commit 60177390fa061c62d156f4a546e3efd90df3c183 ]
brcmnand controller can only access the flash spare area up to certain bytes based on the ECC level. It can be less than the actual flash spare area size. For example, for many NAND chip supporting ECC BCH-8, it has 226 bytes spare area. But controller can only uses 218 bytes. So brcmand driver overrides the mtd oobsize with the controller's accessible spare area size. When the nand base driver utilizes the nand_device object, it resets the oobsize back to the actual flash spare aprea size from nand_memory_organization structure and controller may not able to access all the oob area as mtd advises.
This change fixes the issue by overriding the oobsize in the nand_memory_organization structure to the controller's accessible spare area size.
--- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/brcmnand/brcmnand.c +5 -2
@@ -2612,6 +2612,8 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)struct nand_chip *chip = &host->chip;const struct nand_ecc_props *requirements =nanddev_get_ecc_requirements (&chip->base); +struct nand_memory_organization *memorg = +nanddev_get_memorg (&chip->base);struct brcmnand_controller *ctrl = host->ctrl;struct brcmnand_cfg *cfg = &host->hwcfg;char msg[128 ];
@@ -2633,10 +2635,11 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)if (cfg->spare_area_size > ctrl->max_oob) cfg->spare_area_size = ctrl->max_oob;/* -* Set oobsize to be consistent with controller's spare_area_size, as -* the rest is inaccessible. +* Set mtd and memorg oobsize to be consistent with controller's +* spare_area_size, as the rest is inaccessible. */ mtd->oobsize = cfg->spare_area_size * (mtd->writesize >>FC_SHIFT ); + memorg->oobsize = mtd->oobsize; cfg->device_size = mtd->size; cfg->block_size = mtd->erasesize;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 501/600 dmaengine: idxd: Modify the dependence of attribute pasid_enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rex Zhang <[email protected]>
[ Upstream commit 50c5e6f41d5ad7c731c31135a30d0e4f0e4fea26 ]
Kernel PASID and user PASID are separately enabled. User needs to know the user PASID enabling status to decide how to use IDXD device in user space. This is done via the attribute /sys/bus/dsa/devices/dsa0/pasid_enabled. It's unnecessary for user to know the kernel PASID enabling status because user won't use the kernel PASID. But instead of showing the user PASID enabling status, the attribute shows the kernel PASID enabling status. Fix the issue by showing the user PASID enabling status in the attribute.
--- drivers/dma/idxd/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/idxd/sysfs.c +1 -1
@@ -1426,7 +1426,7 @@ static ssize_t pasid_enabled_show(struct device *dev, {struct idxd_device *idxd =confdev_to_idxd (dev); -return sysfs_emit (buf,"%u\n" ,device_pasid_enabled (idxd)); +return sysfs_emit (buf,"%u\n" ,device_user_pasid_enabled (idxd)); }static DEVICE_ATTR_RO (pasid_enabled);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 502/600 phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 644c06dfbd0da713f772abf0a8f8581ac78e6264 ]
inno_hdmi_phy_rk3328_clk_set_rate() is using the RK3228 macro when configuring vco_div_5 on RK3328.
Fix this by using correct vco_div_5 macro for RK3328.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +2 -2
@@ -790,8 +790,8 @@ static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw, RK3328_PRE_PLL_POWER_DOWN);/* Configure pre-pll */ -inno_update_bits (inno,0xa0 ,RK3228_PCLK_VCO_DIV_5_MASK , -RK3228_PCLK_VCO_DIV_5 (cfg->vco_div_5_en)); +inno_update_bits (inno,0xa0 ,RK3328_PCLK_VCO_DIV_5_MASK , +RK3328_PCLK_VCO_DIV_5 (cfg->vco_div_5_en));inno_write (inno,0xa1 ,RK3328_PRE_PLL_PRE_DIV (cfg->prediv)); val =RK3328_SPREAD_SPECTRUM_MOD_DISABLE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 503/600 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Yang <[email protected]>
[ Upstream commit d5ef343c1d62bc4c4c2c393af654a41cb34b449f ]
inno_hdmi_phy_rk3328_clk_recalc_rate() is returning a rate not found in the pre pll config table when the fractal divider is used. This can prevent proper power_on because a tmdsclock for the new rate is not found in the pre pll config table.
Fix this by saving and returning a rounded pixel rate that exist in the pre pll config table.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +5 -3
@@ -745,10 +745,12 @@ unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw,do_div (vco, (nd * (no_a ==1 ? no_b : no_a) * no_d *2 )); } - inno->pixclock = vco; -dev_dbg (inno->dev,"%s rate %lu\n" , __func__, inno->pixclock); + inno->pixclock =DIV_ROUND_CLOSEST ((unsigned long )vco,1000 ) *1000 ; -return vco; +dev_dbg (inno->dev,"%s rate %lu vco %llu\n" , + __func__, inno->pixclock, vco); + +return inno->pixclock; } static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 504/600 phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 19a1d46bd699940a496d3b0d4e142ef99834988c ]
inno_write is used to configure 0xaa reg, that also hold the POST_PLL_POWER_DOWN bit.
When POST_PLL_REFCLK_SEL_TMDS is configured the power down bit is not taken into consideration.
Fix this by keeping the power down bit until configuration is complete. Also reorder the reg write order for consistency.
--- drivers/phy/rockchip/phy-rockchip-inno-hdmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-inno-hdmi.c +4 -2
@@ -1023,9 +1023,10 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xac ,RK3328_POST_PLL_FB_DIV_7_0 (cfg->fbdiv));if (cfg->postdiv ==1 ) { -inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS );inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv)); +inno_write (inno,0xaa ,RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }else { v = (cfg->postdiv /2 ) -1 ; v &=RK3328_POST_PLL_POST_DIV_MASK ;
@@ -1033,7 +1034,8 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,inno_write (inno,0xab ,RK3328_POST_PLL_FB_DIV_8 (cfg->fbdiv) |RK3328_POST_PLL_PRE_DIV (cfg->prediv));inno_write (inno,0xaa ,RK3328_POST_PLL_POST_DIV_ENABLE | -RK3328_POST_PLL_REFCLK_SEL_TMDS ); +RK3328_POST_PLL_REFCLK_SEL_TMDS | +RK3328_POST_PLL_POWER_DOWN ); }for (v =0 ; v <14 ; v++)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 505/600 rpmsg: glink: Add check for kstrdup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit b5c9ee8296a3760760c7b5d2e305f91412adc795 ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/rpmsg/qcom_glink_native.c +4 -0
@@ -224,6 +224,10 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, channel->glink = glink; channel->name =kstrdup (name,GFP_KERNEL ); +if (!channel->name) { +kfree (channel); +return ERR_PTR (-ENOMEM ); + }init_completion (&channel->open_req);init_completion (&channel->open_ack);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 506/600 leds: pwm: Fix error code in led_pwm_create_fwnode()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit cadb2de2a7fd9e955381307de3eddfcc386c208e ]
Negative -EINVAL was intended, not positive EINVAL. Fix it.
--- drivers/leds/leds-pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-pwm.c +1 -1
@@ -146,7 +146,7 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv) led.name =to_of_node (fwnode)->name;if (!led.name) { - ret =EINVAL ; + ret = -EINVAL ; goto err_child_out; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 507/600 leds: multicolor: Use rounded division when calculating color components
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 065d099f1be58187e6629273c50b948a02b7e1bf ]
Given channel intensity, LED brightness and max LED brightness, the multicolor LED framework helper led_mc_calc_color_components() computes the color channel brightness as
chan_brightness = brightness * chan_intensity / max_brightness
Consider the situation when (brightness, intensity, max_brightness) is for example (16, 15, 255), then chan_brightness is computed to 0 although the fractional divison would give 0.94, which should be rounded to 1.
Use DIV_ROUND_CLOSEST here for the division to give more realistic component computation:
chan_brightness = DIV_ROUND_CLOSEST(brightness * chan_intensity,
max_brightness)
--- drivers/leds/led-class-multicolor.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/leds/led-class-multicolor.c +5 -3
@@ -6,6 +6,7 @@#include <linux/device.h> #include <linux/init.h> #include <linux/led-class-multicolor.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h>
@@ -19,9 +20,10 @@ int led_mc_calc_color_components(struct led_classdev_mc *mcled_cdev,int i;for (i =0 ; i < mcled_cdev->num_colors; i++) - mcled_cdev->subled_info[i].brightness = brightness * - mcled_cdev->subled_info[i].intensity / - led_cdev->max_brightness; + mcled_cdev->subled_info[i].brightness = +DIV_ROUND_CLOSEST (brightness * + mcled_cdev->subled_info[i].intensity, + led_cdev->max_brightness);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 508/600 leds: Fix BUG_ON check for LED_COLOR_ID_MULTI that is always false
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit c3f853184bed04105682383c2971798c572226b5 ]
At the time we call
BUG_ON(props.color == LED_COLOR_ID_MULTI);
the props variable is still initialized to zero.
Call the BUG_ON only after we parse fwnode into props.
--- drivers/leds/led-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/leds/led-core.c +4 -4
@@ -419,15 +419,15 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data,struct fwnode_handle *fwnode = init_data->fwnode;const char *devicename = init_data->devicename; -/* We want to label LEDs that can produce full range of colors -* as RGB, not multicolor */ -BUG_ON (props.color ==LED_COLOR_ID_MULTI ); -if (!led_classdev_name)return -EINVAL ;led_parse_fwnode_props (dev, fwnode, &props); +/* We want to label LEDs that can produce full range of colors +* as RGB, not multicolor */ +BUG_ON (props.color ==LED_COLOR_ID_MULTI ); +if (props.label) {/* * If init_data.devicename is NULL, then it indicates that
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 509/600 leds: trigger: tty: Do not use LED_ON/OFF constants, use led_blink_set_oneshot instead
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Behún <[email protected]>
[ Upstream commit 730094577e0c37e1bc40be37cbd41f71b0a8a2a4 ]
The tty LED trigger uses the obsolete LED_ON & LED_OFF constants when setting LED brightness. This is bad because the LED_ON constant is equal to 1, and so when activating the tty LED trigger on a LED class device with max_brightness greater than 1, the LED is dimmer than it can be (when max_brightness is 255, the LED is very dimm indeed; some devices translate 1/255 to 0, so the LED is OFF all the time).
Instead of directly setting brightness to a specific value, use the led_blink_set_oneshot() function from LED core to configure the blink. This function takes the current configured brightness as blink brightness if not zero, and max brightness otherwise.
This also changes the behavior of the TTY LED trigger. Previously if rx/tx stats kept changing, the LED was ON all the time they kept changing. With this patch the LED will blink on TTY activity.
--- drivers/leds/trigger/ledtrig-tty.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/leds/trigger/ledtrig-tty.c +8 -4
@@ -7,6 +7,8 @@#include <linux/tty.h> #include <uapi/linux/serial.h> +#define LEDTRIG_TTY_INTERVAL 50 +struct ledtrig_tty_data {struct led_classdev *led_cdev;struct delayed_work dwork;
@@ -122,17 +124,19 @@ static void ledtrig_tty_work(struct work_struct *work)if (icount.rx != trigger_data->rx || icount.tx != trigger_data->tx) { -led_set_brightness_sync (trigger_data->led_cdev,LED_ON ); +unsigned long interval =LEDTRIG_TTY_INTERVAL ; + +led_blink_set_oneshot (trigger_data->led_cdev, &interval, + &interval,0 ); trigger_data->rx = icount.rx; trigger_data->tx = icount.tx; - }else { -led_set_brightness_sync (trigger_data->led_cdev,LED_OFF ); } out:mutex_unlock (&trigger_data->mutex); -schedule_delayed_work (&trigger_data->dwork,msecs_to_jiffies (100 )); +schedule_delayed_work (&trigger_data->dwork, +msecs_to_jiffies (LEDTRIG_TTY_INTERVAL *2 )); }static struct attribute *ledtrig_tty_attrs[] = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 510/600 mtd: spi-nor: Check bus width while setting QE bit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Yi Wang <[email protected]>
[ Upstream commit f01d8155a92e33cdaa85d20bfbe6c441907b3c1f ]
spi_nor_write_16bit_sr_and_check() should also check if bus width is 4 before setting QE bit.
--- drivers/mtd/spi-nor/core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/mtd/spi-nor/core.c +10 -9
@@ -770,21 +770,22 @@ static int spi_nor_write_16bit_sr_and_check(struct spi_nor *nor, u8 sr1) ret =spi_nor_read_cr (nor, &sr_cr[1 ]);if (ret)return ret; - }else if (nor->params->quad_enable) { + }else if (spi_nor_get_protocol_width (nor->read_proto) ==4 && +spi_nor_get_protocol_width (nor->write_proto) ==4 && + nor->params->quad_enable) {/* * If the Status Register 2 Read command (35h) is not * supported, we should at least be sure we don't * change the value of the SR2 Quad Enable bit. * -* We can safely assume that when the Quad Enable method is -* set, the value of the QE bit is one, as a consequence of the -* nor->params->quad_enable() call. +* When the Quad Enable method is set and the buswidth is 4, we +* can safely assume that the value of the QE bit is one, as a +* consequence of the nor->params->quad_enable() call. * -* We can safely assume that the Quad Enable bit is present in -* the Status Register 2 at BIT(1). According to the JESD216 -* revB standard, BFPT DWORDS[15], bits 22:20, the 16-bit -* Write Status (01h) command is available just for the cases -* in which the QE bit is described in SR2 at BIT(1). +* According to the JESD216 revB standard, BFPT DWORDS[15], +* bits 22:20, the 16-bit Write Status (01h) command is +* available just for the cases in which the QE bit is +* described in SR2 at BIT(1). */ sr_cr[1 ] =SR2_QUAD_EN_BIT1 ; }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 511/600 mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
[ Upstream commit a5a88125d00612586e941ae13e7fcf36ba8f18a7 ]
In fsmc_nand_resume(), the return value of clk_prepare_enable() should be checked since it might fail.
--- drivers/mtd/nand/raw/fsmc_nand.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/fsmc_nand.c +6 -1
@@ -1202,9 +1202,14 @@ static int fsmc_nand_suspend(struct device *dev)static int fsmc_nand_resume (struct device *dev) {struct fsmc_nand_data *host =dev_get_drvdata (dev); +int ret;if (host) { -clk_prepare_enable (host->clk); + ret =clk_prepare_enable (host->clk); +if (ret) { +dev_err (dev,"failed to enable clk\n" ); +return ret; + }if (host->dev_timings)fsmc_nand_setup (host, host->dev_timings);nand_reset (&host->nand,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 512/600 um: Fix hostaudio build errors
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit db4bfcba7bb8d10f00bba2a3da6b9a9c2a1d7b71 ]
Use "select" to ensure that the required kconfig symbols are set as expected.
Drop HOSTAUDIO since it is now equivalent to UML_SOUND.
Set CONFIG_SOUND=m in ARCH=um defconfig files to maintain the status quo of the default configs.
Allow SOUND with UML regardless of HAS_IOMEM. Otherwise there is a kconfig warning for unmet dependencies. (This was not an issue when SOUND was defined in arch/um/drivers/Kconfig. I have done 50 randconfig builds and didn't find any issues.)
This fixes build errors when CONFIG_SOUND is not set:
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_cleanup_module':
hostaudio_kern.c:(.exit.text+0xa): undefined reference to `unregister_sound_mixer'
ld: hostaudio_kern.c:(.exit.text+0x15): undefined reference to `unregister_sound_dsp'
ld: arch/um/drivers/hostaudio_kern.o: in function `hostaudio_init_module':
hostaudio_kern.c:(.init.text+0x19): undefined reference to `register_sound_dsp'
ld: hostaudio_kern.c:(.init.text+0x31): undefined reference to `register_sound_mixer'
ld: hostaudio_kern.c:(.init.text+0x49): undefined reference to `unregister_sound_dsp'
and this kconfig warning:
WARNING: unmet direct dependencies detected for SOUND
--- arch/um/configs/i386_defconfig | 1 + arch/um/configs/x86_64_defconfig | 1 + arch/um/drivers/Kconfig | 16 +++------------- arch/um/drivers/Makefile | 2 +- sound/Kconfig | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-)
arch/um/configs/i386_defconfig +1 -0
@@ -35,6 +35,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/configs/x86_64_defconfig +1 -0
@@ -33,6 +33,7 @@ CONFIG_TTY_CHAN=y CONFIG_XTERM_CHAN=y CONFIG_CON_CHAN="pts" CONFIG_SSL_CHAN="pts" +CONFIG_SOUND=m CONFIG_UML_SOUND=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y
arch/um/drivers/Kconfig +3 -13
@@ -111,24 +111,14 @@ config SSL_CHAN config UML_SOUND tristate "Sound support" + depends on SOUND + select SOUND_OSS_CORE help This option enables UML sound support. If enabled, it will pull in - soundcore and the UML hostaudio relay, which acts as a intermediary + the UML hostaudio relay, which acts as a intermediary between the host's dsp and mixer devices and the UML sound system. It is safe to say 'Y' here. -config SOUND - tristate - default UML_SOUND - -config SOUND_OSS_CORE - bool - default UML_SOUND - -config HOSTAUDIO - tristate - default UML_SOUND - endmenu menu "UML Network Devices"
arch/um/drivers/Makefile +1 -1
@@ -54,7 +54,7 @@ obj-$(CONFIG_UML_NET) += net.o obj-$(CONFIG_MCONSOLE) += mconsole.o obj-$(CONFIG_MMAPPER) += mmapper_kern.o obj-$(CONFIG_BLK_DEV_UBD) += ubd.o -obj-$(CONFIG_HOSTAUDIO) += hostaudio.o +obj-$(CONFIG_UML_SOUND) += hostaudio.o obj-$(CONFIG_NULL_CHAN) += null.o obj-$(CONFIG_PORT_CHAN) += port.o obj-$(CONFIG_PTY_CHAN) += pty.o
sound/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only menuconfig SOUND tristate "Sound card support" - depends on HAS_IOMEM + depends on HAS_IOMEM || UML help If you have a sound card in your computer, i.e. if it can say more than an occasional beep, say Y.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 513/600 dmaengine: ste_dma40: Add missing IRQ check in d40_probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: ruanjinjie <[email protected]>
[ Upstream commit c05ce6907b3d6e148b70f0bb5eafd61dcef1ddc1 ]
Check for the return value of platform_get_irq(): if no interrupt is specified, it wouldn't make sense to call request_irq().
--- drivers/dma/ste_dma40.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma/ste_dma40.c +4 -0
@@ -3597,6 +3597,10 @@ static int __init d40_probe(struct platform_device *pdev)spin_lock_init (&base->lcla_pool.lock); base->irq =platform_get_irq (pdev,0 ); +if (base->irq <0 ) { + ret = base->irq; + goto destroy_cache; + } ret =request_irq (base->irq, d40_handle_interrupt,0 ,D40_NAME , base);if (ret) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 514/600 Drivers: hv: vmbus: Dont dereference ACPI root object handle
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej S. Szmigiero <[email protected]>
[ Upstream commit 78e04bbff849b51b56f5925b1945db2c6e128b61 ]
Since the commit referenced in the Fixes: tag below the VMBus client driver is walking the ACPI namespace up from the VMBus ACPI device to the ACPI namespace root object trying to find Hyper-V MMIO ranges.
However, if it is not able to find them it ends trying to walk resources of the ACPI namespace root object itself.
This object has all-ones handle, which causes a NULL pointer dereference in the ACPI code (from dereferencing this pointer with an offset).
This in turn causes an oops on boot with VMBus host implementations that do not provide Hyper-V MMIO ranges in their VMBus ACPI device or its ancestors.
The QEMU VMBus implementation is an example of such implementation.
I guess providing these ranges is optional, since all tested Windows versions seem to be able to use VMBus devices without them.
Fix this by explicitly terminating the lookup at the ACPI namespace root object.
Note that Linux guests under KVM/QEMU do not use the Hyper-V PV interface by default - they only do so if the KVM PV interface is missing or disabled.
Example stack trace of such oops:
[ 3.710827] ? __die+0x1f/0x60 [ 3.715030] ? page_fault_oops+0x159/0x460 [ 3.716008] ? exc_page_fault+0x73/0x170 [ 3.716959] ? asm_exc_page_fault+0x22/0x30 [ 3.717957] ? acpi_ns_lookup+0x7a/0x4b0 [ 3.718898] ? acpi_ns_internalize_name+0x79/0xc0 [ 3.720018] acpi_ns_get_node_unlocked+0xb5/0xe0 [ 3.721120] ? acpi_ns_check_object_type+0xfe/0x200 [ 3.722285] ? acpi_rs_convert_aml_to_resource+0x37/0x6e0 [ 3.723559] ? down_timeout+0x3a/0x60 [ 3.724455] ? acpi_ns_get_node+0x3a/0x60 [ 3.725412] acpi_ns_get_node+0x3a/0x60 [ 3.726335] acpi_ns_evaluate+0x1c3/0x2c0 [ 3.727295] acpi_ut_evaluate_object+0x64/0x1b0 [ 3.728400] acpi_rs_get_method_data+0x2b/0x70 [ 3.729476] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus] [ 3.730940] ? vmbus_platform_driver_probe+0x1d0/0x1d0 [hv_vmbus] [ 3.732411] acpi_walk_resources+0x78/0xd0 [ 3.733398] vmbus_platform_driver_probe+0x9f/0x1d0 [hv_vmbus] [ 3.734802] platform_probe+0x3d/0x90 [ 3.735684] really_probe+0x19b/0x400 [ 3.736570] ? __device_attach_driver+0x100/0x100 [ 3.737697] __driver_probe_device+0x78/0x160 [ 3.738746] driver_probe_device+0x1f/0x90 [ 3.739743] __driver_attach+0xc2/0x1b0 [ 3.740671] bus_for_each_dev+0x70/0xc0 [ 3.741601] bus_add_driver+0x10e/0x210 [ 3.742527] driver_register+0x55/0xf0 [ 3.744412] ? 0xffffffffc039a000 [ 3.745207] hv_acpi_init+0x3c/0x1000 [hv_vmbus]
--- drivers/hv/vmbus_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hv/vmbus_drv.c +2 -1
@@ -2452,7 +2452,8 @@ static int vmbus_acpi_add(struct acpi_device *device)* Some ancestor of the vmbus acpi device (Gen1 or Gen2 * firmware) is the VMOD that has the mmio ranges. Get that. */ -for (ancestor =acpi_dev_parent (device); ancestor; +for (ancestor =acpi_dev_parent (device); + ancestor && ancestor->handle !=ACPI_ROOT_OBJECT ; ancestor =acpi_dev_parent (ancestor)) { result =acpi_walk_resources (ancestor->handle,METHOD_NAME__CRS , vmbus_walk_resources,NULL );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 515/600 cpufreq: Fix the race condition while updating the transition_task of policy
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Chang <[email protected]>
[ Upstream commit 61bfbf7951ba561dcbdd5357702d3cbc2d447812 ]
The field 'transition_task' of policy structure is used to track the task which is performing the frequency transition. Using this field to print a warning once detect a case where the same task is calling _begin() again before completing the preivous frequency transition via the _end().
However, there is a potential race condition in _end() and _begin() APIs while updating the field 'transition_task' of policy, the scenario is depicted below:
Task A Task B
/* 1st freq transition */
Invoke _begin() {
...
...
}
/* 2nd freq transition */
Invoke _begin() {
... //waiting for A to
... //clear
... //transition_ongoing
... //in _end() for
... //the 1st transition
|
Change the frequency |
|
Invoke _end() { |
... |
... |
transition_ongoing = false; V
transition_ongoing = true;
transition_task = current;
transition_task = NULL;
... //A overwrites the task
... //performing the transition
... //result in error warning.
}To fix this race condition, the transition_lock of policy structure is now acquired before updating policy structure in _end() API. Which ensure that only one task can update the 'transition_task' field at a time.
--- drivers/cpufreq/cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/cpufreq.c +2 -0
@@ -450,8 +450,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy, policy->cur, policy->cpuinfo.max_freq); +spin_lock (&policy->transition_lock); policy->transition_ongoing = false; policy->transition_task =NULL ; +spin_unlock (&policy->transition_lock);wake_up (&policy->transition_wait); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 516/600 virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Yao <[email protected]>
[ Upstream commit 1acfe2c1225899eab5ab724c91b7e1eb2881b9ab ]
In current packed virtqueue implementation, the avail_wrap_counter won't flip, in the case when the driver supplies a descriptor chain with a length equals to the queue size; total_sg == vq->packed.vring.num.
Let’s assume the following situation:
vq->packed.vring.num=4vq->packed.next_avail_idx: 1vq->packed.avail_wrap_counter: 0
Then the driver adds a descriptor chain containing 4 descriptors.
We expect the following result with avail_wrap_counter flipped:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 1
But, the current implementation gives the following result:vq->packed.next_avail_idx: 1 vq->packed.avail_wrap_counter: 0
To reproduce the bug, you can set a packed queue size as small as possible, so that the driver is more likely to provide a descriptor chain with a length equal to the packed queue size. For example, in qemu run following commands:
sudo qemu-system-x86_64 \
-enable-kvm \
-nographic \
-kernel "path/to/kernel_image" \
-m 1G \
-drive file="path/to/rootfs",if=none,id=disk \
-device virtio-blk,drive=disk \
-drive file="path/to/disk_image",if=none,id=rwdisk \
-device virtio-blk,drive=rwdisk,packed=on,queue-size=4,\
indirect_desc=off \
-append "console=ttyS0 root=/dev/vda rw init=/bin/bash"
Inside the VM, create a directory and mount the rwdisk device on it. The rwdisk will hang and mount operation will not complete.
This commit fixes the wrap counter error by flipping the packed.avail_wrap_counter, when start of descriptor chain equals to the end of descriptor chain (head == i).
Message-Id: <[email protected]>
--- drivers/virtio/virtio_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_ring.c +1 -1
@@ -1449,7 +1449,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, } } -if (i < head) +if (i <= head) vq->packed.avail_wrap_counter ^=1 ;/* We're using some buffers from the free list. */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 517/600 igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit c3b704d4a4a265660e665df51b129e8425216ed1 upstream.
This is a follow up of commit 915d975b2ffa ("net: deal with integer overflows in kmalloc_reserve()") based on David Laight feedback.
Back in 2010, I failed to realize malicious users could set dev->mtu to arbitrary values. This mtu has been since limited to 0x7fffffff but regardless of how big dev->mtu is, it makes no sense for igmpv3_newpack() to allocate more than IP_MAX_MTU and risk various skb fields overflows.
--- net/ipv4/igmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/igmp.c +2 -1
@@ -353,8 +353,9 @@ static struct sk_buff *igmpv3_newpack(ststruct flowi4 fl4;int hlen =LL_RESERVED_SPACE (dev);int tlen = dev->needed_tailroom; -unsigned int size = mtu; +unsigned int size; + size =min (mtu,IP_MAX_MTU );while (1 ) { skb =alloc_skb (size + hlen + tlen,GFP_ATOMIC | __GFP_NOWARN);
Greg Kroah-Hartman
maintainerPATCH 518/600 netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kyle Zeng <[email protected]>
commit 050d91c03b28ca479df13dfb02bcd2c60dd6a878 upstream.
The missing IP_SET_HASH_WITH_NET0 macro in ip_set_hash_netportnet can lead to the use of wrong CIDR_POS(c) for calculating array offsets, which can lead to integer underflow. As a result, it leads to slab out-of-bound access.
This patch adds back the IP_SET_HASH_WITH_NET0 macro to ip_set_hash_netportnet to address the issue.
--- net/netfilter/ipset/ip_set_hash_netportnet.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/ipset/ip_set_hash_netportnet.c +1 -0
@@ -36,6 +36,7 @@ MODULE_ALIAS("ip_set_hash:net,port,net")#define IP_SET_HASH_WITH_PROTO #define IP_SET_HASH_WITH_NETS #define IPSET_NET_COUNT 2 +#define IP_SET_HASH_WITH_NET0 /* IPv4 variant */
Greg Kroah-Hartman
maintainerPATCH 519/600 netfilter: nft_exthdr: Fix non-linear header modification
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Liang <[email protected]>
commit 28427f368f0e08d504ed06e74bc7cc79d6d06511 upstream.
Fix skb_ensure_writable() size. Don't use nft_tcp_header_pointer() to make it explicit that pointers point to the packet (not local buffer).
--- net/netfilter/nft_exthdr.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
net/netfilter/nft_exthdr.c +8 -12
@@ -238,7 +238,12 @@ static void nft_exthdr_tcp_set_eval(consif (!tcph) goto err; +if (skb_ensure_writable (pkt->skb,nft_thoff (pkt) + tcphdr_len)) + goto err; + + tcph = (struct tcphdr *)(pkt->skb->data +nft_thoff (pkt)); opt = (u8 *)tcph; +for (i =sizeof (*tcph); i < tcphdr_len -1 ; i += optl) {union {__be16 v16;
@@ -253,15 +258,6 @@ static void nft_exthdr_tcp_set_eval(consif (i + optl > tcphdr_len || priv->len + priv->offset > optl) goto err; -if (skb_ensure_writable (pkt->skb, -nft_thoff (pkt) + i + priv->len)) - goto err; - - tcph =nft_tcp_header_pointer (pkt,sizeof (buff), buff, - &tcphdr_len); -if (!tcph) - goto err; - offset = i + priv->offset;switch (priv->len) {
@@ -325,9 +321,9 @@ static void nft_exthdr_tcp_strip_eval(coif (skb_ensure_writable (pkt->skb,nft_thoff (pkt) + tcphdr_len)) goto drop; - opt = (u8 *)nft_tcp_header_pointer (pkt,sizeof (buff), buff, &tcphdr_len); -if (!opt) - goto err; + tcph = (struct tcphdr *)(pkt->skb->data +nft_thoff (pkt)); + opt = (u8 *)tcph; +for (i =sizeof (*tcph); i < tcphdr_len -1 ; i += optl) {unsigned int j;
Greg Kroah-Hartman
maintainerPATCH 520/600 netfilter: xt_u32: validate user space input
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit 69c5d284f67089b4750d28ff6ac6f52ec224b330 upstream.
The xt_u32 module doesn't validate the fields in the xt_u32 structure. An attacker may take advantage of this to trigger an OOB read by setting the size fields with a value beyond the arrays boundaries.
Add a checkentry function to validate the structure.
This was originally reported by the ZDI project (ZDI-CAN-18408).
--- net/netfilter/xt_u32.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
net/netfilter/xt_u32.c +21 -0
@@ -96,11 +96,32 @@ static bool u32_mt(const struct sk_buffreturn ret ^ data->invert; } +static int u32_mt_checkentry (const struct xt_mtchk_param *par) +{ +const struct xt_u32 *data = par->matchinfo; +const struct xt_u32_test *ct; +unsigned int i; + +if (data->ntests >ARRAY_SIZE (data->tests)) +return -EINVAL ; + +for (i =0 ; i < data->ntests; ++i) { + ct = &data->tests[i]; + +if (ct->nnums >ARRAY_SIZE (ct->location) || + ct->nvalues >ARRAY_SIZE (ct->value)) +return -EINVAL ; + } + +return 0 ; +} +static struct xt_match xt_u32_mt_reg__read_mostly = { .name ="u32" , .revision =0 , .family =NFPROTO_UNSPEC , .match = u32_mt, + .checkentry = u32_mt_checkentry, .matchsize =sizeof (struct xt_u32 ), .me =THIS_MODULE , };
Greg Kroah-Hartman
maintainerPATCH 521/600 netfilter: xt_sctp: validate the flag_info count
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
commit e99476497687ef9e850748fe6d232264f30bc8f9 upstream.
sctp_mt_check doesn't validate the flag_count field. An attacker can take advantage of that to trigger a OOB read and leak memory information.
Add the field validation in the checkentry function.
--- net/netfilter/xt_sctp.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/xt_sctp.c +2 -0
@@ -150,6 +150,8 @@ static int sctp_mt_check(const struct xt {const struct xt_sctp_info *info = par->matchinfo; +if (info->flag_count >ARRAY_SIZE (info->flag_info)) +return -EINVAL ;if (info->flags & ~XT_SCTP_VALID_FLAGS )return -EINVAL ;if (info->invflags & ~XT_SCTP_VALID_FLAGS )
Greg Kroah-Hartman
maintainerPATCH 522/600 skbuff: skb_segment, Call zero copy functions before using skbuff frags
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Khalfella <[email protected]>
commit 2ea35288c83b3d501a88bc17f2df8f176b5cc96f upstream.
Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb") added the call to zero copy functions in skb_segment(). The change introduced a bug in skb_segment() because skb_orphan_frags() may possibly change the number of fragments or allocate new fragments altogether leaving nrfrags and frag to point to the old values. This can cause a panic with stacktrace like the one below.
[ 193.894380] BUG: kernel NULL pointer dereference, address: 00000000000000bc [ 193.895273] CPU: 13 PID: 18164 Comm: vh-net-17428 Kdump: loaded Tainted: G O 5.15.123+ #26 [ 193.903919] RIP: 0010:skb_segment+0xb0e/0x12f0 [ 194.021892] Call Trace: [ 194.027422] <TASK> [ 194.072861] tcp_gso_segment+0x107/0x540 [ 194.082031] inet_gso_segment+0x15c/0x3d0 [ 194.090783] skb_mac_gso_segment+0x9f/0x110 [ 194.095016] __skb_gso_segment+0xc1/0x190 [ 194.103131] netem_enqueue+0x290/0xb10 [sch_netem] [ 194.107071] dev_qdisc_enqueue+0x16/0x70 [ 194.110884] __dev_queue_xmit+0x63b/0xb30 [ 194.121670] bond_start_xmit+0x159/0x380 [bonding] [ 194.128506] dev_hard_start_xmit+0xc3/0x1e0 [ 194.131787] __dev_queue_xmit+0x8a0/0xb30 [ 194.138225] macvlan_start_xmit+0x4f/0x100 [macvlan] [ 194.141477] dev_hard_start_xmit+0xc3/0x1e0 [ 194.144622] sch_direct_xmit+0xe3/0x280 [ 194.147748] __dev_queue_xmit+0x54a/0xb30 [ 194.154131] tap_get_user+0x2a8/0x9c0 [tap] [ 194.157358] tap_sendmsg+0x52/0x8e0 [tap] [ 194.167049] handle_tx_zerocopy+0x14e/0x4c0 [vhost_net] [ 194.173631] handle_tx+0xcd/0xe0 [vhost_net] [ 194.176959] vhost_worker+0x76/0xb0 [vhost] [ 194.183667] kthread+0x118/0x140 [ 194.190358] ret_from_fork+0x1f/0x30 [ 194.193670] </TASK>
In this case calling skb_orphan_frags() updated nr_frags leaving nrfrags local variable in skb_segment() stale. This resulted in the code hitting i >= nrfrags prematurely and trying to move to next frag_skb using list_skb pointer, which was NULL, and caused kernel panic. Move the call to zero copy functions before using frags and nr_frags.
--- net/core/skbuff.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
net/core/skbuff.c +20 -14
@@ -4135,21 +4135,20 @@ struct sk_buff *skb_segment(struct sk_bustruct sk_buff *segs =NULL ;struct sk_buff *tail =NULL ;struct sk_buff *list_skb =skb_shinfo (head_skb)->frag_list; -skb_frag_t *frag =skb_shinfo (head_skb)->frags;unsigned int mss =skb_shinfo (head_skb)->gso_size;unsigned int doffset = head_skb->data -skb_mac_header (head_skb); -struct sk_buff *frag_skb = head_skb;unsigned int offset = doffset;unsigned int tnl_hlen =skb_tnl_header_len (head_skb);unsigned int partial_segs =0 ;unsigned int headroom;unsigned int len = head_skb->len; +struct sk_buff *frag_skb; +skb_frag_t *frag;__be16 proto;bool csum, sg; -int nfrags =skb_shinfo (head_skb)->nr_frags;int err = -ENOMEM ;int i =0 ; -int pos; +int nfrags, pos;if ((skb_shinfo (head_skb)->gso_type &SKB_GSO_DODGY ) && mss !=GSO_BY_FRAGS && mss !=skb_headlen (head_skb)) {
@@ -4226,6 +4225,13 @@ normal: headroom =skb_headroom (head_skb); pos =skb_headlen (head_skb); +if (skb_orphan_frags (head_skb,GFP_ATOMIC )) +return ERR_PTR (-ENOMEM ); + + nfrags =skb_shinfo (head_skb)->nr_frags; + frag =skb_shinfo (head_skb)->frags; + frag_skb = head_skb; + do { struct sk_buff *nskb; skb_frag_t *nskb_frag;
@@ -4246,6 +4252,10 @@ normal: (skb_headlen(list_skb) == len || sg)) {BUG_ON (skb_headlen (list_skb) > len); + nskb =skb_clone (list_skb,GFP_ATOMIC ); +if (unlikely (!nskb)) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4264,12 +4274,8 @@ normal: frag++; } - nskb =skb_clone (list_skb,GFP_ATOMIC ); list_skb = list_skb->next; -if (unlikely (!nskb)) - goto err; -if (unlikely (pskb_trim (nskb, len))) {kfree_skb (nskb); goto err;
@@ -4345,12 +4351,16 @@ normal:skb_shinfo (nskb)->flags |=skb_shinfo (head_skb)->flags &SKBFL_SHARED_FRAG ; -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) +if (skb_zerocopy_clone (nskb, frag_skb,GFP_ATOMIC )) goto err;while (pos < offset + len) {if (i >= nfrags) { +if (skb_orphan_frags (list_skb,GFP_ATOMIC ) || +skb_zerocopy_clone (nskb, list_skb, +GFP_ATOMIC )) + goto err; + i =0 ; nfrags =skb_shinfo (list_skb)->nr_frags; frag =skb_shinfo (list_skb)->frags;
@@ -4364,10 +4374,6 @@ normal: i--; frag--; } -if (skb_orphan_frags (frag_skb,GFP_ATOMIC ) || -skb_zerocopy_clone (nskb, frag_skb, -GFP_ATOMIC )) - goto err; list_skb = list_skb->next; }
Greg Kroah-Hartman
maintainerPATCH 523/600 igb: set max size RX buffer when store bad packet is enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radoslaw Tyl <[email protected]>
commit bb5ed01cd2428cd25b1c88a3a9cba87055eb289f upstream.
Increase the RX buffer size to 3K when the SBP bit is on. The size of the RX buffer determines the number of pages allocated which may not be sufficient for receive frames larger than the set MTU size.
--- drivers/net/ethernet/intel/igb/igb_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +7 -4
@@ -4758,6 +4758,10 @@ void igb_configure_rx_ring(struct igb_adstatic void igb_set_rx_buffer_len (struct igb_adapter *adapter,struct igb_ring *rx_ring) { +#if (PAGE_SIZE <8192 ) +struct e1000_hw *hw = &adapter->hw; +#endif +/* set build_skb and buffer size flags */ clear_ring_build_skb_enabled (rx_ring);clear_ring_uses_large_buffer (rx_ring);
@@ -4768,10 +4772,9 @@ static void igb_set_rx_buffer_len(structset_ring_build_skb_enabled (rx_ring);#if (PAGE_SIZE <8192 ) -if (adapter->max_frame_size <=IGB_MAX_FRAME_BUILD_SKB ) -return ; - -set_ring_uses_large_buffer (rx_ring); +if (adapter->max_frame_size >IGB_MAX_FRAME_BUILD_SKB || +rd32 (E1000_RCTL ) &E1000_RCTL_SBP ) +set_ring_uses_large_buffer (rx_ring);#endif }
Greg Kroah-Hartman
maintainerPATCH 524/600 PM / devfreq: Fix leak in devfreq_dev_release()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
commit 5693d077595de721f9ddbf9d37f40e5409707dfe upstream.
srcu_init_notifier_head() allocates resources that need to be released with a srcu_cleanup_notifier_head() call.
Reported by kmemleak.
--- drivers/devfreq/devfreq.c | 1 + 1 file changed, 1 insertion(+)
drivers/devfreq/devfreq.c +1 -0
@@ -763,6 +763,7 @@ static void devfreq_dev_release(struct ddev_pm_opp_put_opp_table (devfreq->opp_table);mutex_destroy (&devfreq->lock); +srcu_cleanup_notifier_head (&devfreq->transition_notifier_list);kfree (devfreq); }
Greg Kroah-Hartman
maintainerPATCH 525/600 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 358040e3807754944dbddf948a23c6d914297ed7 upstream.
The update of rate_num/den and msbits were factored out to fixup_unreferenced_params() function to be called explicitly after the hw_refine or hw_params procedure. It's called from snd_pcm_hw_refine_user(), but it's forgotten in the PCM compat ioctl. This ended up with the incomplete rate_num/den and msbits parameters when 32bit compat ioctl is used.
This patch adds the missing call in snd_pcm_ioctl_hw_params_compat().
--- sound/core/pcm_compat.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/core/pcm_compat.c +6 -2
@@ -253,10 +253,14 @@ static int snd_pcm_ioctl_hw_params_compa goto error; } -if (refine) +if (refine) { err =snd_pcm_hw_refine (substream, data); -else +if (err <0 ) + goto error; + err =fixup_unreferenced_params (substream, data); + }else { err =snd_pcm_hw_params (substream, data); + }if (err <0 ) goto error; if (copy_to_user(data32, data, sizeof(*data32)) ||
Greg Kroah-Hartman
maintainerPATCH 526/600 rcu: dump vmalloc memory info safely
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zqiang <[email protected]>
commit c83ad36a18c02c0f51280b50272327807916987f upstream.
Currently, for double invoke call_rcu(), will dump rcu_head objects memory info, if the objects is not allocated from the slab allocator, the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock need to be held, since the call_rcu() can be invoked in interrupt context, therefore, there is a possibility of spinlock deadlock scenarios.
And in Preempt-RT kernel, the rcutorture test also trigger the following lockdep warning:
BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 1, name: swapper/0preempt_count: 1, expected: 0
RCU nest depth: 1, expected: 1
3 locks held by swapper/0/1:
#0: ffffffffb534ee80 (fullstop_mutex){+.+.}-{4:4}, at: torture_init_begin+0x24/0xa0 #1: ffffffffb5307940 (rcu_read_lock){....}-{1:3}, at: rcu_torture_init+0x1ec7/0x2370 #2: ffffffffb536af40 (vmap_area_lock){+.+.}-{3:3}, at: find_vmap_area+0x1f/0x70
irq event stamp: 565512 hardirqs last enabled at (565511): [<ffffffffb379b138>] __call_rcu_common+0x218/0x940 hardirqs last disabled at (565512): [<ffffffffb5804262>] rcu_torture_init+0x20b2/0x2370 softirqs last enabled at (399112): [<ffffffffb36b2586>] __local_bh_enable_ip+0x126/0x170 softirqs last disabled at (399106): [<ffffffffb43fef59>] inet_register_protosw+0x9/0x1d0 Preemption disabled at: [<ffffffffb58040c3>] rcu_torture_init+0x1f13/0x2370 CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 6.5.0-rc4-rt2-yocto-preempt-rt+ #15 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x68/0xb0 dump_stack+0x14/0x20 __might_resched+0x1aa/0x280 ? __pfx_rcu_torture_err_cb+0x10/0x10 rt_spin_lock+0x53/0x130 ? find_vmap_area+0x1f/0x70 find_vmap_area+0x1f/0x70 vmalloc_dump_obj+0x20/0x60 mem_dump_obj+0x22/0x90 __call_rcu_common+0x5bf/0x940 ? debug_smp_processor_id+0x1b/0x30 call_rcu_hurry+0x14/0x20 rcu_torture_init+0x1f82/0x2370 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_leak_cb+0x10/0x10 ? __pfx_rcu_torture_init+0x10/0x10 do_one_initcall+0x6c/0x300 ? debug_smp_processor_id+0x1b/0x30 kernel_init_freeable+0x2b9/0x540 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x1f/0x150 ret_from_fork+0x40/0x50 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK>
The previous patch fixes this by using the deadlock-safe best-effort version of find_vm_area. However, in case of failure print the fact that the pointer was a vmalloc pointer so that we print at least something.
--- mm/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/util.c +3 -1
@@ -1127,7 +1127,9 @@ void mem_dump_obj(void *object)if (vmalloc_dump_obj (object))return ; -if (virt_addr_valid (object)) +if (is_vmalloc_addr (object)) + type ="vmalloc memory" ; +else if (virt_addr_valid (object)) type ="non-slab/vmalloc memory" ;else if (object ==NULL ) type ="NULL pointer" ;
Greg Kroah-Hartman
maintainerPATCH 527/600 printk: ringbuffer: Fix truncating buffer size min_t cast
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit 53e9e33ede37a247d926db5e4a9e56b55204e66c upstream.
If an output buffer size exceeded U16_MAX, the min_t(u16, ...) cast in copy_data() was causing writes to truncate. This manifested as output bytes being skipped, seen as %NUL bytes in pstore dumps when the available record size was larger than 65536. Fix the cast to no longer truncate the calculation.
--- kernel/printk/printk_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk_ringbuffer.c +1 -1
@@ -1735,7 +1735,7 @@ static bool copy_data(struct prb_data_riif (!buf || !buf_size)return true; - data_size =min_t (u16, buf_size, len); + data_size = min_t(unsigned int, buf_size, len);memcpy (&buf[0 ], data, data_size);/* LMM(copy_data:A) */ return true;
Greg Kroah-Hartman
maintainerPATCH 528/600 scsi: core: Fix the scsi_set_resid() documentation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit f669b8a683e4ee26fa5cafe19d71cec1786b556a upstream.
Because scsi_finish_command() subtracts the residual from the buffer length, residual overflows must not be reported. Reflect this in the SCSI documentation. See also commit 9237f04e12cc ("scsi: core: Fix scsi_get/set_resid() interface")
--- Documentation/scsi/scsi_mid_low_api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/scsi/scsi_mid_low_api.rst +2 -2
@@ -1190,11 +1190,11 @@ Members of interest: - pointer to scsi_device object that this command is associated with. resid - - an LLD should set this signed integer to the requested + - an LLD should set this unsigned integer to the requested transfer length (i.e. 'request_bufflen') less the number of bytes that are actually transferred. 'resid' is preset to 0 so an LLD can ignore it if it cannot detect - underruns (overruns should be rare). If possible an LLD + underruns (overruns should not be reported). An LLD should set 'resid' prior to invoking 'done'. The most interesting case is data transfers from a SCSI target device (e.g. READs) that underrun.
Greg Kroah-Hartman
maintainerPATCH 529/600 mm/vmalloc: add a safer version of find_vm_area() for debug
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Fernandes (Google) <[email protected]>
commit 0818e739b5c061b0251c30152380600fb9b84c0c upstream.
It is unsafe to dump vmalloc area information when trying to do so from some contexts. Add a safer trylock version of the same function to do a best-effort VMA finding and use it from vmalloc_dump_obj().
--- mm/vmalloc.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
mm/vmalloc.c +22 -4
@@ -4041,14 +4041,32 @@ void pcpu_free_vm_areas(struct vm_struct#ifdef CONFIG_PRINTK bool vmalloc_dump_obj (void *object) { -struct vm_struct *vm;void *objp = (void *)PAGE_ALIGN ((unsigned long )object); +const void *caller; +struct vm_struct *vm; +struct vmap_area *va; +unsigned long addr; +unsigned int nr_pages; + +if (!spin_trylock (&vmap_area_lock)) +return false; + va =__find_vmap_area ((unsigned long )objp, &vmap_area_root); +if (!va) { +spin_unlock (&vmap_area_lock); +return false; + } - vm =find_vm_area (objp); -if (!vm) + vm = va->vm; +if (!vm) { +spin_unlock (&vmap_area_lock);return false; + } + addr = (unsigned long )vm->addr; + caller = vm->caller; + nr_pages = vm->nr_pages; +spin_unlock (&vmap_area_lock);pr_cont (" %u-page vmalloc region starting at %#lx allocated at %pS\n" , - vm->nr_pages, (unsigned long )vm->addr, vm->caller); + nr_pages, addr, caller);return true; }#endif
Greg Kroah-Hartman
maintainerPATCH 530/600 cpu/hotplug: Prevent self deadlock on CPU hot-unplug
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 2b8272ff4a70b866106ae13c36be7ecbef5d5da2 upstream.
Xiongfeng reported and debugged a self deadlock of the task which initiates and controls a CPU hot-unplug operation vs. the CFS bandwidth timer.
CPU1 CPU2
T1 sets cfs_quota
starts hrtimer cfs_bandwidth 'period_timer'
T1 is migrated to CPU2
T1 initiates offlining of CPU1
Hotplug operation starts
...
'period_timer' expires and is re-enqueued on CPU1
...take_cpu_down()
CPU1 shuts down and does not handle timers
anymore. They have to be migrated in the
post dead hotplug steps by the control task.
T1 runs the post dead offline operation T1 is scheduled out
T1 waits for 'period_timer' to expire
T1 waits there forever if it is scheduled out before it can execute the hrtimer offline callback hrtimers_dead_cpu().
Cure this by delegating the hotplug control operation to a worker thread on an online CPU. This takes the initiating user space task, which might be affected by the bandwidth timer, completely out of the picture.
--- kernel/cpu.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
kernel/cpu.c +23 -1
@@ -1215,8 +1215,22 @@ out:return ret; } +struct cpu_down_work { +unsigned int cpu; +enum cpuhp_state target; +}; + +static long __cpu_down_maps_locked (void *arg) +{ +struct cpu_down_work *work = arg; + +return _cpu_down (work->cpu,0 , work->target); +} +static int cpu_down_maps_locked (unsigned int cpu,enum cpuhp_state target) { +struct cpu_down_work work = { .cpu = cpu, .target = target, }; +/* * If the platform does not support hotplug, report it explicitly to * differentiate it from a transient offlining failure.
@@ -1225,7 +1239,15 @@ static int cpu_down_maps_locked(unsignedreturn -EOPNOTSUPP ;if (cpu_hotplug_disabled)return -EBUSY ; -return _cpu_down (cpu,0 , target); + +/* +* Ensure that the control task does not run on the to be offlined +* CPU to prevent a deadlock against cfs_b->period_timer. +*/ + cpu =cpumask_any_but (cpu_online_mask, cpu); +if (cpu >= nr_cpu_ids) +return -EBUSY ; +return work_on_cpu (cpu, __cpu_down_maps_locked, &work); }static int cpu_down (unsigned int cpu,enum cpuhp_state target)
Greg Kroah-Hartman
maintainerPATCH 531/600 media: i2c: ccs: Check rules is non-NULL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 607bcc4213d998d051541d8f10b5bbb7d546c0be upstream.
Fix the following smatch warning:
drivers/media/i2c/ccs/ccs-data.c:524 ccs_data_parse_rules() warn: address of NULL pointer 'rules'
The CCS static data rule parser does not check an if rule has been obtained before checking for other rule types (which depend on the if rule). In practice this means parsing invalid CCS static data could lead to dereferencing a NULL pointer.
--- drivers/media/i2c/ccs/ccs-data.c | 101 +++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 45 deletions(-)
drivers/media/i2c/ccs/ccs-data.c +56 -45
@@ -464,8 +464,7 @@ static int ccs_data_parse_rules(struct b rule_payload = __rule_type +1 ; rule_plen2 = rule_plen -sizeof (*__rule_type); -switch (*__rule_type) { -case CCS_DATA_BLOCK_RULE_ID_IF : { +if (*__rule_type ==CCS_DATA_BLOCK_RULE_ID_IF ) {const struct __ccs_data_block_rule_if *__if_rules = rule_payload; const size_t __num_if_rules =
@@ -514,49 +513,61 @@ static int ccs_data_parse_rules(struct b rules->if_rules = if_rule; rules->num_if_rules = __num_if_rules; } -break ; - } -case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : - rval =ccs_data_parse_reg_rules (bin, &rules->read_only_regs, - &rules->num_read_only_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_FFD : - rval =ccs_data_parse_ffd (bin, &rules->frame_format, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_MSR : - rval =ccs_data_parse_reg_rules (bin, - &rules->manufacturer_regs, - &rules->num_manufacturer_regs, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : - rval =ccs_data_parse_pdaf_readout (bin, - &rules->pdaf_readout, - rule_payload, - rule_payload + rule_plen2, - dev); -if (rval) -return rval; -break ; -default : -dev_dbg (dev, -"Don't know how to handle rule type %u!\n" , - *__rule_type); -return -EINVAL ; + }else { +/* Check there was an if rule before any other rules */ +if (bin->base && !rules) +return -EINVAL ; + +switch (*__rule_type) { +case CCS_DATA_BLOCK_RULE_ID_READ_ONLY_REGS : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->read_only_regs :NULL , + rules ? + &rules->num_read_only_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_FFD : + rval =ccs_data_parse_ffd (bin, rules ? + &rules->frame_format :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_MSR : + rval =ccs_data_parse_reg_rules (bin, + rules ? + &rules->manufacturer_regs :NULL , + rules ? + &rules->num_manufacturer_regs :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +case CCS_DATA_BLOCK_RULE_ID_PDAF_READOUT : + rval =ccs_data_parse_pdaf_readout (bin, + rules ? + &rules->pdaf_readout :NULL , + rule_payload, + rule_payload + rule_plen2, + dev); +if (rval) +return rval; +break ; +default : +dev_dbg (dev, +"Don't know how to handle rule type %u!\n" , + *__rule_type); +return -EINVAL ; + } } __next_rule = __next_rule + rule_hlen + rule_plen; }
Greg Kroah-Hartman
maintainerPATCH 532/600 media: i2c: Add a camera sensor top level menu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 7d3c7d2a2914e10bec3b9cdacdadb8e1f65f715a upstream.
Select V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API for all sensor drivers. This also adds the options to drivers that don't specifically need them, these are still seldom used drivers using old APIs. The upside is that these should now all compile --- many drivers have had missing dependencies.
The "menu" is replaced by selectable "menuconfig" to select the needed V4L2_FWNODE and VIDEO_V4L2_SUBDEV_API options.
Also select MEDIA_CONTROLLER which VIDEO_V4L2_SUBDEV_API effectively depends on, and add the I2C dependency to the menu.
--- drivers/media/i2c/Kconfig | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/media/i2c/Kconfig +10 -3
@@ -25,8 +25,15 @@ config VIDEO_IR_I2C # V4L2 I2C drivers that are related with Camera support # -menu "Camera sensor devices" - visible if MEDIA_CAMERA_SUPPORT +menuconfig VIDEO_CAMERA_SENSOR + bool "Camera sensor devices" + depends on MEDIA_CAMERA_SUPPORT && I2C + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + default y + +if VIDEO_CAMERA_SENSOR config VIDEO_APTINA_PLL tristate
@@ -783,7 +790,7 @@ source "drivers/media/i2c/ccs/Kconfig" source "drivers/media/i2c/et8ek8/Kconfig" source "drivers/media/i2c/m5mols/Kconfig" -endmenu +endif menu "Lens drivers" visible if MEDIA_CAMERA_SUPPORT
Greg Kroah-Hartman
maintainerPATCH 533/600 PCI: rockchip: Use 64-bit mask on MSI 64-bit PCI address
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rick Wertenbroek <[email protected]>
commit cdb50033dd6dfcf02ae3d4ee56bc1a9555be6d36 upstream.
A 32-bit mask was used on the 64-bit PCI address used for mapping MSIs. This would result in the upper 32 bits being unintentionally zeroed and MSIs getting mapped to incorrect PCI addresses if the address had any of the upper bits set.
Replace 32-bit mask by appropriate 64-bit mask.
--- drivers/pci/controller/pcie-rockchip.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/controller/pcie-rockchip.h +3 -3
@@ -158,7 +158,9 @@#define PCIE_RC_CONFIG_THP_CAP (PCIE_RC_CONFIG_BASE + 0x274)#define PCIE_RC_CONFIG_THP_CAP_NEXT_MASK GENMASK(31, 20) -#define PCIE_ADDR_MASK 0xffffff00 +#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 +#define MIN_AXI_ADDR_BITS_PASSED 8 +#define PCIE_ADDR_MASK GENMASK_ULL(63, MIN_AXI_ADDR_BITS_PASSED)#define PCIE_CORE_AXI_CONF_BASE 0xc00000#define PCIE_CORE_OB_REGION_ADDR0 (PCIE_CORE_AXI_CONF_BASE + 0x0)#define PCIE_CORE_OB_REGION_ADDR0_NUM_BITS 0x3f
@@ -185,8 +187,6 @@#define AXI_WRAPPER_TYPE1_CFG 0xb#define AXI_WRAPPER_NOR_MSG 0xc -#define MAX_AXI_IB_ROOTPORT_REGION_NUM 3 -#define MIN_AXI_ADDR_BITS_PASSED 8#define PCIE_RC_SEND_PME_OFF 0x11960#define ROCKCHIP_VENDOR_ID 0x1d87#define PCIE_LINK_IS_L2 (x) \
Greg Kroah-Hartman
maintainerPATCH 534/600 ipmi_si: fix a memleak in try_smi_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yi Yang <[email protected]>
commit 6cf1a126de2992b4efe1c3c4d398f8de4aed6e3f upstream.
Kmemleak reported the following leak info in try_smi_init():
unreferenced object 0xffff00018ecf9400 (size 1024):
comm "modprobe", pid 2707763, jiffies 4300851415 (age 773.308s) backtrace:
[<000000004ca5b312>] __kmalloc+0x4b8/0x7b0
[<00000000953b1072>] try_smi_init+0x148/0x5dc [ipmi_si]
[<000000006460d325>] 0xffff800081b10148
[<0000000039206ea5>] do_one_initcall+0x64/0x2a4
[<00000000601399ce>] do_init_module+0x50/0x300
[<000000003c12ba3c>] load_module+0x7a8/0x9e0
[<00000000c246fffe>] __se_sys_init_module+0x104/0x180
[<00000000eea99093>] __arm64_sys_init_module+0x24/0x30
[<0000000021b1ef87>] el0_svc_common.constprop.0+0x94/0x250
[<0000000070f4f8b7>] do_el0_svc+0x48/0xe0
[<000000005a05337f>] el0_svc+0x24/0x3c
[<000000005eb248d6>] el0_sync_handler+0x160/0x164
[<0000000030a59039>] el0_sync+0x160/0x180The problem was that when an error occurred before handlers registration and after allocating new_smi->si_sm, the variable wouldn't be freed in the error handling afterwards since shutdown_smi() hadn't been registered yet. Fix it by adding a kfree() in the error handling path in try_smi_init().
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_si_intf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/char/ipmi/ipmi_si_intf.c +5 -0
@@ -2082,6 +2082,11 @@ static int try_smi_init(struct smi_info new_smi->io.io_cleanup =NULL ; } +if (rv && new_smi->si_sm) { +kfree (new_smi->si_sm); + new_smi->si_sm =NULL ; + } +return rv; }
Greg Kroah-Hartman
maintainerPATCH 535/600 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 847fb80cc01a54bc827b02547bb8743bdb59ddab upstream.
If function pwrdm_read_prev_pwrst() returns -EINVAL, we will end up accessing array pwrdm->state_counter through negative index -22. This is wrong and the compiler is legitimately warning us about this potential problem.
Fix this by sanity checking the value stored in variable _prev_ before accessing array pwrdm->state_counter.
Address the following -Warray-bounds warning:arch/arm/mach-omap2/powerdomain.c:178:45: warning: array subscript -22 is below array bounds of 'unsigned int[4]' [-Warray-bounds]
Message-ID: <ZIFVGwImU3kpaGeH@work>
--- arch/arm/mach-omap2/powerdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/powerdomain.c +1 -1
@@ -174,7 +174,7 @@ static int _pwrdm_state_switch(struct pobreak ;case PWRDM_STATE_PREV : prev =pwrdm_read_prev_pwrst (pwrdm); -if (pwrdm->state != prev) +if (prev >=0 && pwrdm->state != prev) pwrdm->state_counter[prev]++;if (prev ==PWRDM_POWER_RET )_update_logic_membank_counters (pwrdm);
Greg Kroah-Hartman
maintainerPATCH 536/600 XArray: Do not return sibling entries from xa_load()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit cbc02854331edc6dc22d8b77b6e22e38ebc7dd51 upstream.
It is possible for xa_load() to observe a sibling entry pointing to another sibling entry. An example:
Thread A: Thread B:
xa_store_range(xa, entry, 188, 191, gfp); xa_load(xa, 191); entry = xa_entry(xa, node, 63); [entry is a sibling of 188] xa_store_range(xa, entry, 184, 191, gfp);
if (xa_is_sibling(entry))
offset = xa_to_sibling(entry);
entry = xa_entry(xas->xa, node, offset);
[entry is now a sibling of 184]
It is sufficient to go around this loop until we hit a non-sibling entry. Sibling entries always point earlier in the node, so we are guaranteed to terminate this search.
--- lib/xarray.c | 2 - tools/testing/radix-tree/multiorder.c | 68 +++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 3 deletions(-)
lib/xarray.c +1 -1
@@ -204,7 +204,7 @@ static void *xas_descend(struct xa_statevoid *entry =xa_entry (xas->xa, node, offset); xas->xa_node = node; -if (xa_is_sibling (entry)) { +while (xa_is_sibling (entry)) { offset =xa_to_sibling (entry); entry =xa_entry (xas->xa, node, offset);if (node->shift &&xa_is_node (entry))
tools/testing/radix-tree/multiorder.c +66 -2
97 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 537/600 io_uring: break iopolling on signal
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit dc314886cb3d0e4ab2858003e8de2917f8a3ccbd upstream.
Don't keep spinning iopoll with a signal set. It'll eventually return back, e.g. by virtue of need_resched(), but it's not a nice user experience.
--- io_uring/io_uring.c | 3 +++ 1 file changed, 3 insertions(+)
io_uring/io_uring.c +3 -0
@@ -1457,6 +1457,9 @@ static int io_iopoll_check(struct io_rinbreak ; nr_events += ret; ret =0 ; + +if (task_sigpending (current)) +return -EINTR ; }while (nr_events < min && !need_resched ());return ret;
Greg Kroah-Hartman
maintainerPATCH 538/600 backlight/gpio_backlight: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 7b91d017f77c1bda56f27c2f4bbb70de7c6eca08 upstream.
Struct gpio_backlight_platform_data refers to a platform device within the Linux device hierarchy. The test in gpio_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/gpio_backlight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/gpio_backlight.c +1 -1
@@ -35,7 +35,7 @@ static int gpio_backlight_check_fb(struc {struct gpio_backlight *gbl =bl_get_data (bl); -return gbl->fbdev ==NULL || gbl->fbdev == info->dev; +return gbl->fbdev ==NULL || gbl->fbdev == info->device; }static const struct backlight_ops gpio_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 539/600 backlight/bd6107: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 992bdddaabfba19bdc77c1c7a4977b2aa41ec891 upstream.
Struct bd6107_platform_data refers to a platform device within the Linux device hierarchy. The test in bd6107_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/bd6107.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/bd6107.c +1 -1
@@ -104,7 +104,7 @@ static int bd6107_backlight_check_fb(str {struct bd6107 *bd =bl_get_data (backlight); -return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->dev; +return bd->pdata->fbdev ==NULL || bd->pdata->fbdev == info->device; }static const struct backlight_ops bd6107_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 540/600 backlight/lv5207lp: Compare against struct fb_info.device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 1ca8819320fd84e7d95b04e7668efc5f9fe9fa5c upstream.
Struct lv5207lp_platform_data refers to a platform device within the Linux device hierarchy. The test in lv5207lp_backlight_check_fb() compares it against the fbdev device in struct fb_info.dev, which is different. Fix the test by comparing to struct fb_info.device.
Fixes a bug in the backlight driver and prepares fbdev for making struct fb_info.dev optional.
v2:
* move renames into separate patch (Javier, Sam, Michael)
--- drivers/video/backlight/lv5207lp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/backlight/lv5207lp.c +1 -1
@@ -67,7 +67,7 @@ static int lv5207lp_backlight_check_fb(s {struct lv5207lp *lv =bl_get_data (backlight); -return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->dev; +return lv->pdata->fbdev ==NULL || lv->pdata->fbdev == info->device; }static const struct backlight_ops lv5207lp_backlight_ops = {
Greg Kroah-Hartman
maintainerPATCH 541/600 drm/amd/display: register edp_backlight_control() for DCN301
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hamza Mahfooz <[email protected]>
commit 1611917f39bee1abfc01501238db8ac19649042d upstream.
As made mention of in commit 099303e9a9bd ("drm/amd/display: eDP intermittent black screen during PnP"), we need to turn off the display's backlight before powering off an eDP display. Not doing so will result in undefined behaviour according to the eDP spec. So, set DCN301's edp_backlight_control() function pointer to dce110_edp_backlight_control().
--- drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c +1 -0
@@ -75,6 +75,7 @@ static const struct hw_sequencer_funcs dcn301_funcs = { .get_hw_state = dcn10_get_hw_state, .clear_status_bits = dcn10_clear_status_bits, .wait_for_mpcc_disconnect = dcn10_wait_for_mpcc_disconnect, + .edp_backlight_control = dce110_edp_backlight_control, .edp_power_control = dce110_edp_power_control, .edp_wait_for_hpd_ready = dce110_edp_wait_for_hpd_ready, .set_cursor_position = dcn10_set_cursor_position,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 542/600 xtensa: PMU: fix base address for the newer hardware
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit 687eb3c42f4ad81e7c947c50e2d865f692064291 upstream.
With introduction of ERI access control in RG.0 base address of the PMU unit registers has changed. Add support for the new PMU configuration.
--- arch/xtensa/include/asm/core.h | 9 +++++++++ arch/xtensa/kernel/perf_event.c | 17 +++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-)
arch/xtensa/include/asm/core.h +9 -0
@@ -44,4 +44,13 @@#define XTENSA_STACK_ALIGNMENT 16#endif +#ifndef XCHAL_HW_MIN_VERSION +#if defined(XCHAL_HW_MIN_VERSION_MAJOR ) && defined(XCHAL_HW_MIN_VERSION_MINOR ) +#define XCHAL_HW_MIN_VERSION (XCHAL_HW_MIN_VERSION_MAJOR * 100 + \ + XCHAL_HW_MIN_VERSION_MINOR) +#else +#define XCHAL_HW_MIN_VERSION 0 +#endif +#endif +#endif
arch/xtensa/kernel/perf_event.c +13 -4
@@ -13,17 +13,26 @@#include <linux/perf_event.h> #include <linux/platform_device.h> +#include <asm/core.h> #include <asm/processor.h> #include <asm/stacktrace.h> +#define XTENSA_HWVERSION_RG_2015_0 260000 + +#if XCHAL_HW_MIN_VERSION >=XTENSA_HWVERSION_RG_2015_0 +#define XTENSA_PMU_ERI_BASE 0x00101000 +#else +#define XTENSA_PMU_ERI_BASE 0x00001000 +#endif +/* Global control/status for all perf counters */ -#define XTENSA_PMU_PMG 0x1000 +#define XTENSA_PMU_PMG XTENSA_PMU_ERI_BASE/* Perf counter values */ -#define XTENSA_PMU_PM (i) (0x1080 + (i) * 4) +#define XTENSA_PMU_PM (i) (XTENSA_PMU_ERI_BASE + 0x80 + (i) * 4)/* Perf counter control registers */ -#define XTENSA_PMU_PMCTRL (i) (0x1100 + (i) * 4) +#define XTENSA_PMU_PMCTRL (i) (XTENSA_PMU_ERI_BASE + 0x100 + (i) * 4)/* Perf counter status registers */ -#define XTENSA_PMU_PMSTAT (i) (0x1180 + (i) * 4) +#define XTENSA_PMU_PMSTAT (i) (XTENSA_PMU_ERI_BASE + 0x180 + (i) * 4)#define XTENSA_PMU_PMG_PMEN 0x1
Greg Kroah-Hartman
maintainerPATCH 543/600 LoongArch: mm: Add p?d_leaf() definitions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hongchen Zhang <[email protected]>
commit 303be4b33562a5b689261ced1616bf16ad49efa7 upstream.
When I do LTP test, LTP test case ksm06 caused panic at
break_ksm_pmd_entry -> pmd_leaf (Huge page table but False) -> pte_present (panic)
The reason is pmd_leaf() is not defined, So like commit 501b81046701 ("mips: mm: add p?d_leaf() definitions") add p?d_leaf() definition for LoongArch.
--- arch/loongarch/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+)
arch/loongarch/include/asm/pgtable.h +3 -0
@@ -560,6 +560,9 @@ static inline long pmd_protnone(pmd_t pm }#endif /* CONFIG_NUMA_BALANCING */ +#define pmd_leaf (pmd) ((pmd_val(pmd) & _PAGE_HUGE) != 0) +#define pud_leaf (pud) ((pud_val(pud) & _PAGE_HUGE) != 0) +/* * We provide our own get_unmapped area to cope with the virtual aliasing * constraints placed on us by the cache architecture.
Greg Kroah-Hartman
maintainerPATCH 544/600 i3c: master: svc: fix probe failure when no i3c device exist
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit 6e13d6528be2f7e801af63c8153b87293f25d736 upstream.
I3C masters are expected to support hot-join. This means at initialization time we might not yet discover any device and this should not be treated as a fatal error.
During the DAA procedure which happens at probe time, if no device has joined, all CCC will be NACKed (from a bus perspective). This leads to an early return with an error code which fails the probe of the master.
Let's avoid this by just telling the core through an I3C_ERROR_M2 return command code that no device was discovered, which is a valid situation. This way the master will no longer bail out and fail to probe for a wrong reason.
--- drivers/i3c/master/svc-i3c-master.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/i3c/master/svc-i3c-master.c +12 -2
@@ -782,6 +782,10 @@ static int svc_i3c_master_do_daa_locked(*/ break ; }else if (SVC_I3C_MSTATUS_NACKED (reg)) { +/* No I3C devices attached */ +if (dev_nb ==0 ) +break ; +/* * A slave device nacked the address, this is * allowed only once, DAA will be stopped and
@@ -1251,11 +1255,17 @@ static int svc_i3c_master_send_ccc_cmd(s {struct svc_i3c_master *master =to_svc_i3c_master (m);bool broadcast = cmd->id <0x80 ; +int ret;if (broadcast) -return svc_i3c_master_send_bdcast_ccc_cmd (master, cmd); + ret =svc_i3c_master_send_bdcast_ccc_cmd (master, cmd);else -return svc_i3c_master_send_direct_ccc_cmd (master, cmd); + ret =svc_i3c_master_send_direct_ccc_cmd (master, cmd); + +if (ret) + cmd->err =I3C_ERROR_M2 ; + +return ret; } static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
Greg Kroah-Hartman
maintainerPATCH 545/600 arm64: csum: Fix OoB access in IP checksum code for negative lengths
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 8bd795fedb8450ecbef18eeadbd23ed8fc7630f5 upstream.
Although commit c2c24edb1d9c ("arm64: csum: Fix pathological zero-length calls") added an early return for zero-length input, syzkaller has popped up with an example of a _negative_ length which causes an undefined shift and an out-of-bounds read:
| BUG: KASAN: slab-out-of-bounds in do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | Read of size 4294966928 at addr ffff0000d7ac0170 by task syz-executor412/5975 | | CPU: 0 PID: 5975 Comm: syz-executor412 Not tainted 6.4.0-rc4-syzkaller-g908f31f2a05b #0 | Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023 | Call trace: | dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:233 | show_stack+0x2c/0x44 arch/arm64/kernel/stacktrace.c:240 | __dump_stack lib/dump_stack.c:88 [inline] | dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 | print_address_description mm/kasan/report.c:351 [inline] | print_report+0x174/0x514 mm/kasan/report.c:462 | kasan_report+0xd4/0x130 mm/kasan/report.c:572 | kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:187 | __kasan_check_read+0x20/0x30 mm/kasan/shadow.c:31 | do_csum+0x44/0x254 arch/arm64/lib/csum.c:39 | csum_partial+0x30/0x58 lib/checksum.c:128 | gso_make_checksum include/linux/skbuff.h:4928 [inline] | __udp_gso_segment+0xaf4/0x1bc4 net/ipv4/udp_offload.c:332 | udp6_ufo_fragment+0x540/0xca0 net/ipv6/udp_offload.c:47 | ipv6_gso_segment+0x5cc/0x1760 net/ipv6/ip6_offload.c:119 | skb_mac_gso_segment+0x2b4/0x5b0 net/core/gro.c:141 | __skb_gso_segment+0x250/0x3d0 net/core/dev.c:3401 | skb_gso_segment include/linux/netdevice.h:4859 [inline] | validate_xmit_skb+0x364/0xdbc net/core/dev.c:3659 | validate_xmit_skb_list+0x94/0x130 net/core/dev.c:3709 | sch_direct_xmit+0xe8/0x548 net/sched/sch_generic.c:327 | __dev_xmit_skb net/core/dev.c:3805 [inline] | __dev_queue_xmit+0x147c/0x3318 net/core/dev.c:4210 | dev_queue_xmit include/linux/netdevice.h:3085 [inline] | packet_xmit+0x6c/0x318 net/packet/af_packet.c:276 | packet_snd net/packet/af_packet.c:3081 [inline] | packet_sendmsg+0x376c/0x4c98 net/packet/af_packet.c:3113 | sock_sendmsg_nosec net/socket.c:724 [inline] | sock_sendmsg net/socket.c:747 [inline] | __sys_sendto+0x3b4/0x538 net/socket.c:2144
Extend the early return to reject negative lengths as well, aligning our implementation with the generic code in lib/checksum.c
--- arch/arm64/lib/csum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/lib/csum.c +1 -1
@@ -24,7 +24,7 @@ unsigned int __no_sanitize_address do_csconst u64 *ptr;u64 data, sum64 =0 ; -if (unlikely (len ==0 )) +if (unlikely (len <=0 ))return 0 ; offset = (unsigned long )buff &7 ;
Greg Kroah-Hartman
maintainerPATCH 546/600 ALSA: hda/cirrus: Fix broken audio on hardware with two CS42L42 codecs.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Rodionov <[email protected]>
commit 99bf5b0baac941176a6a3d5cef7705b29808de34 upstream.
Recently in v6.3-rc1 there was a change affecting behaviour of hrtimers (commit 0c52310f260014d95c1310364379772cb74cf82d) and causing few issues on platforms with two CS42L42 codecs. Canonical/Dell has reported an issue with Vostro-3910.
We need to increase this value by 15ms.
--- sound/pci/hda/patch_cs8409.c | 2 +- sound/pci/hda/patch_cs8409.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
sound/pci/hda/patch_cs8409.c +1 -1
@@ -888,7 +888,7 @@ static void cs42l42_resume(struct sub_co/* Initialize CS42L42 companion codec */ cs8409_i2c_bulk_write (cs42l42, cs42l42->init_seq, cs42l42->init_seq_num); -usleep_range (30000 ,35000 ); +msleep (CS42L42_INIT_TIMEOUT_MS );/* Clear interrupts, by reading interrupt status registers */ cs8409_i2c_bulk_read (cs42l42, irq_regs,ARRAY_SIZE (irq_regs));
sound/pci/hda/patch_cs8409.h +1 -0
@@ -229,6 +229,7 @@ enum cs8409_coefficient_index_registers#define CS42L42_I2C_SLEEP_US (2000)#define CS42L42_PDN_TIMEOUT_US (250000)#define CS42L42_PDN_SLEEP_US (2000) +#define CS42L42_INIT_TIMEOUT_MS (45)#define CS42L42_FULL_SCALE_VOL_MASK (2)#define CS42L42_FULL_SCALE_VOL_0DB (1)#define CS42L42_FULL_SCALE_VOL_MINUS6DB (0)
Greg Kroah-Hartman
maintainerPATCH 547/600 media: dvb: symbol fixup for dvb_attach()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 86495af1171e1feec79faa9b64c05c89f46e41d1 upstream.
In commit 9011e49d54dc ("modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules") the use of symbol_get is properly restricted to GPL-only marked symbols. This interacts oddly with the DVB logic which only uses dvb_attach() to load the dvb driver which then uses symbol_get().
Fix this up by properly marking all of the dvb_attach attach symbols as EXPORT_SYMBOL_GPL().
--- drivers/media/dvb-frontends/ascot2e.c | 2 +- drivers/media/dvb-frontends/atbm8830.c | 2 +- drivers/media/dvb-frontends/au8522_dig.c | 2 +- drivers/media/dvb-frontends/bcm3510.c | 2 +- drivers/media/dvb-frontends/cx22700.c | 2 +- drivers/media/dvb-frontends/cx22702.c | 2 +- drivers/media/dvb-frontends/cx24110.c | 2 +- drivers/media/dvb-frontends/cx24113.c | 2 +- drivers/media/dvb-frontends/cx24116.c | 2 +- drivers/media/dvb-frontends/cx24120.c | 2 +- drivers/media/dvb-frontends/cx24123.c | 2 +- drivers/media/dvb-frontends/cxd2820r_core.c | 2 +- drivers/media/dvb-frontends/cxd2841er.c | 4 ++-- drivers/media/dvb-frontends/cxd2880/cxd2880_top.c | 2 +- drivers/media/dvb-frontends/dib0070.c | 2 +- drivers/media/dvb-frontends/dib0090.c | 4 ++-- drivers/media/dvb-frontends/dib3000mb.c | 2 +- drivers/media/dvb-frontends/dib3000mc.c | 2 +- drivers/media/dvb-frontends/dib7000m.c | 2 +- drivers/media/dvb-frontends/dib7000p.c | 2 +- drivers/media/dvb-frontends/dib8000.c | 2 +- drivers/media/dvb-frontends/dib9000.c | 2 +- drivers/media/dvb-frontends/drx39xyj/drxj.c | 2 +- drivers/media/dvb-frontends/drxd_hard.c | 2 +- drivers/media/dvb-frontends/drxk_hard.c | 2 +- drivers/media/dvb-frontends/ds3000.c | 2 +- drivers/media/dvb-frontends/dvb-pll.c | 2 +- drivers/media/dvb-frontends/ec100.c | 2 +- drivers/media/dvb-frontends/helene.c | 4 ++-- drivers/media/dvb-frontends/horus3a.c | 2 +- drivers/media/dvb-frontends/isl6405.c | 2 +- drivers/media/dvb-frontends/isl6421.c | 2 +- drivers/media/dvb-frontends/isl6423.c | 2 +- drivers/media/dvb-frontends/itd1000.c | 2 +- drivers/media/dvb-frontends/ix2505v.c | 2 +- drivers/media/dvb-frontends/l64781.c | 2 +- drivers/media/dvb-frontends/lg2160.c | 2 +- drivers/media/dvb-frontends/lgdt3305.c | 2 +- drivers/media/dvb-frontends/lgdt3306a.c | 2 +- drivers/media/dvb-frontends/lgdt330x.c | 2 +- drivers/media/dvb-frontends/lgs8gxx.c | 2 +- drivers/media/dvb-frontends/lnbh25.c | 2 +- drivers/media/dvb-frontends/lnbp21.c | 4 ++-- drivers/media/dvb-frontends/lnbp22.c | 2 +- drivers/media/dvb-frontends/m88ds3103.c | 2 +- drivers/media/dvb-frontends/m88rs2000.c | 2 +- drivers/media/dvb-frontends/mb86a16.c | 2 +- drivers/media/dvb-frontends/mb86a20s.c | 2 +- drivers/media/dvb-frontends/mt312.c | 2 +- drivers/media/dvb-frontends/mt352.c | 2 +- drivers/media/dvb-frontends/nxt200x.c | 2 +- drivers/media/dvb-frontends/nxt6000.c | 2 +- drivers/media/dvb-frontends/or51132.c | 2 +- drivers/media/dvb-frontends/or51211.c | 2 +- drivers/media/dvb-frontends/s5h1409.c | 2 +- drivers/media/dvb-frontends/s5h1411.c | 2 +- drivers/media/dvb-frontends/s5h1420.c | 2 +- drivers/media/dvb-frontends/s5h1432.c | 2 +- drivers/media/dvb-frontends/s921.c | 2 +- drivers/media/dvb-frontends/si21xx.c | 2 +- drivers/media/dvb-frontends/sp887x.c | 2 +- drivers/media/dvb-frontends/stb0899_drv.c | 2 +- drivers/media/dvb-frontends/stb6000.c | 2 +- drivers/media/dvb-frontends/stb6100.c | 2 +- drivers/media/dvb-frontends/stv0288.c | 2 +- drivers/media/dvb-frontends/stv0297.c | 2 +- drivers/media/dvb-frontends/stv0299.c | 2 +- drivers/media/dvb-frontends/stv0367.c | 6 +++--- drivers/media/dvb-frontends/stv0900_core.c | 2 +- drivers/media/dvb-frontends/stv090x.c | 2 +- drivers/media/dvb-frontends/stv6110.c | 2 +- drivers/media/dvb-frontends/stv6110x.c | 2 +- drivers/media/dvb-frontends/tda10021.c | 2 +- drivers/media/dvb-frontends/tda10023.c | 2 +- drivers/media/dvb-frontends/tda10048.c | 2 +- drivers/media/dvb-frontends/tda1004x.c | 4 ++-- drivers/media/dvb-frontends/tda10086.c | 2 +- drivers/media/dvb-frontends/tda665x.c | 2 +- drivers/media/dvb-frontends/tda8083.c | 2 +- drivers/media/dvb-frontends/tda8261.c | 2 +- drivers/media/dvb-frontends/tda826x.c | 2 +- drivers/media/dvb-frontends/ts2020.c | 2 +- drivers/media/dvb-frontends/tua6100.c | 2 +- drivers/media/dvb-frontends/ves1820.c | 2 +- drivers/media/dvb-frontends/ves1x93.c | 2 +- drivers/media/dvb-frontends/zl10036.c | 2 +- drivers/media/dvb-frontends/zl10039.c | 2 +- drivers/media/dvb-frontends/zl10353.c | 2 +- drivers/media/pci/bt8xx/dst.c | 2 +- drivers/media/pci/bt8xx/dst_ca.c | 2 +- drivers/media/pci/ddbridge/ddbridge-dummy-fe.c | 2 +- drivers/media/tuners/fc0011.c | 2 +- drivers/media/tuners/fc0012.c | 2 +- drivers/media/tuners/fc0013.c | 2 +- drivers/media/tuners/max2165.c | 2 +- drivers/media/tuners/mc44s803.c | 2 +- drivers/media/tuners/mt2060.c | 2 +- drivers/media/tuners/mt2131.c | 2 +- drivers/media/tuners/mt2266.c | 2 +- drivers/media/tuners/mxl5005s.c | 2 +- drivers/media/tuners/qt1010.c | 2 +- drivers/media/tuners/tda18218.c | 2 +- drivers/media/tuners/xc2028.c | 2 +- drivers/media/tuners/xc4000.c | 2 +- drivers/media/tuners/xc5000.c | 2 +- 105 files changed, 112 insertions(+), 112 deletions(-)
drivers/media/dvb-frontends/ascot2e.c +1 -1
@@ -533,7 +533,7 @@ struct dvb_frontend *ascot2e_attach(stru priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (ascot2e_attach); +EXPORT_SYMBOL_GPL (ascot2e_attach);MODULE_DESCRIPTION ("Sony ASCOT2E terr/cab tuner driver" );MODULE_AUTHOR ("[email protected]" );
drivers/media/dvb-frontends/atbm8830.c +1 -1
@@ -489,7 +489,7 @@ error_out:return NULL ; } -EXPORT_SYMBOL (atbm8830_attach); +EXPORT_SYMBOL_GPL (atbm8830_attach);MODULE_DESCRIPTION ("AltoBeam ATBM8830/8831 GB20600 demodulator driver" );MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );
drivers/media/dvb-frontends/au8522_dig.c +1 -1
@@ -879,7 +879,7 @@ error:au8522_release_state (state);return NULL ; } -EXPORT_SYMBOL (au8522_attach); +EXPORT_SYMBOL_GPL (au8522_attach);static const struct dvb_frontend_ops au8522_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/bcm3510.c +1 -1
@@ -835,7 +835,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (bcm3510_attach); +EXPORT_SYMBOL_GPL (bcm3510_attach);static const struct dvb_frontend_ops bcm3510_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/cx22700.c +1 -1
@@ -432,4 +432,4 @@ MODULE_DESCRIPTION("Conexant CX22700 DVBMODULE_AUTHOR ("Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (cx22700_attach); +EXPORT_SYMBOL_GPL (cx22700_attach);
drivers/media/dvb-frontends/cx22702.c +1 -1
@@ -604,7 +604,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (cx22702_attach); +EXPORT_SYMBOL_GPL (cx22702_attach);static const struct dvb_frontend_ops cx22702_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/cx24110.c +1 -1
@@ -653,4 +653,4 @@ MODULE_DESCRIPTION("Conexant CX24110 DVBMODULE_AUTHOR ("Peter Hettkamp" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (cx24110_attach); +EXPORT_SYMBOL_GPL (cx24110_attach);
drivers/media/dvb-frontends/cx24113.c +1 -1
@@ -590,7 +590,7 @@ error:return NULL ; } -EXPORT_SYMBOL (cx24113_attach); +EXPORT_SYMBOL_GPL (cx24113_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Activates frontend debugging (default:0)" );
drivers/media/dvb-frontends/cx24116.c +1 -1
@@ -1133,7 +1133,7 @@ struct dvb_frontend *cx24116_attach(cons state->frontend.demodulator_priv = state;return &state->frontend; } -EXPORT_SYMBOL (cx24116_attach); +EXPORT_SYMBOL_GPL (cx24116_attach);/* * Initialise or wake up device
drivers/media/dvb-frontends/cx24120.c +1 -1
@@ -305,7 +305,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (cx24120_attach); +EXPORT_SYMBOL_GPL (cx24120_attach);static int cx24120_test_rom (struct cx24120_state *state) {
drivers/media/dvb-frontends/cx24123.c +1 -1
@@ -1096,7 +1096,7 @@ error:return NULL ; } -EXPORT_SYMBOL (cx24123_attach); +EXPORT_SYMBOL_GPL (cx24123_attach);static const struct dvb_frontend_ops cx24123_ops = { .delsys = {SYS_DVBS },
drivers/media/dvb-frontends/cxd2820r_core.c +1 -1
@@ -536,7 +536,7 @@ struct dvb_frontend *cxd2820r_attach(conreturn pdata.get_dvb_frontend (client); } -EXPORT_SYMBOL (cxd2820r_attach); +EXPORT_SYMBOL_GPL (cxd2820r_attach);static struct dvb_frontend *cxd2820r_get_dvb_frontend (struct i2c_client *client) {
drivers/media/dvb-frontends/cxd2841er.c +2 -2
@@ -3930,14 +3930,14 @@ struct dvb_frontend *cxd2841er_attach_s( {return cxd2841er_attach (cfg, i2c,SYS_DVBS ); } -EXPORT_SYMBOL (cxd2841er_attach_s); +EXPORT_SYMBOL_GPL (cxd2841er_attach_s);struct dvb_frontend *cxd2841er_attach_t_c (struct cxd2841er_config *cfg,struct i2c_adapter *i2c) {return cxd2841er_attach (cfg, i2c,0 ); } -EXPORT_SYMBOL (cxd2841er_attach_t_c); +EXPORT_SYMBOL_GPL (cxd2841er_attach_t_c);static const struct dvb_frontend_ops cxd2841er_dvbs_s2_ops = { .delsys = {SYS_DVBS ,SYS_DVBS2 },
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c +1 -1
@@ -1950,7 +1950,7 @@ struct dvb_frontend *cxd2880_attach(strureturn fe; } -EXPORT_SYMBOL (cxd2880_attach); +EXPORT_SYMBOL_GPL (cxd2880_attach);MODULE_DESCRIPTION ("Sony CXD2880 DVB-T2/T tuner + demod driver" );MODULE_AUTHOR ("Sony Semiconductor Solutions Corporation" );
drivers/media/dvb-frontends/dib0070.c +1 -1
@@ -762,7 +762,7 @@ free_mem: fe->tuner_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (dib0070_attach); +EXPORT_SYMBOL_GPL (dib0070_attach);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Driver for the DiBcom 0070 base-band RF Tuner" );
drivers/media/dvb-frontends/dib0090.c +2 -2
@@ -2634,7 +2634,7 @@ struct dvb_frontend *dib0090_register(streturn NULL ; } -EXPORT_SYMBOL (dib0090_register); +EXPORT_SYMBOL_GPL (dib0090_register);struct dvb_frontend *dib0090_fw_register (struct dvb_frontend *fe,struct i2c_adapter *i2c,const struct dib0090_config *config) {
@@ -2660,7 +2660,7 @@ free_mem: fe->tuner_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (dib0090_fw_register); +EXPORT_SYMBOL_GPL (dib0090_fw_register);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_AUTHOR ("Olivier Grenie <[email protected]>" );
drivers/media/dvb-frontends/dib3000mb.c +1 -1
@@ -815,4 +815,4 @@ MODULE_AUTHOR(DRIVER_AUTHOR);MODULE_DESCRIPTION (DRIVER_DESC );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (dib3000mb_attach); +EXPORT_SYMBOL_GPL (dib3000mb_attach);
drivers/media/dvb-frontends/dib3000mc.c +1 -1
@@ -935,7 +935,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib3000mc_attach); +EXPORT_SYMBOL_GPL (dib3000mc_attach);static const struct dvb_frontend_ops dib3000mc_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib7000m.c +1 -1
@@ -1434,7 +1434,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib7000m_attach); +EXPORT_SYMBOL_GPL (dib7000m_attach);static const struct dvb_frontend_ops dib7000m_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib7000p.c +1 -1
@@ -2822,7 +2822,7 @@ void *dib7000p_attach(struct dib7000p_opreturn ops; } -EXPORT_SYMBOL (dib7000p_attach); +EXPORT_SYMBOL_GPL (dib7000p_attach);static const struct dvb_frontend_ops dib7000p_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/dib8000.c +1 -1
@@ -4527,7 +4527,7 @@ void *dib8000_attach(struct dib8000_opsreturn ops; } -EXPORT_SYMBOL (dib8000_attach); +EXPORT_SYMBOL_GPL (dib8000_attach);MODULE_AUTHOR ("Olivier Grenie <[email protected], Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Driver for the DiBcom 8000 ISDB-T demodulator" );
drivers/media/dvb-frontends/dib9000.c +1 -1
@@ -2546,7 +2546,7 @@ error:kfree (st);return NULL ; } -EXPORT_SYMBOL (dib9000_attach); +EXPORT_SYMBOL_GPL (dib9000_attach);static const struct dvb_frontend_ops dib9000_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/drx39xyj/drxj.c +1 -1
@@ -12368,7 +12368,7 @@ error:return NULL ; } -EXPORT_SYMBOL (drx39xxj_attach); +EXPORT_SYMBOL_GPL (drx39xxj_attach);static const struct dvb_frontend_ops drx39xxj_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/drxd_hard.c +1 -1
@@ -2939,7 +2939,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (drxd_attach); +EXPORT_SYMBOL_GPL (drxd_attach);MODULE_DESCRIPTION ("DRXD driver" );MODULE_AUTHOR ("Micronas" );
drivers/media/dvb-frontends/drxk_hard.c +1 -1
@@ -6833,7 +6833,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (drxk_attach); +EXPORT_SYMBOL_GPL (drxk_attach);MODULE_DESCRIPTION ("DRX-K driver" );MODULE_AUTHOR ("Ralph Metzler" );
drivers/media/dvb-frontends/ds3000.c +1 -1
@@ -859,7 +859,7 @@ struct dvb_frontend *ds3000_attach(constds3000_set_voltage (&state->frontend,SEC_VOLTAGE_OFF );return &state->frontend; } -EXPORT_SYMBOL (ds3000_attach); +EXPORT_SYMBOL_GPL (ds3000_attach);static int ds3000_set_carrier_offset (struct dvb_frontend *fe,s32 carrier_offset_khz)
drivers/media/dvb-frontends/dvb-pll.c +1 -1
@@ -866,7 +866,7 @@ out:return NULL ; } -EXPORT_SYMBOL (dvb_pll_attach); +EXPORT_SYMBOL_GPL (dvb_pll_attach); static int
drivers/media/dvb-frontends/ec100.c +1 -1
@@ -299,7 +299,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (ec100_attach); +EXPORT_SYMBOL_GPL (ec100_attach);static const struct dvb_frontend_ops ec100_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/helene.c +2 -2
@@ -1025,7 +1025,7 @@ struct dvb_frontend *helene_attach_s(str priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (helene_attach_s); +EXPORT_SYMBOL_GPL (helene_attach_s); struct dvb_frontend *helene_attach(struct dvb_frontend *fe, const struct helene_config *config,
@@ -1061,7 +1061,7 @@ struct dvb_frontend *helene_attach(struc priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (helene_attach); +EXPORT_SYMBOL_GPL (helene_attach);static int helene_probe (struct i2c_client *client,const struct i2c_device_id *id)
drivers/media/dvb-frontends/horus3a.c +1 -1
@@ -395,7 +395,7 @@ struct dvb_frontend *horus3a_attach(stru priv->i2c_address, priv->i2c);return fe; } -EXPORT_SYMBOL (horus3a_attach); +EXPORT_SYMBOL_GPL (horus3a_attach);MODULE_DESCRIPTION ("Sony HORUS3A satellite tuner driver" );MODULE_AUTHOR ("Sergey Kozlov <[email protected]>" );
drivers/media/dvb-frontends/isl6405.c +1 -1
@@ -141,7 +141,7 @@ struct dvb_frontend *isl6405_attach(strureturn fe; } -EXPORT_SYMBOL (isl6405_attach); +EXPORT_SYMBOL_GPL (isl6405_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic isl6405" );MODULE_AUTHOR ("Hartmut Hackmann & Oliver Endriss" );
drivers/media/dvb-frontends/isl6421.c +1 -1
@@ -213,7 +213,7 @@ struct dvb_frontend *isl6421_attach(strureturn fe; } -EXPORT_SYMBOL (isl6421_attach); +EXPORT_SYMBOL_GPL (isl6421_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic isl6421" );MODULE_AUTHOR ("Andrew de Quincey & Oliver Endriss" );
drivers/media/dvb-frontends/isl6423.c +1 -1
@@ -289,7 +289,7 @@ exit: fe->sec_priv =NULL ;return NULL ; } -EXPORT_SYMBOL (isl6423_attach); +EXPORT_SYMBOL_GPL (isl6423_attach);MODULE_DESCRIPTION ("ISL6423 SEC" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/itd1000.c +1 -1
@@ -389,7 +389,7 @@ struct dvb_frontend *itd1000_attach(strureturn fe; } -EXPORT_SYMBOL (itd1000_attach); +EXPORT_SYMBOL_GPL (itd1000_attach);MODULE_AUTHOR ("Patrick Boettcher <[email protected]>" );MODULE_DESCRIPTION ("Integrant ITD1000 driver" );
drivers/media/dvb-frontends/ix2505v.c +1 -1
@@ -302,7 +302,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (ix2505v_attach); +EXPORT_SYMBOL_GPL (ix2505v_attach);module_param_named (debug, ix2505v_debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/l64781.c +1 -1
@@ -593,4 +593,4 @@ MODULE_DESCRIPTION("LSI L64781 DVB-T DemMODULE_AUTHOR ("Holger Waechtler, Marko Kohtala" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (l64781_attach); +EXPORT_SYMBOL_GPL (l64781_attach);
drivers/media/dvb-frontends/lg2160.c +1 -1
@@ -1426,7 +1426,7 @@ struct dvb_frontend *lg2160_attach(constreturn &state->frontend; } -EXPORT_SYMBOL (lg2160_attach); +EXPORT_SYMBOL_GPL (lg2160_attach);MODULE_DESCRIPTION ("LG Electronics LG216x ATSC/MH Demodulator Driver" );MODULE_AUTHOR ("Michael Krufky <[email protected]>" );
drivers/media/dvb-frontends/lgdt3305.c +1 -1
@@ -1148,7 +1148,7 @@ fail:kfree (state);return NULL ; } -EXPORT_SYMBOL (lgdt3305_attach); +EXPORT_SYMBOL_GPL (lgdt3305_attach);static const struct dvb_frontend_ops lgdt3304_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/lgdt3306a.c +1 -1
@@ -1859,7 +1859,7 @@ fail:kfree (state);return NULL ; } -EXPORT_SYMBOL (lgdt3306a_attach); +EXPORT_SYMBOL_GPL (lgdt3306a_attach);#ifdef DBG_DUMP
drivers/media/dvb-frontends/lgdt330x.c +1 -1
@@ -928,7 +928,7 @@ struct dvb_frontend *lgdt330x_attach(conreturn lgdt330x_get_dvb_frontend (client); } -EXPORT_SYMBOL (lgdt330x_attach); +EXPORT_SYMBOL_GPL (lgdt330x_attach);static const struct dvb_frontend_ops lgdt3302_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/lgs8gxx.c +1 -1
@@ -1043,7 +1043,7 @@ error_out:return NULL ; } -EXPORT_SYMBOL (lgs8gxx_attach); +EXPORT_SYMBOL_GPL (lgs8gxx_attach);MODULE_DESCRIPTION ("Legend Silicon LGS8913/LGS8GXX DMB-TH demodulator driver" );MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );
drivers/media/dvb-frontends/lnbh25.c +1 -1
@@ -173,7 +173,7 @@ struct dvb_frontend *lnbh25_attach(struc __func__, priv->i2c_address);return fe; } -EXPORT_SYMBOL (lnbh25_attach); +EXPORT_SYMBOL_GPL (lnbh25_attach);MODULE_DESCRIPTION ("ST LNBH25 driver" );MODULE_AUTHOR ("[email protected]" );
drivers/media/dvb-frontends/lnbp21.c +2 -2
@@ -155,7 +155,7 @@ struct dvb_frontend *lnbh24_attach(strucreturn lnbx2x_attach (fe, i2c, override_set, override_clear, i2c_addr,LNBH24_TTX ); } -EXPORT_SYMBOL (lnbh24_attach); +EXPORT_SYMBOL_GPL (lnbh24_attach); struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set,
@@ -164,7 +164,7 @@ struct dvb_frontend *lnbp21_attach(strucreturn lnbx2x_attach (fe, i2c, override_set, override_clear,0x08 ,LNBP21_ISEL ); } -EXPORT_SYMBOL (lnbp21_attach); +EXPORT_SYMBOL_GPL (lnbp21_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic lnbp21, lnbh24" );MODULE_AUTHOR ("Oliver Endriss, Igor M. Liplianin" );
drivers/media/dvb-frontends/lnbp22.c +1 -1
@@ -125,7 +125,7 @@ struct dvb_frontend *lnbp22_attach(strucreturn fe; } -EXPORT_SYMBOL (lnbp22_attach); +EXPORT_SYMBOL_GPL (lnbp22_attach);MODULE_DESCRIPTION ("Driver for lnb supply and control ic lnbp22" );MODULE_AUTHOR ("Dominik Kuhlen" );
drivers/media/dvb-frontends/m88ds3103.c +1 -1
@@ -1695,7 +1695,7 @@ struct dvb_frontend *m88ds3103_attach(co *tuner_i2c_adapter = pdata.get_i2c_adapter (client);return pdata.get_dvb_frontend (client); } -EXPORT_SYMBOL (m88ds3103_attach); +EXPORT_SYMBOL_GPL (m88ds3103_attach);static const struct dvb_frontend_ops m88ds3103_ops = { .delsys = {SYS_DVBS ,SYS_DVBS2 },
drivers/media/dvb-frontends/m88rs2000.c +1 -1
@@ -808,7 +808,7 @@ error:return NULL ; } -EXPORT_SYMBOL (m88rs2000_attach); +EXPORT_SYMBOL_GPL (m88rs2000_attach);MODULE_DESCRIPTION ("M88RS2000 DVB-S Demodulator driver" );MODULE_AUTHOR ("Malcolm Priestley [email protected]" );
drivers/media/dvb-frontends/mb86a16.c +1 -1
@@ -1848,6 +1848,6 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (mb86a16_attach); +EXPORT_SYMBOL_GPL (mb86a16_attach);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/mb86a20s.c +1 -1
@@ -2081,7 +2081,7 @@ struct dvb_frontend *mb86a20s_attach(condev_info (&i2c->dev,"Detected a Fujitsu mb86a20s frontend\n" );return &state->frontend; } -EXPORT_SYMBOL (mb86a20s_attach); +EXPORT_SYMBOL_GPL (mb86a20s_attach);static const struct dvb_frontend_ops mb86a20s_ops = { .delsys = {SYS_ISDBT },
drivers/media/dvb-frontends/mt312.c +1 -1
@@ -827,7 +827,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (mt312_attach); +EXPORT_SYMBOL_GPL (mt312_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/mt352.c +1 -1
@@ -593,4 +593,4 @@ MODULE_DESCRIPTION("Zarlink MT352 DVB-TMODULE_AUTHOR ("Holger Waechtler, Daniel Mack, Antonio Mancuso" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (mt352_attach); +EXPORT_SYMBOL_GPL (mt352_attach);
drivers/media/dvb-frontends/nxt200x.c +1 -1
@@ -1216,5 +1216,5 @@ MODULE_DESCRIPTION("NXT200X (ATSC 8VSB &MODULE_AUTHOR ("Kirk Lapray, Michael Krufky, Jean-Francois Thibert, and Taylor Jacob" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (nxt200x_attach); +EXPORT_SYMBOL_GPL (nxt200x_attach);
drivers/media/dvb-frontends/nxt6000.c +1 -1
@@ -621,4 +621,4 @@ MODULE_DESCRIPTION("NxtWave NXT6000 DVB-MODULE_AUTHOR ("Florian Schirmer" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (nxt6000_attach); +EXPORT_SYMBOL_GPL (nxt6000_attach);
drivers/media/dvb-frontends/or51132.c +1 -1
@@ -605,4 +605,4 @@ MODULE_AUTHOR("Kirk Lapray");MODULE_AUTHOR ("Trent Piepho" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (or51132_attach); +EXPORT_SYMBOL_GPL (or51132_attach);
drivers/media/dvb-frontends/or51211.c +1 -1
@@ -551,5 +551,5 @@ MODULE_DESCRIPTION("Oren OR51211 VSB [pcMODULE_AUTHOR ("Kirk Lapray" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (or51211_attach); +EXPORT_SYMBOL_GPL (or51211_attach);
drivers/media/dvb-frontends/s5h1409.c +1 -1
@@ -981,7 +981,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1409_attach); +EXPORT_SYMBOL_GPL (s5h1409_attach);static const struct dvb_frontend_ops s5h1409_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/s5h1411.c +1 -1
@@ -900,7 +900,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1411_attach); +EXPORT_SYMBOL_GPL (s5h1411_attach);static const struct dvb_frontend_ops s5h1411_ops = { .delsys = {SYS_ATSC ,SYS_DVBC_ANNEX_B },
drivers/media/dvb-frontends/s5h1420.c +1 -1
@@ -918,7 +918,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (s5h1420_attach); +EXPORT_SYMBOL_GPL (s5h1420_attach);static const struct dvb_frontend_ops s5h1420_ops = { .delsys = {SYS_DVBS },
drivers/media/dvb-frontends/s5h1432.c +1 -1
@@ -355,7 +355,7 @@ struct dvb_frontend *s5h1432_attach(consreturn &state->frontend; } -EXPORT_SYMBOL (s5h1432_attach); +EXPORT_SYMBOL_GPL (s5h1432_attach);static const struct dvb_frontend_ops s5h1432_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/s921.c +1 -1
@@ -495,7 +495,7 @@ struct dvb_frontend *s921_attach(const sreturn &state->frontend; } -EXPORT_SYMBOL (s921_attach); +EXPORT_SYMBOL_GPL (s921_attach);static const struct dvb_frontend_ops s921_ops = { .delsys = {SYS_ISDBT },
drivers/media/dvb-frontends/si21xx.c +1 -1
@@ -937,7 +937,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (si21xx_attach); +EXPORT_SYMBOL_GPL (si21xx_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/sp887x.c +1 -1
@@ -624,4 +624,4 @@ MODULE_PARM_DESC(debug, "Turn on/off froMODULE_DESCRIPTION ("Spase sp887x DVB-T demodulator driver" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (sp887x_attach); +EXPORT_SYMBOL_GPL (sp887x_attach);
drivers/media/dvb-frontends/stb0899_drv.c +1 -1
@@ -1638,7 +1638,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stb0899_attach); +EXPORT_SYMBOL_GPL (stb0899_attach);MODULE_PARM_DESC (verbose,"Set Verbosity level" );MODULE_AUTHOR ("Manu Abraham" );MODULE_DESCRIPTION ("STB0899 Multi-Std frontend" );
drivers/media/dvb-frontends/stb6000.c +1 -1
@@ -232,7 +232,7 @@ struct dvb_frontend *stb6000_attach(strureturn fe; } -EXPORT_SYMBOL (stb6000_attach); +EXPORT_SYMBOL_GPL (stb6000_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/stb6100.c +1 -1
@@ -557,7 +557,7 @@ static void stb6100_release(struct dvb_fkfree (state); } -EXPORT_SYMBOL (stb6100_attach); +EXPORT_SYMBOL_GPL (stb6100_attach);MODULE_PARM_DESC (verbose,"Set Verbosity level" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/stv0288.c +1 -1
@@ -590,7 +590,7 @@ error:return NULL ; } -EXPORT_SYMBOL (stv0288_attach); +EXPORT_SYMBOL_GPL (stv0288_attach);module_param (debug_legacy_dish_switch, int,0444 ); MODULE_PARM_DESC(debug_legacy_dish_switch,
drivers/media/dvb-frontends/stv0297.c +1 -1
@@ -710,4 +710,4 @@ MODULE_DESCRIPTION("ST STV0297 DVB-C DemMODULE_AUTHOR ("Dennis Noermann and Andrew de Quincey" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (stv0297_attach); +EXPORT_SYMBOL_GPL (stv0297_attach);
drivers/media/dvb-frontends/stv0299.c +1 -1
@@ -752,4 +752,4 @@ MODULE_DESCRIPTION("ST STV0299 DVB DemodMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, Andreas Oberritter, Andrew de Quincey, Kenneth Aafly" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (stv0299_attach); +EXPORT_SYMBOL_GPL (stv0299_attach);
drivers/media/dvb-frontends/stv0367.c +3 -3
@@ -1750,7 +1750,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367ter_attach); +EXPORT_SYMBOL_GPL (stv0367ter_attach);static int stv0367cab_gate_ctrl (struct dvb_frontend *fe,int enable) {
@@ -2919,7 +2919,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367cab_attach); +EXPORT_SYMBOL_GPL (stv0367cab_attach);/* * Functions for operation on Digital Devices hardware
@@ -3340,7 +3340,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0367ddb_attach); +EXPORT_SYMBOL_GPL (stv0367ddb_attach);MODULE_PARM_DESC (debug,"Set debug" );MODULE_PARM_DESC (i2c_debug,"Set i2c debug" );
drivers/media/dvb-frontends/stv0900_core.c +1 -1
@@ -1957,7 +1957,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv0900_attach); +EXPORT_SYMBOL_GPL (stv0900_attach);MODULE_PARM_DESC (debug,"Set debug" );
drivers/media/dvb-frontends/stv090x.c +1 -1
@@ -5072,7 +5072,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (stv090x_attach); +EXPORT_SYMBOL_GPL (stv090x_attach);static const struct i2c_device_id stv090x_id_table[] = { {"stv090x" ,0 },
drivers/media/dvb-frontends/stv6110.c +1 -1
@@ -427,7 +427,7 @@ struct dvb_frontend *stv6110_attach(strureturn fe; } -EXPORT_SYMBOL (stv6110_attach); +EXPORT_SYMBOL_GPL (stv6110_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/stv6110x.c +1 -1
@@ -468,7 +468,7 @@ const struct stv6110x_devctl *stv6110x_adev_info (&stv6110x->i2c->dev,"Attaching STV6110x\n" );return stv6110x->devctl; } -EXPORT_SYMBOL (stv6110x_attach); +EXPORT_SYMBOL_GPL (stv6110x_attach);static const struct i2c_device_id stv6110x_id_table[] = { {"stv6110x" ,0 },
drivers/media/dvb-frontends/tda10021.c +1 -1
@@ -523,4 +523,4 @@ MODULE_DESCRIPTION("Philips TDA10021 DVBMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler, Markus Schulz" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10021_attach); +EXPORT_SYMBOL_GPL (tda10021_attach);
drivers/media/dvb-frontends/tda10023.c +1 -1
@@ -594,4 +594,4 @@ MODULE_DESCRIPTION("Philips TDA10023 DVBMODULE_AUTHOR ("Georg Acher, Hartmut Birr" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10023_attach); +EXPORT_SYMBOL_GPL (tda10023_attach);
drivers/media/dvb-frontends/tda10048.c +1 -1
@@ -1138,7 +1138,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (tda10048_attach); +EXPORT_SYMBOL_GPL (tda10048_attach);static const struct dvb_frontend_ops tda10048_ops = { .delsys = {SYS_DVBT },
drivers/media/dvb-frontends/tda1004x.c +2 -2
@@ -1378,5 +1378,5 @@ MODULE_DESCRIPTION("Philips TDA10045H &MODULE_AUTHOR ("Andrew de Quincey & Robert Schlabbach" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10045_attach); -EXPORT_SYMBOL (tda10046_attach); +EXPORT_SYMBOL_GPL (tda10045_attach); +EXPORT_SYMBOL_GPL (tda10046_attach);
drivers/media/dvb-frontends/tda10086.c +1 -1
@@ -764,4 +764,4 @@ MODULE_DESCRIPTION("Philips TDA10086 DVBMODULE_AUTHOR ("Andrew de Quincey" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda10086_attach); +EXPORT_SYMBOL_GPL (tda10086_attach);
drivers/media/dvb-frontends/tda665x.c +1 -1
@@ -227,7 +227,7 @@ struct dvb_frontend *tda665x_attach(strureturn fe; } -EXPORT_SYMBOL (tda665x_attach); +EXPORT_SYMBOL_GPL (tda665x_attach);MODULE_DESCRIPTION ("TDA665x driver" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/dvb-frontends/tda8083.c +1 -1
@@ -481,4 +481,4 @@ MODULE_DESCRIPTION("Philips TDA8083 DVB-MODULE_AUTHOR ("Ralph Metzler, Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (tda8083_attach); +EXPORT_SYMBOL_GPL (tda8083_attach);
drivers/media/dvb-frontends/tda8261.c +1 -1
@@ -188,7 +188,7 @@ exit:return NULL ; } -EXPORT_SYMBOL (tda8261_attach); +EXPORT_SYMBOL_GPL (tda8261_attach);MODULE_AUTHOR ("Manu Abraham" );MODULE_DESCRIPTION ("TDA8261 8PSK/QPSK Tuner" );
drivers/media/dvb-frontends/tda826x.c +1 -1
@@ -164,7 +164,7 @@ struct dvb_frontend *tda826x_attach(strureturn fe; } -EXPORT_SYMBOL (tda826x_attach); +EXPORT_SYMBOL_GPL (tda826x_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/ts2020.c +1 -1
@@ -525,7 +525,7 @@ struct dvb_frontend *ts2020_attach(strucreturn fe; } -EXPORT_SYMBOL (ts2020_attach); +EXPORT_SYMBOL_GPL (ts2020_attach);/* * We implement own regmap locking due to legacy DVB attach which uses frontend
drivers/media/dvb-frontends/tua6100.c +1 -1
@@ -186,7 +186,7 @@ struct dvb_frontend *tua6100_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (tua6100_attach); +EXPORT_SYMBOL_GPL (tua6100_attach);MODULE_DESCRIPTION ("DVB tua6100 driver" );MODULE_AUTHOR ("Andrew de Quincey" );
drivers/media/dvb-frontends/ves1820.c +1 -1
@@ -434,4 +434,4 @@ MODULE_DESCRIPTION("VLSI VES1820 DVB-C DMODULE_AUTHOR ("Ralph Metzler, Holger Waechtler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (ves1820_attach); +EXPORT_SYMBOL_GPL (ves1820_attach);
drivers/media/dvb-frontends/ves1x93.c +1 -1
@@ -540,4 +540,4 @@ MODULE_DESCRIPTION("VLSI VES1x93 DVB-S DMODULE_AUTHOR ("Ralph Metzler" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (ves1x93_attach); +EXPORT_SYMBOL_GPL (ves1x93_attach);
drivers/media/dvb-frontends/zl10036.c +1 -1
@@ -496,7 +496,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (zl10036_attach); +EXPORT_SYMBOL_GPL (zl10036_attach);module_param_named (debug, zl10036_debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/zl10039.c +1 -1
@@ -295,7 +295,7 @@ error:kfree (state);return NULL ; } -EXPORT_SYMBOL (zl10039_attach); +EXPORT_SYMBOL_GPL (zl10039_attach);module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"Turn on/off frontend debugging (default:off)." );
drivers/media/dvb-frontends/zl10353.c +1 -1
@@ -665,4 +665,4 @@ MODULE_DESCRIPTION("Zarlink ZL10353 DVB-MODULE_AUTHOR ("Chris Pascoe" );MODULE_LICENSE ("GPL" ); -EXPORT_SYMBOL (zl10353_attach); +EXPORT_SYMBOL_GPL (zl10353_attach);
drivers/media/pci/bt8xx/dst.c +1 -1
@@ -1722,7 +1722,7 @@ struct dst_state *dst_attach(struct dst_return state;/* Manu (DST is a card not a frontend) */ } -EXPORT_SYMBOL (dst_attach); +EXPORT_SYMBOL_GPL (dst_attach);static const struct dvb_frontend_ops dst_dvbt_ops = { .delsys = {SYS_DVBT },
drivers/media/pci/bt8xx/dst_ca.c +1 -1
@@ -668,7 +668,7 @@ struct dvb_device *dst_ca_attach(structreturn NULL ; } -EXPORT_SYMBOL (dst_ca_attach); +EXPORT_SYMBOL_GPL (dst_ca_attach);MODULE_DESCRIPTION ("DST DVB-S/T/C Combo CA driver" );MODULE_AUTHOR ("Manu Abraham" );
drivers/media/pci/ddbridge/ddbridge-dummy-fe.c +1 -1
@@ -112,7 +112,7 @@ struct dvb_frontend *ddbridge_dummy_fe_q state->frontend.demodulator_priv = state;return &state->frontend; } -EXPORT_SYMBOL (ddbridge_dummy_fe_qam_attach); +EXPORT_SYMBOL_GPL (ddbridge_dummy_fe_qam_attach);static const struct dvb_frontend_ops ddbridge_dummy_fe_qam_ops = { .delsys = {SYS_DVBC_ANNEX_A },
drivers/media/tuners/fc0011.c +1 -1
@@ -499,7 +499,7 @@ struct dvb_frontend *fc0011_attach(strucreturn fe; } -EXPORT_SYMBOL (fc0011_attach); +EXPORT_SYMBOL_GPL (fc0011_attach);MODULE_DESCRIPTION ("Fitipower FC0011 silicon tuner driver" );MODULE_AUTHOR ("Michael Buesch <[email protected]>" );
drivers/media/tuners/fc0012.c +1 -1
@@ -495,7 +495,7 @@ err:return fe; } -EXPORT_SYMBOL (fc0012_attach); +EXPORT_SYMBOL_GPL (fc0012_attach);MODULE_DESCRIPTION ("Fitipower FC0012 silicon tuner driver" );MODULE_AUTHOR ("Hans-Frieder Vogt <[email protected]>" );
drivers/media/tuners/fc0013.c +1 -1
@@ -608,7 +608,7 @@ struct dvb_frontend *fc0013_attach(strucreturn fe; } -EXPORT_SYMBOL (fc0013_attach); +EXPORT_SYMBOL_GPL (fc0013_attach);MODULE_DESCRIPTION ("Fitipower FC0013 silicon tuner driver" );MODULE_AUTHOR ("Hans-Frieder Vogt <[email protected]>" );
drivers/media/tuners/max2165.c +1 -1
@@ -410,7 +410,7 @@ struct dvb_frontend *max2165_attach(strureturn fe; } -EXPORT_SYMBOL (max2165_attach); +EXPORT_SYMBOL_GPL (max2165_attach);MODULE_AUTHOR ("David T. L. Wong <[email protected]>" );MODULE_DESCRIPTION ("Maxim MAX2165 silicon tuner driver" );
drivers/media/tuners/mc44s803.c +1 -1
@@ -356,7 +356,7 @@ error:kfree (priv);return NULL ; } -EXPORT_SYMBOL (mc44s803_attach); +EXPORT_SYMBOL_GPL (mc44s803_attach);MODULE_AUTHOR ("Jochen Friedrich" );MODULE_DESCRIPTION ("Freescale MC44S803 silicon tuner driver" );
drivers/media/tuners/mt2060.c +1 -1
@@ -440,7 +440,7 @@ struct dvb_frontend * mt2060_attach(strureturn fe; } -EXPORT_SYMBOL (mt2060_attach); +EXPORT_SYMBOL_GPL (mt2060_attach);static int mt2060_probe (struct i2c_client *client,const struct i2c_device_id *id)
drivers/media/tuners/mt2131.c +1 -1
@@ -274,7 +274,7 @@ struct dvb_frontend * mt2131_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (mt2131_attach); +EXPORT_SYMBOL_GPL (mt2131_attach);MODULE_AUTHOR ("Steven Toth" );MODULE_DESCRIPTION ("Microtune MT2131 silicon tuner driver" );
drivers/media/tuners/mt2266.c +1 -1
@@ -336,7 +336,7 @@ struct dvb_frontend * mt2266_attach(strumt2266_calibrate (priv);return fe; } -EXPORT_SYMBOL (mt2266_attach); +EXPORT_SYMBOL_GPL (mt2266_attach);MODULE_AUTHOR ("Olivier DANET" );MODULE_DESCRIPTION ("Microtune MT2266 silicon tuner driver" );
drivers/media/tuners/mxl5005s.c +1 -1
@@ -4116,7 +4116,7 @@ struct dvb_frontend *mxl5005s_attach(str fe->tuner_priv = state;return fe; } -EXPORT_SYMBOL (mxl5005s_attach); +EXPORT_SYMBOL_GPL (mxl5005s_attach);MODULE_DESCRIPTION ("MaxLinear MXL5005S silicon tuner driver" );MODULE_AUTHOR ("Steven Toth" );
drivers/media/tuners/qt1010.c +1 -1
@@ -440,7 +440,7 @@ struct dvb_frontend * qt1010_attach(stru fe->tuner_priv = priv;return fe; } -EXPORT_SYMBOL (qt1010_attach); +EXPORT_SYMBOL_GPL (qt1010_attach);MODULE_DESCRIPTION ("Quantek QT1010 silicon tuner driver" );MODULE_AUTHOR ("Antti Palosaari <[email protected]>" );
drivers/media/tuners/tda18218.c +1 -1
@@ -336,7 +336,7 @@ struct dvb_frontend *tda18218_attach(strreturn fe; } -EXPORT_SYMBOL (tda18218_attach); +EXPORT_SYMBOL_GPL (tda18218_attach);MODULE_DESCRIPTION ("NXP TDA18218HN silicon tuner driver" );MODULE_AUTHOR ("Antti Palosaari <[email protected]>" );
drivers/media/tuners/xc2028.c +1 -1
@@ -1512,7 +1512,7 @@ fail:return NULL ; } -EXPORT_SYMBOL (xc2028_attach); +EXPORT_SYMBOL_GPL (xc2028_attach);MODULE_DESCRIPTION ("Xceive xc2028/xc3028 tuner driver" );MODULE_AUTHOR ("Michel Ludwig <[email protected]>" );
drivers/media/tuners/xc4000.c +1 -1
@@ -1742,7 +1742,7 @@ fail2:xc4000_release (fe);return NULL ; } -EXPORT_SYMBOL (xc4000_attach); +EXPORT_SYMBOL_GPL (xc4000_attach);MODULE_AUTHOR ("Steven Toth, Davide Ferri" );MODULE_DESCRIPTION ("Xceive xc4000 silicon tuner driver" );
drivers/media/tuners/xc5000.c +1 -1
@@ -1460,7 +1460,7 @@ fail:xc5000_release (fe);return NULL ; } -EXPORT_SYMBOL (xc5000_attach); +EXPORT_SYMBOL_GPL (xc5000_attach);MODULE_AUTHOR ("Steven Toth" );MODULE_DESCRIPTION ("Xceive xc5000 silicon tuner driver" );
Greg Kroah-Hartman
maintainerPATCH 548/600 media: venus: hfi_venus: Write to VIDC_CTRL_INIT after unmasking interrupts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
commit d74e481609808330b4625b3691cf01e1f56e255e upstream.
The startup procedure shouldn't be started with interrupts masked, as that may entail silent failures.
Kick off initialization only after the interrupts are unmasked.
--- drivers/media/platform/qcom/venus/hfi_venus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/qcom/venus/hfi_venus.c +1 -1
@@ -453,7 +453,6 @@ static int venus_boot_core(struct venus_void __iomem *wrapper_base = hdev->core->wrapper_base;int ret =0 ; -writel (BIT (VIDC_CTRL_INIT_CTRL_SHIFT ), cpu_cs_base +VIDC_CTRL_INIT );if (IS_V6 (hdev->core)) { mask_val =readl (wrapper_base +WRAPPER_INTR_MASK ); mask_val &= ~(WRAPPER_INTR_MASK_A2HWD_BASK_V6 |
@@ -464,6 +463,7 @@ static int venus_boot_core(struct venus_writel (mask_val, wrapper_base +WRAPPER_INTR_MASK );writel (1 , cpu_cs_base +CPU_CS_SCIACMDARG3 ); +writel (BIT (VIDC_CTRL_INIT_CTRL_SHIFT ), cpu_cs_base +VIDC_CTRL_INIT );while (!ctrl_status && count < max_tries) { ctrl_status =readl (cpu_cs_base +CPU_CS_SCIACMDARG0 );if ((ctrl_status &CPU_CS_SCIACMDARG0_ERROR_STATUS_MASK ) ==4 ) {
Greg Kroah-Hartman
maintainerPATCH 549/600 Revert "scsi: qla2xxx: Fix buffer overrun"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nilesh Javali <[email protected]>
commit 641671d97b9199f1ba35ccc2222d4b189a6a5de5 upstream.
Revert due to Get PLOGI Template failed.
This reverts commit b68710a8094fdffe8dd4f7a82c82649f479bb453.
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -5571,7 +5571,7 @@ static void qla_get_login_template(scsi___be32 *q;memset (ha->init_cb,0 , ha->init_cb_size); - sz =min_t (int,sizeof (struct fc_els_csp ), ha->init_cb_size); + sz =min_t (int,sizeof (struct fc_els_flogi ), ha->init_cb_size); rval =qla24xx_get_port_login_templ (vha, ha->init_cb_dma, ha->init_cb, sz);if (rval !=QLA_SUCCESS ) {
Greg Kroah-Hartman
maintainerPATCH 550/600 scsi: mpt3sas: Perform additional retries if doorbell read returns 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjan Kumar <[email protected]>
commit 4ca10f3e31745d35249a727ecd108eb58f0a8c5e upstream.
The driver retries certain register reads 3 times if the returned value is
0. This was done because the controller could return 0 for certain registers if other registers were being accessed concurrently by the BMC.
In certain systems with increased BMC interactions, the register values returned can be 0 for longer than 3 retries. Change the retry count from 3 to 30 for the affected registers to prevent problems with out-of-band management.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 46 +++++++++++++++++++++++++----------- drivers/scsi/mpt3sas/mpt3sas_base.h | 1 2 files changed, 34 insertions(+), 13 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +33 -13
@@ -139,6 +139,9 @@ _base_get_ioc_facts(struct MPT3SAS_ADAPTstatic void _base_clear_outstanding_commands (struct MPT3SAS_ADAPTER *ioc); +static u32 +_base_readl_ext_retry (const volatile void __iomem *addr); +/** * mpt3sas_base_check_cmd_timeout - Function * to check timeout and command termination due
@@ -214,6 +217,20 @@ _base_readl_aero(const volatile void __ireturn ret_val; } +static u32 +_base_readl_ext_retry (const volatile void __iomem *addr) +{ +u32 i, ret_val; + +for (i =0 ; i <30 ; i++) { + ret_val =readl (addr); +if (ret_val ==0 ) +continue ; + } + +return ret_val; +} +static inline u32 _base_readl (const volatile void __iomem *addr) {
@@ -941,7 +958,7 @@ mpt3sas_halt_firmware(struct MPT3SAS_ADAdump_stack (); - doorbell = ioc->base_readl (&ioc->chip->Doorbell); + doorbell = ioc->base_readl_ext_retry (&ioc->chip->Doorbell);if ((doorbell &MPI2_IOC_STATE_MASK ) ==MPI2_IOC_STATE_FAULT ) {mpt3sas_print_fault_code (ioc, doorbell &MPI2_DOORBELL_DATA_MASK );
@@ -6697,7 +6714,7 @@ mpt3sas_base_get_iocstate(struct MPT3SAS {u32 s, sc; - s = ioc->base_readl (&ioc->chip->Doorbell); + s = ioc->base_readl_ext_retry (&ioc->chip->Doorbell); sc = s &MPI2_IOC_STATE_MASK ;return cooked ? sc : s; }
@@ -6842,7 +6859,7 @@ _base_wait_for_doorbell_ack(struct MPT3S __func__, count, timeout));return 0 ; }else if (int_status &MPI2_HIS_IOC2SYS_DB_STATUS ) { - doorbell = ioc->base_readl (&ioc->chip->Doorbell); + doorbell = ioc->base_readl_ext_retry (&ioc->chip->Doorbell);if ((doorbell &MPI2_IOC_STATE_MASK ) ==MPI2_IOC_STATE_FAULT ) {mpt3sas_print_fault_code (ioc, doorbell);
@@ -6882,7 +6899,7 @@ _base_wait_for_doorbell_not_used(struct count =0 ; cntdn =1000 * timeout; do { - doorbell_reg = ioc->base_readl(&ioc->chip->Doorbell); + doorbell_reg = ioc->base_readl_ext_retry(&ioc->chip->Doorbell); if (!(doorbell_reg & MPI2_DOORBELL_USED)) { dhsprintk(ioc, ioc_info(ioc, "%s: successful count(%d), timeout(%d)\n",
@@ -7030,7 +7047,7 @@ _base_handshake_req_reply_wait(struct MP__le32 *mfp;/* make sure doorbell is not in use */ -if ((ioc->base_readl (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) { +if ((ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) {ioc_err (ioc,"doorbell is in use (line=%d)\n" , __LINE__);return -EFAULT ; }
@@ -7079,7 +7096,7 @@ _base_handshake_req_reply_wait(struct MP }/* read the first two 16-bits, it gives the total length of the reply */ - reply[0 ] =le16_to_cpu (ioc->base_readl (&ioc->chip->Doorbell) + reply[0 ] =le16_to_cpu (ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus);if ((_base_wait_for_doorbell_int (ioc,5 ))) {
@@ -7087,7 +7104,7 @@ _base_handshake_req_reply_wait(struct MP __LINE__);return -EFAULT ; } - reply[1 ] =le16_to_cpu (ioc->base_readl (&ioc->chip->Doorbell) + reply[1 ] =le16_to_cpu (ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus);
@@ -7098,10 +7115,10 @@ _base_handshake_req_reply_wait(struct MPreturn -EFAULT ; }if (i >= reply_bytes/2 )/* overflow case */ - ioc->base_readl (&ioc->chip->Doorbell); + ioc->base_readl_ext_retry (&ioc->chip->Doorbell);else reply[i] =le16_to_cpu ( - ioc->base_readl (&ioc->chip->Doorbell) + ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_DATA_MASK );writel (0 , &ioc->chip->HostInterruptStatus); }
@@ -7960,7 +7977,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTER goto out; } - host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic); + host_diagnostic = ioc->base_readl_ext_retry (&ioc->chip->HostDiagnostic);drsprintk (ioc,ioc_info (ioc,"wrote magic sequence: count(%d), host_diagnostic(0x%08x)\n" , count, host_diagnostic));
@@ -7980,7 +7997,7 @@ _base_diag_reset(struct MPT3SAS_ADAPTERfor (count =0 ; count < (300000000 /MPI2_HARD_RESET_PCIE_SECOND_READ_DELAY_MICRO_SEC ); count++) { - host_diagnostic = ioc->base_readl (&ioc->chip->HostDiagnostic); + host_diagnostic = ioc->base_readl_ext_retry (&ioc->chip->HostDiagnostic);if (host_diagnostic ==0xFFFFFFFF ) { ioc_info(ioc,
@@ -8370,10 +8387,13 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPT ioc->rdpq_array_enable_assigned =0 ; ioc->use_32bit_dma = false; ioc->dma_mask =64 ; -if (ioc->is_aero_ioc) +if (ioc->is_aero_ioc) { ioc->base_readl = &_base_readl_aero; -else + ioc->base_readl_ext_retry = &_base_readl_ext_retry; + }else { ioc->base_readl = &_base_readl; + ioc->base_readl_ext_retry = &_base_readl; + } r =mpt3sas_base_map_resources (ioc);if (r) goto out_free_resources;
drivers/scsi/mpt3sas/mpt3sas_base.h +1 -0
@@ -1618,6 +1618,7 @@ struct MPT3SAS_ADAPTER {u8 diag_trigger_active;u8 atomic_desc_capable;BASE_READ_REG base_readl; +BASE_READ_REG base_readl_ext_retry;struct SL_WH_MASTER_TRIGGER_T diag_trigger_master;struct SL_WH_EVENT_TRIGGERS_T diag_trigger_event;struct SL_WH_SCSI_TRIGGERS_T diag_trigger_scsi;
Greg Kroah-Hartman
maintainerPATCH 551/600 PCI: Free released resource after coalescing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
commit 8ec9c1d5d0a5a4744516adb483b97a238892f9d5 upstream.
release_resource() doesn't actually free the resource or resource list entry so free the resource list entry to avoid a leak.
--- drivers/pci/probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/probe.c +1 -0
@@ -996,6 +996,7 @@ static int pci_register_host_bridge(stru res = window->res;if (!res->flags && !res->start && !res->end) {release_resource (res); +resource_list_destroy_entry (window);continue ; }
Greg Kroah-Hartman
maintainerPATCH 552/600 PCI: hv: Fix a crash in hv_pci_restore_msi_msg() during hibernation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dexuan Cui <[email protected]>
commit 04bbe863241a9be7d57fb4cf217ee4a72f480e70 upstream.
When a Linux VM with an assigned PCI device runs on Hyper-V, if the PCI device driver is not loaded yet (i.e. MSI-X/MSI is not enabled on the device yet), doing a VM hibernation triggers a panic in hv_pci_restore_msi_msg() -> msi_lock_descs(&pdev->dev), because pdev->dev.msi.data is still NULL.
Avoid the panic by checking if MSI-X/MSI is enabled.
--- drivers/pci/controller/pci-hyperv.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/controller/pci-hyperv.c +3 -0
@@ -3930,6 +3930,9 @@ static int hv_pci_restore_msi_msg(structstruct msi_desc *entry;int ret =0 ; +if (!pdev->msi_enabled && !pdev->msix_enabled) +return 0 ; +msi_lock_descs (&pdev->dev);msi_for_each_desc (entry, &pdev->dev,MSI_DESC_ASSOCIATED ) { irq_data =irq_get_irq_data (entry->irq);
Greg Kroah-Hartman
maintainerPATCH 553/600 PCI/PM: Only read PCI_PM_CTRL register when available
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Feiyang Chen <[email protected]>
commit 5694ba13b004eea683c6d4faeb6d6e7a9636bda0 upstream.
For a device with no Power Management Capability, pci_power_up() previously returned 0 (success) if the platform was able to put the device in D0, which led to pci_set_full_power_state() trying to read PCI_PM_CTRL, even though it doesn't exist.
Since dev->pm_cap == 0 in this case, pci_set_full_power_state() actually read the wrong register, interpreted it as PCI_PM_CTRL, and corrupted dev->current_state. This led to messages like this in some cases:
pci 0000:01:00.0: Refused to change power state from D3hot to D0
To prevent this, make pci_power_up() always return a negative failure code if the device lacks a Power Management Capability, even if non-PCI platform power management has been able to put the device in D0. The failure will prevent pci_set_full_power_state() from trying to access PCI_PM_CTRL.
--- drivers/pci/pci.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/pci/pci.c +9 -4
@@ -1193,6 +1193,10 @@ static int pci_dev_wait(struct pci_dev ** * On success, return 0 or 1, depending on whether or not it is necessary to * restore the device's BARs subsequently (1 is returned in that case). +* +* On failure, return a negative error code. Always return failure if @dev +* lacks a Power Management Capability, even if the platform was able to +* put the device in D0 via non-PCI means. */ int pci_power_up (struct pci_dev *dev) {
@@ -1209,9 +1213,6 @@ int pci_power_up(struct pci_dev *dev)else dev->current_state = state; -if (state ==PCI_D0 ) -return 0 ; -return -EIO ; }
@@ -1269,8 +1270,12 @@ static int pci_set_full_power_state(struint ret; ret =pci_power_up (dev); -if (ret <0 ) +if (ret <0 ) { +if (dev->current_state ==PCI_D0 ) +return 0 ; +return ret; + }pci_read_config_word (dev, dev->pm_cap +PCI_PM_CTRL , &pmcsr); dev->current_state = pmcsr &PCI_PM_CTRL_STATE_MASK ;
Greg Kroah-Hartman
maintainerPATCH 554/600 ntb: Drop packets when qp link is down
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit f195a1a6fe416882984f8bd6c61afc1383171860 upstream.
Currently when the transport receive packets after netdev has closed the transport returns error and triggers tx errors to be incremented and carrier to be stopped. There is no reason to return error if the device is already closed. Drop the packet and return 0.
--- drivers/ntb/ntb_transport.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +5 -1
@@ -2276,9 +2276,13 @@ int ntb_transport_tx_enqueue(struct ntb_struct ntb_queue_entry *entry;int rc; -if (!qp || !qp->link_is_up || !len) +if (!qp || !len)return -EINVAL ; +/* If the qp link is down already, just ignore. */ +if (!qp->link_is_up) +return 0 ; + entry =ntb_list_rm (&qp->ntb_tx_free_q_lock, &qp->tx_free_q);if (!entry) { qp->tx_err_no_buf++;
Greg Kroah-Hartman
maintainerPATCH 555/600 ntb: Clean up tx tail index on link down
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit cc79bd2738c2d40aba58b2be6ce47dc0e471df0e upstream.
The tx tail index is not reset when the link goes down. This causes the tail index to go out of sync when the link goes down and comes back up. Refactor the ntb_qp_link_down_reset() and reset the tail index as well.
--- drivers/ntb/ntb_transport.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ntb/ntb_transport.c +9 -2
@@ -909,7 +909,7 @@ static int ntb_set_mw(struct ntb_transporeturn 0 ; } -static void ntb_qp_link_down_reset (struct ntb_transport_qp *qp) +static void ntb_qp_link_context_reset (struct ntb_transport_qp *qp) { qp->link_is_up = false; qp->active = false;
@@ -932,6 +932,13 @@ static void ntb_qp_link_down_reset(struc qp->tx_async =0 ; } +static void ntb_qp_link_down_reset (struct ntb_transport_qp *qp) +{ +ntb_qp_link_context_reset (qp); +if (qp->remote_rx_info) + qp->remote_rx_info->entry = qp->rx_max_entry -1 ; +} +static void ntb_qp_link_cleanup (struct ntb_transport_qp *qp) {struct ntb_transport_ctx *nt = qp->transport;
@@ -1174,7 +1181,7 @@ static int ntb_transport_init_queue(stru qp->ndev = nt->ndev; qp->client_ready = false; qp->event_handler =NULL ; -ntb_qp_link_down_reset (qp); +ntb_qp_link_context_reset (qp);if (mw_num < qp_count % mw_count) num_qps_mw = qp_count / mw_count +1 ;
Greg Kroah-Hartman
maintainerPATCH 556/600 ntb: Fix calculation ntb_transport_tx_free_entry()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Jiang <[email protected]>
commit 5a7693e6bbf19b22fd6c1d2c4b7beb0a03969e2c upstream.
ntb_transport_tx_free_entry() never returns 0 with the current calculation. If head == tail, then it would return qp->tx_max_entry. Change compare to tail >= head and when they are equal, a 0 would be returned.
--- drivers/ntb/ntb_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/ntb_transport.c +1 -1
@@ -2429,7 +2429,7 @@ unsigned int ntb_transport_tx_free_entryunsigned int head = qp->tx_index;unsigned int tail = qp->remote_rx_info->entry; -return tail > head ? tail - head : qp->tx_max_entry + tail - head; +return tail >= head ? tail - head : qp->tx_max_entry + tail - head; }EXPORT_SYMBOL_GPL (ntb_transport_tx_free_entry);
Greg Kroah-Hartman
maintainerPATCH 557/600 Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit 5260bd6d36c83c5b269c33baaaf8c78e520908b0 upstream.
This reverts commit d5af729dc2071273f14cbb94abbc60608142fd83.
d5af729dc207 ("PCI: Mark NVIDIA T4 GPUs to avoid bus reset") avoided Secondary Bus Reset on the T4 because the reset seemed to not work when the T4 was directly attached to a Root Port.
But NVIDIA thinks the issue is probably related to some issue with the Root Port, not with the T4. The T4 provides neither PM nor FLR reset, so masking bus reset compromises this device for assignment scenarios.
Revert d5af729dc207 as requested by Wu Zongyong. This will leave SBR broken in the specific configuration Wu tested, as it was in v6.5, so Wu will debug that further.
--- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/quirks.c +1 -1
@@ -3631,7 +3631,7 @@ static void quirk_no_bus_reset(struct pc*/ static void quirk_nvidia_no_bus_reset (struct pci_dev *dev) { -if ((dev->device &0xffc0 ) ==0x2340 || dev->device ==0x1eb8 ) +if ((dev->device &0xffc0 ) ==0x2340 )quirk_no_bus_reset (dev); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
Greg Kroah-Hartman
maintainerPATCH 558/600 block: dont add or resize partition on the disk with GENHD_FL_NO_PART
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
commit 1a721de8489fa559ff4471f73c58bb74ac5580d3 upstream.
Commit a33df75c6328 ("block: use an xarray for disk->part_tbl") remove disk_expand_part_tbl() in add_partition(), which means all kinds of devices will support extended dynamic dev_t.
However, some devices with GENHD_FL_NO_PART are not expected to add or resize partition.
Fix this by adding check of GENHD_FL_NO_PART before add or resize partition.
--- block/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
block/ioctl.c +2 -0
@@ -20,6 +20,8 @@ static int blkpg_do_ioctl(struct block_dstruct blkpg_partition p;long long start, length; +if (disk->flags &GENHD_FL_NO_PART ) +return -EINVAL ;if (!capable (CAP_SYS_ADMIN ))return -EACCES ;if (copy_from_user (&p, upart,sizeof (struct blkpg_partition )))
Greg Kroah-Hartman
maintainerPATCH 559/600 procfs: block chmod on /proc/thread-self/comm
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Sarai <[email protected]>
commit ccf61486fe1e1a48e18c638d1813cda77b3c0737 upstream.
Due to an oversight in commit 1b3044e39a89 ("procfs: fix pthread cross-thread naming if !PR_DUMPABLE") in switching from REG to NOD, chmod operations on /proc/thread-self/comm were no longer blocked as they are on almost all other procfs files.
A very similar situation with /proc/self/environ was used to as a root exploit a long time ago, but procfs has SB_I_NOEXEC so this is simply a correctness issue.
Ref: https://lwn.net/Articles/191954/
Ref: 6d76fa58b050 ("Don't allow chmod() on the /proc/<pid>/ files")
Message-Id: <[email protected]>
--- fs/proc/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/base.c +2 -1
@@ -3581,7 +3581,8 @@ static int proc_tid_comm_permission(stru }static const struct inode_operations proc_tid_comm_inode_operations = { - .permission = proc_tid_comm_permission, + .setattr = proc_setattr, + .permission = proc_tid_comm_permission, };/*
Greg Kroah-Hartman
maintainerPATCH 560/600 parisc: Fix /proc/cpuinfo output for lscpu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 9f5ba4b3e1b3c123eeca5d2d09161e8720048b5c upstream.
The lscpu command is broken since commit cab56b51ec0e ("parisc: Fix device names in /proc/iomem") added the PA pathname to all PA devices, includig the CPUs.
lscpu parses /proc/cpuinfo and now believes it found different CPU types since every CPU is listed with an unique identifier (PA pathname).
Fix this problem by simply dropping the PA pathname when listing the CPUs in /proc/cpuinfo. There is no need to show the pathname in this procfs file.
--- arch/parisc/kernel/processor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
arch/parisc/kernel/processor.c +10 -3
@@ -372,10 +372,18 @@ int show_cpuinfo (struct seq_file *m, void *v) { unsigned long cpu; +char cpu_name[60 ], *p; + +/* strip PA path from CPU name to not confuse lscpu */ +strlcpy (cpu_name,per_cpu (cpu_data,0 ).dev->name,sizeof (cpu_name)); + p =strrchr (cpu_name,'[' ); +if (p) + *(--p) =0 ;for_each_online_cpu (cpu) { -const struct cpuinfo_parisc *cpuinfo = &per_cpu (cpu_data, cpu);#ifdef CONFIG_SMP +const struct cpuinfo_parisc *cpuinfo = &per_cpu (cpu_data, cpu); +if (0 == cpuinfo->hpa)continue ;#endif
@@ -420,8 +428,7 @@ show_cpuinfo (struct seq_file *m, void *seq_printf (m,"model\t\t: %s - %s\n" , boot_cpu_data.pdc.sys_model_name, - cpuinfo->dev ? - cpuinfo->dev->name :"Unknown" ); + cpu_name); seq_printf(m, "hversion\t: 0x%08x\n" "sversion\t: 0x%08x\n",
Greg Kroah-Hartman
maintainerPATCH 561/600 drm/amd/display: Add smu write msg id fail retry process
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fudong Wang <[email protected]>
commit 72105dcfa3d12b5af49311f857e3490baa225135 upstream.
A benchmark stress test (12-40 machines x 48hours) found that DCN315 has cases where DC writes to an indirect register to set the smu clock msg id, but when we go to read the same indirect register the returned msg id doesn't match with what we just set it to. So, to fix this retry the write until the register's value matches with the requested value.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c | 20 ++++++++++--- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c +16 -4
@@ -32,6 +32,7 @@#define MAX_INSTANCE 6#define MAX_SEGMENT 6 +#define SMU_REGISTER_WRITE_RETRY_COUNT 5struct IP_BASE_INSTANCE {
@@ -134,6 +135,8 @@ static int dcn315_smu_send_msg_with_para unsigned int msg_id, unsigned int param) { uint32_t result; +uint32_t i =0 ; +uint32_t read_back_data; result =dcn315_smu_wait_for_response (clk_mgr,10 ,200000 );
@@ -150,10 +153,19 @@ static int dcn315_smu_send_msg_with_para/* Set the parameter register for the SMU message, unit is Mhz */ REG_WRITE (MP1_SMN_C2PMSG_37 , param); -/* Trigger the message transaction by writing the message ID */ -generic_write_indirect_reg (CTX , -REG_NBIO (RSMU_INDEX ),REG_NBIO (RSMU_DATA ), - mmMP1_C2PMSG_3, msg_id); +for (i =0 ; i <SMU_REGISTER_WRITE_RETRY_COUNT ; i++) { +/* Trigger the message transaction by writing the message ID */ +generic_write_indirect_reg (CTX , +REG_NBIO (RSMU_INDEX ),REG_NBIO (RSMU_DATA ), + mmMP1_C2PMSG_3, msg_id); + read_back_data =generic_read_indirect_reg (CTX , +REG_NBIO (RSMU_INDEX ),REG_NBIO (RSMU_DATA ), + mmMP1_C2PMSG_3); +if (read_back_data == msg_id) +break ; +udelay (2 ); +smu_print ("SMU msg id write fail %x times. \n" , i +1 ); + } result =dcn315_smu_wait_for_response (clk_mgr,10 ,200000 );
Greg Kroah-Hartman
maintainerPATCH 562/600 bpf: Fix issue in verifying allow_ptr_leaks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
commit d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2 upstream.
After we converted the capabilities of our networking-bpf program from cap_sys_admin to cap_net_admin+cap_bpf, our networking-bpf program failed to start. Because it failed the bpf verifier, and the error log is "R3 pointer comparison prohibited".
A simple reproducer as follows,
SEC("cls-ingress")
int ingress(struct __sk_buff *skb)
{
struct iphdr *iph = (void *)(long)skb->data + sizeof(struct ethhdr);
if ((long)(iph + 1) > (long)skb->data_end)
return TC_ACT_STOLEN;
return TC_ACT_OK;
}Per discussion with Yonghong and Alexei [1], comparison of two packet pointers is not a pointer leak. This patch fixes it.
Our local kernel is 6.1.y and we expect this fix to be backported to 6.1.y, so stable is CCed.
[1]. https://lore.kernel.org/bpf/CAADnVQ+Nmspr7Si+pxWn8zkE7hX-7s93ugwC+94aXSy4uQ9vBg@mail.gmail.com/
--- kernel/bpf/verifier.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
kernel/bpf/verifier.c +9 -8
@@ -10401,6 +10401,12 @@ static int check_cond_jmp_op(struct bpf_return -EINVAL ; } +/* check src2 operand */ + err =check_reg_arg (env, insn->dst_reg,SRC_OP ); +if (err) +return err; + + dst_reg = ®s[insn->dst_reg];if (BPF_SRC (insn->code) ==BPF_X ) {if (insn->imm !=0 ) {verbose (env,"BPF_JMP/JMP32 uses reserved fields\n" );
@@ -10412,12 +10418,13 @@ static int check_cond_jmp_op(struct bpf_if (err)return err; -if (is_pointer_value (env, insn->src_reg)) { + src_reg = ®s[insn->src_reg]; +if (!(reg_is_pkt_pointer_any (dst_reg) &®_is_pkt_pointer_any (src_reg)) && +is_pointer_value (env, insn->src_reg)) {verbose (env,"R%d pointer comparison prohibited\n" , insn->src_reg);return -EACCES ; } - src_reg = ®s[insn->src_reg]; }else {if (insn->src_reg !=BPF_REG_0 ) {verbose (env,"BPF_JMP/JMP32 uses reserved fields\n" );
@@ -10425,12 +10432,6 @@ static int check_cond_jmp_op(struct bpf_ } } -/* check src2 operand */ - err =check_reg_arg (env, insn->dst_reg,SRC_OP ); -if (err) -return err; - - dst_reg = ®s[insn->dst_reg]; is_jmp32 =BPF_CLASS (insn->code) ==BPF_JMP32 ;if (BPF_SRC (insn->code) ==BPF_K ) {
Re: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
Quoted 7 lines
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.
I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/
Signature · 11 lines
Luis Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879
Greg KH
maintainerRe: [PATCH 6.1 562/600] bpf: Fix issue in verifying allow_ptr_leaks
Quoted 6 lines · Luis Gerhorst
Quoted 6 lines
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
Quoted 8 lines
Quoted 1 line
commit
d75e30dddf73449bc2d10bb8e2f1a2c446bc67a2upstream.I unfortunately have objections, they are pending discussion at [1].
Same applies to the 6.4-stable review patch [2] and all other backports.
[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/stable/[email protected]/
As this is in the tree already, and in Linus's tree, I'll wait to see if any changes are merged into Linus's tree for this before removing it from the stable trees.
Let us know if there's a commit that resolves this and we will be glad to queue that up.
thanks,
greg k-h