]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.11-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 May 2021 12:02:36 +0000 (14:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 May 2021 12:02:36 +0000 (14:02 +0200)
added patches:
kobject_uevent-remove-warning-in-init_uevent_argv.patch
usb-typec-tcpm-fix-error-while-calculating-pps-out-values.patch

queue-5.11/kobject_uevent-remove-warning-in-init_uevent_argv.patch [new file with mode: 0644]
queue-5.11/series
queue-5.11/usb-typec-tcpm-fix-error-while-calculating-pps-out-values.patch [new file with mode: 0644]

diff --git a/queue-5.11/kobject_uevent-remove-warning-in-init_uevent_argv.patch b/queue-5.11/kobject_uevent-remove-warning-in-init_uevent_argv.patch
new file mode 100644 (file)
index 0000000..cde741d
--- /dev/null
@@ -0,0 +1,45 @@
+From b4104180a2efb85f55e1ba1407885c9421970338 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Mon, 5 Apr 2021 11:48:52 +0200
+Subject: kobject_uevent: remove warning in init_uevent_argv()
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit b4104180a2efb85f55e1ba1407885c9421970338 upstream.
+
+syzbot can trigger the WARN() in init_uevent_argv() which isn't the
+nicest as the code does properly recover and handle the error.  So
+change the WARN() call to pr_warn() and provide some more information on
+what the buffer size that was needed.
+
+Link: https://lore.kernel.org/r/20201107082206.GA19079@kroah.com
+Cc: "Rafael J. Wysocki" <rafael@kernel.org>
+Cc: linux-kernel@vger.kernel.org
+Reported-by: syzbot+92340f7b2b4789907fdb@syzkaller.appspotmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20210405094852.1348499-1-gregkh@linuxfoundation.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/kobject_uevent.c |    9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/lib/kobject_uevent.c
++++ b/lib/kobject_uevent.c
+@@ -251,12 +251,13 @@ static int kobj_usermode_filter(struct k
+ static int init_uevent_argv(struct kobj_uevent_env *env, const char *subsystem)
+ {
++      int buffer_size = sizeof(env->buf) - env->buflen;
+       int len;
+-      len = strlcpy(&env->buf[env->buflen], subsystem,
+-                    sizeof(env->buf) - env->buflen);
+-      if (len >= (sizeof(env->buf) - env->buflen)) {
+-              WARN(1, KERN_ERR "init_uevent_argv: buffer size too small\n");
++      len = strlcpy(&env->buf[env->buflen], subsystem, buffer_size);
++      if (len >= buffer_size) {
++              pr_warn("init_uevent_argv: buffer size of %d too small, needed %d\n",
++                      buffer_size, len);
+               return -ENOMEM;
+       }
index 2b7f00ce2005e0df15088c45136e9e6d9cb723b9..e2762789c3d37204d98847062052ca4910e321c3 100644 (file)
@@ -306,3 +306,5 @@ mips-avoid-divu-in-__div64_32-is-result-would-be-zero.patch
 mips-avoid-handcoded-divu-in-__div64_32-altogether.patch
 clocksource-drivers-timer-ti-dm-prepare-to-handle-dra7-timer-wrap-issue.patch
 clocksource-drivers-timer-ti-dm-handle-dra7-timer-wrap-errata-i940.patch
+usb-typec-tcpm-fix-error-while-calculating-pps-out-values.patch
+kobject_uevent-remove-warning-in-init_uevent_argv.patch
diff --git a/queue-5.11/usb-typec-tcpm-fix-error-while-calculating-pps-out-values.patch b/queue-5.11/usb-typec-tcpm-fix-error-while-calculating-pps-out-values.patch
new file mode 100644 (file)
index 0000000..4ef3146
--- /dev/null
@@ -0,0 +1,42 @@
+From 374157ff88ae1a7f7927331cbc72c1ec11994e8a Mon Sep 17 00:00:00 2001
+From: Badhri Jagan Sridharan <badhri@google.com>
+Date: Wed, 14 Apr 2021 22:01:21 -0700
+Subject: usb: typec: tcpm: Fix error while calculating PPS out values
+
+From: Badhri Jagan Sridharan <badhri@google.com>
+
+commit 374157ff88ae1a7f7927331cbc72c1ec11994e8a upstream.
+
+"usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply"
+introduced a regression for req_out_volt and req_op_curr calculation.
+
+req_out_volt should consider the newly calculated max voltage instead
+of previously accepted max voltage by the port partner. Likewise,
+req_op_curr should consider the newly calculated max current instead
+of previously accepted max current by the port partner.
+
+Fixes: e3a072022487 ("usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply")
+Reviewed-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
+Link: https://lore.kernel.org/r/20210415050121.1928298-1-badhri@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/tcpm/tcpm.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/typec/tcpm/tcpm.c
++++ b/drivers/usb/typec/tcpm/tcpm.c
+@@ -2546,10 +2546,10 @@ static unsigned int tcpm_pd_select_pps_a
+               port->pps_data.req_max_volt = min(pdo_pps_apdo_max_voltage(src),
+                                                 pdo_pps_apdo_max_voltage(snk));
+               port->pps_data.req_max_curr = min_pps_apdo_current(src, snk);
+-              port->pps_data.req_out_volt = min(port->pps_data.max_volt,
+-                                                max(port->pps_data.min_volt,
++              port->pps_data.req_out_volt = min(port->pps_data.req_max_volt,
++                                                max(port->pps_data.req_min_volt,
+                                                     port->pps_data.req_out_volt));
+-              port->pps_data.req_op_curr = min(port->pps_data.max_curr,
++              port->pps_data.req_op_curr = min(port->pps_data.req_max_curr,
+                                                port->pps_data.req_op_curr);
+       }