]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Aug 2022 08:54:09 +0000 (10:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Aug 2022 08:54:09 +0000 (10:54 +0200)
added patches:
ion-make-user_ion_handle_put_nolock-a-void-function.patch

queue-4.9/ion-make-user_ion_handle_put_nolock-a-void-function.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/ion-make-user_ion_handle_put_nolock-a-void-function.patch b/queue-4.9/ion-make-user_ion_handle_put_nolock-a-void-function.patch
new file mode 100644 (file)
index 0000000..d969679
--- /dev/null
@@ -0,0 +1,58 @@
+From nathan@kernel.org  Mon Aug  1 10:53:38 2022
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Wed, 27 Jul 2022 09:46:17 -0700
+Subject: ion: Make user_ion_handle_put_nolock() a void function
+To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sasha Levin <sashal@kernel.org>
+Cc: Daniel Rosenberg <drosen@google.com>, stable@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor <nathan@kernel.org>, kernel test robot <lkp@intel.com>
+Message-ID: <20220727164617.980209-1-nathan@kernel.org>
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+Clang warns:
+
+  drivers/staging/android/ion/ion-ioctl.c:71:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
+          if (--handle->user_ref_count == 0)
+              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  drivers/staging/android/ion/ion-ioctl.c:74:9: note: uninitialized use occurs here
+          return ret;
+                 ^~~
+  drivers/staging/android/ion/ion-ioctl.c:71:2: note: remove the 'if' if its condition is always true
+          if (--handle->user_ref_count == 0)
+          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  drivers/staging/android/ion/ion-ioctl.c:69:9: note: initialize the variable 'ret' to silence this warning
+          int ret;
+                 ^
+                  = 0
+  1 warning generated.
+
+The return value of user_ion_handle_put_nolock() is not checked in its
+one call site in user_ion_free_nolock() so just make
+user_ion_handle_put_nolock() return void to remove the warning.
+
+Fixes: a8200613c8c9 ("ion: Protect kref from userspace manipulation")
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/staging/android/ion/ion-ioctl.c |    8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/staging/android/ion/ion-ioctl.c
++++ b/drivers/staging/android/ion/ion-ioctl.c
+@@ -64,14 +64,10 @@ static struct ion_handle *pass_to_user(s
+ }
+ /* Must hold the client lock */
+-static int user_ion_handle_put_nolock(struct ion_handle *handle)
++static void user_ion_handle_put_nolock(struct ion_handle *handle)
+ {
+-      int ret;
+-
+       if (--handle->user_ref_count == 0)
+-              ret = ion_handle_put_nolock(handle);
+-
+-      return ret;
++              ion_handle_put_nolock(handle);
+ }
+ static void user_ion_free_nolock(struct ion_client *client,
index 06236f56dbdba28036bbd1157f720924cb63fd46..a34b8520a0b5cfa564d0ae97851b0ac7388bf0ba 100644 (file)
@@ -6,3 +6,4 @@ net-sungem_phy-add-of_node_put-for-reference-returne.patch
 netfilter-nf_queue-do-not-allow-packet-truncation-be.patch
 arm-crypto-comment-out-gcc-warning-that-breaks-clang-builds.patch
 mt7601u-add-usb-device-id-for-some-versions-of-xiaodu-wifi-dongle.patch
+ion-make-user_ion_handle_put_nolock-a-void-function.patch