From: Greg Kroah-Hartman Date: Mon, 25 Mar 2019 20:35:04 +0000 (+0900) Subject: 4.4-stable patches X-Git-Tag: v4.9.166~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8edaddb5b1b788b8eef59836a8eae925906a3b3f;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: locking-lockdep-add-debug_locks-check-in-__lock_downgrade.patch media-v4l2-ctrls.c-uvc-zero-v4l2_event.patch --- diff --git a/queue-4.4/locking-lockdep-add-debug_locks-check-in-__lock_downgrade.patch b/queue-4.4/locking-lockdep-add-debug_locks-check-in-__lock_downgrade.patch new file mode 100644 index 00000000000..94fec5b05f2 --- /dev/null +++ b/queue-4.4/locking-lockdep-add-debug_locks-check-in-__lock_downgrade.patch @@ -0,0 +1,48 @@ +From 71492580571467fb7177aade19c18ce7486267f5 Mon Sep 17 00:00:00 2001 +From: Waiman Long +Date: Wed, 9 Jan 2019 23:03:25 -0500 +Subject: locking/lockdep: Add debug_locks check in __lock_downgrade() + +From: Waiman Long + +commit 71492580571467fb7177aade19c18ce7486267f5 upstream. + +Tetsuo Handa had reported he saw an incorrect "downgrading a read lock" +warning right after a previous lockdep warning. It is likely that the +previous warning turned off lock debugging causing the lockdep to have +inconsistency states leading to the lock downgrade warning. + +Fix that by add a check for debug_locks at the beginning of +__lock_downgrade(). + +Debugged-by: Tetsuo Handa +Reported-by: Tetsuo Handa +Reported-by: syzbot+53383ae265fb161ef488@syzkaller.appspotmail.com +Signed-off-by: Waiman Long +Signed-off-by: Peter Zijlstra (Intel) +Cc: Andrew Morton +Cc: Linus Torvalds +Cc: Paul E. McKenney +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: Will Deacon +Link: https://lkml.kernel.org/r/1547093005-26085-1-git-send-email-longman@redhat.com +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/locking/lockdep.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/kernel/locking/lockdep.c ++++ b/kernel/locking/lockdep.c +@@ -3314,6 +3314,9 @@ __lock_set_class(struct lockdep_map *loc + unsigned int depth; + int i; + ++ if (unlikely(!debug_locks)) ++ return 0; ++ + depth = curr->lockdep_depth; + /* + * This function is about (re)setting the class of a held lock, diff --git a/queue-4.4/media-v4l2-ctrls.c-uvc-zero-v4l2_event.patch b/queue-4.4/media-v4l2-ctrls.c-uvc-zero-v4l2_event.patch new file mode 100644 index 00000000000..2c8a1326e66 --- /dev/null +++ b/queue-4.4/media-v4l2-ctrls.c-uvc-zero-v4l2_event.patch @@ -0,0 +1,49 @@ +From f45f3f753b0a3d739acda8e311b4f744d82dc52a Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Tue, 18 Dec 2018 08:37:08 -0500 +Subject: media: v4l2-ctrls.c/uvc: zero v4l2_event + +From: Hans Verkuil + +commit f45f3f753b0a3d739acda8e311b4f744d82dc52a upstream. + +Control events can leak kernel memory since they do not fully zero the +event. The same code is present in both v4l2-ctrls.c and uvc_ctrl.c, so +fix both. + +It appears that all other event code is properly zeroing the structure, +it's these two places. + +Signed-off-by: Hans Verkuil +Reported-by: syzbot+4f021cf3697781dbd9fb@syzkaller.appspotmail.com +Reviewed-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/media/usb/uvc/uvc_ctrl.c | 2 +- + drivers/media/v4l2-core/v4l2-ctrls.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/media/usb/uvc/uvc_ctrl.c ++++ b/drivers/media/usb/uvc/uvc_ctrl.c +@@ -1202,7 +1202,7 @@ static void uvc_ctrl_fill_event(struct u + + __uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl); + +- memset(ev->reserved, 0, sizeof(ev->reserved)); ++ memset(ev, 0, sizeof(*ev)); + ev->type = V4L2_EVENT_CTRL; + ev->id = v4l2_ctrl.id; + ev->u.ctrl.value = value; +--- a/drivers/media/v4l2-core/v4l2-ctrls.c ++++ b/drivers/media/v4l2-core/v4l2-ctrls.c +@@ -1212,7 +1212,7 @@ static u32 user_flags(const struct v4l2_ + + static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes) + { +- memset(ev->reserved, 0, sizeof(ev->reserved)); ++ memset(ev, 0, sizeof(*ev)); + ev->type = V4L2_EVENT_CTRL; + ev->id = ctrl->id; + ev->u.ctrl.changes = changes; diff --git a/queue-4.4/series b/queue-4.4/series index e030799683d..f513386e381 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -8,3 +8,5 @@ ext4-fix-null-pointer-dereference-while-journal-is-aborted.patch ext4-fix-data-corruption-caused-by-unaligned-direct-aio.patch ext4-brelse-all-indirect-buffer-in-ext4_ind_remove_space.patch mmc-tmio_mmc_core-don-t-claim-spurious-interrupts.patch +media-v4l2-ctrls.c-uvc-zero-v4l2_event.patch +locking-lockdep-add-debug_locks-check-in-__lock_downgrade.patch