Android 14.0.0 Release 0.47 (UP1A.231105.001.B2,bramble/redfin)
UPSTREAM: net/sched: cls_fw: Fix improper refcount update leads to use-after-free

[ Upstream commit 0323bce598eea038714f941ce2b22541c46d488f ]

In the event of a failure in tcf_change_indev(), fw_set_parms() will
immediately return an error after incrementing or decrementing
reference counter in tcf_bind_filter().  If attacker can control
reference counter to zero and make reference freed, leading to
use after free.

In order to prevent this, move the point of possible failure above the
point where the TC_FW_CLASSID is handled.

Bug: 292252062
Bug: 290783303
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: M A Ramdhan <ramdhan@starlabs.sg>
Signed-off-by: M A Ramdhan <ramdhan@starlabs.sg>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
Message-ID: <20230705161530.52003-1-ramdhan@starlabs.sg>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c91fb29bb07ee4dd40aabd1e41f19c0f92ac3199)
Signed-off-by: Lee Jones <joneslee@google.com>
(cherry picked from commit a89c7b9715e2d482a08b58b698f0cf37da373070)
Signed-off-by: Pindar Yang <pindaryang@google.com>
Change-Id: I9bf6f540b4eb23ea5641fb3efe6f3e621d7b6151
1 file changed
tree: 590052e86eca5409d468adc8e4d15181acb5b856
  1. android/
  2. arch/
  3. block/
  4. certs/
  5. crypto/
  6. Documentation/
  7. drivers/
  8. firmware/
  9. fs/
  10. include/
  11. init/
  12. ipc/
  13. kernel/
  14. lib/
  15. LICENSES/
  16. mm/
  17. net/
  18. samples/
  19. scripts/
  20. security/
  21. sound/
  22. techpack/
  23. tools/
  24. usr/
  25. virt/
  26. .clang-format
  27. .cocciconfig
  28. .get_maintainer.ignore
  29. .gitattributes
  30. .gitignore
  31. .mailmap
  32. Android.bp
  33. AndroidKernel.mk
  34. build.config.aarch64
  35. build.config.allmodconfig
  36. build.config.allmodconfig.aarch64
  37. build.config.allmodconfig.arm
  38. build.config.allmodconfig.x86_64
  39. build.config.arm
  40. build.config.common
  41. build.config.gki
  42. build.config.gki-debug.aarch64
  43. build.config.gki-debug.x86_64
  44. build.config.gki.aarch64
  45. build.config.gki.sm7250
  46. build.config.gki.sm8250
  47. build.config.gki.x86_64
  48. build.config.gki_kasan
  49. build.config.gki_kasan.aarch64
  50. build.config.gki_kasan.x86_64
  51. build.config.gki_kprobes
  52. build.config.gki_kprobes.aarch64
  53. build.config.gki_kprobes.x86_64
  54. build.config.goldfish.arm
  55. build.config.goldfish.arm64
  56. build.config.goldfish.mips
  57. build.config.goldfish.mips64
  58. build.config.goldfish.x86
  59. build.config.goldfish.x86_64
  60. build.config.performance
  61. build.config.redbull
  62. build.config.redbull.block_test
  63. build.config.redbull.common
  64. build.config.redbull.common.clang
  65. build.config.redbull.debug_api
  66. build.config.redbull.debug_locking
  67. build.config.redbull.debug_memory
  68. build.config.redbull.debug_memory_accounting
  69. build.config.redbull.gcc
  70. build.config.redbull.kasan
  71. build.config.redbull.no-cfi
  72. build.config.redbull.performance
  73. build.config.redbull.vintf
  74. build.config.sm7250.common
  75. build.config.sm8250.common
  76. build.config.sm8250.common.clang
  77. build.config.sm8250.no-cfi
  78. build.config.x86_64
  79. build_redbull-gki.sh
  80. build_redbull.sh
  81. build_sm7250.sh
  82. build_sm8250.sh
  83. COPYING
  84. CREDITS
  85. gen_headers_arm.bp
  86. gen_headers_arm64.bp
  87. Kbuild
  88. Kconfig
  89. kernel_headers.py
  90. MAINTAINERS
  91. Makefile
  92. PREUPLOAD.cfg
  93. README
  94. verity_dev_keys.x509