1191 Commits

Author SHA1 Message Date
MarijnS95
deef0312bc msm: ipa3: Correct smallest ipa3_write string to 1
The smallest string that this function deals with is "1", which is of
size 1. Correct the if to allow this case.

Change-Id: Iaa68bcc452a3428d4752e5c34c98d0bd2e926c5a
Signed-off-by: MarijnS95 <marijns95@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-12-31 01:58:11 -03:00
Angelo G. Del Regno
adfe392f74 msm: ipa: Correctly allocate memory for copy_from_user
Copying from user to a global variable inside the driver is
unsafe and insecure: allocate and free the memory used for
copying from userspace in the functions doing it.

This also has the good side effect of solving a build failure
when the kernel is built with GCC >=4.9

Change-Id: I6c009b555f39d577bdb0321ca7c759bb1013824e
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-12-31 01:58:00 -03:00
Alexander Winkowski
ac5ab411b5 msm: ipa3: Enable threaded NAPI
Change-Id: I512afa97c7cc07a9200f0ba3265fc9b3fbca44cf
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-11-26 00:37:39 -03:00
Richard Raya
dfbceda834 Revert "msm: ipa: Use detach/attach netif instead of stop/wakeup"
This reverts commit 47faa7fb96296181e7b94b3939424914cfca6646.

Change-Id: Ic8c9048217346c334279be9001fc54186a29a13c
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-10-10 11:07:32 -03:00
Michael Adisumarta
47faa7fb96 msm: ipa: Use detach/attach netif instead of stop/wakeup
To make sure detach and attach netif instead of stop
and wakeup and also to update transfer timer update.

Change-Id: I9d589b7f9f6fe98f778df509d3c16f339dfdeea1
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-06-04 21:02:05 -03:00
Richard Raya
f800e21baa msm-4.14: Fix warnings treewide
Change-Id: Id7bf6d0a172834c0bed2857e776944707377d271
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-05-21 19:08:24 -03:00
Kazuki Hashimoto
00f29d45d1 msm: ipa_v3: Fix ridiculous strnlen usage
Classic CAF.

Change-Id: I07016302502ce5ac406198b922888417c815b83a
Signed-off-by: Kazuki Hashimoto <kaz205@tuta.io>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
2024-05-21 19:08:17 -03:00
Richard Raya
79840c9d70 Merge tag 'LA.UM.9.1.r1-14600-SMxxx0.QSSI14.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14
"LA.UM.9.1.r1-14600-SMxxx0.QSSI14.0"

* tag 'LA.UM.9.1.r1-14600-SMxxx0.QSSI14.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14: (103 commits)
  msm: npu: Fix use after free issue
  iommu: Fix missing return check of arm_lpae_init_pte
  msm: kgsl: Prevent wrap around during user address mapping
  iommu: Fix missing return check of arm_lpae_init_pte
  UPSTREAM: security: selinux: allow per-file labeling for bpffs
  UPSTREAM: security: selinux: allow per-file labeling for bpffs
  arm: configs: Enable QCOM_SHOW_RESUME_IRQ module for mdm9607
  Revert "irqchip/gic-v2: implement suspend and resume"
  exec: Force single empty string when argv is empty
  bus: mhi: misc: Add check for dev_rp if it is iommu range or not
  BACKPORT: FROMLIST: mm: protect free_pgtables with mmap_lock write lock in exit_mmap
  bus: mhi: misc: Add check for dev_rp if it is iommu range or not
  mdm: dataipa: increase the size of prefetch buffer
  msm: ais: core: validation of session/device/link handle
  soc: qcom: minidump: check the size parameter passed to qcom_smem_get()
  msm: camera: core: validation of session/device/link handle
  qcedev: vote for crypto clocks during module close
  msm: ais: smmu: Use get_file to increase ref count
  pinctrl: qcom: Using readl_relaxed/writel_relaxed APIs
  net: qrtr: Add bounds check in rx path
  ...

Change-Id: Ia2603d18afb240a1fcdce609944dd4038c988dbf
2023-12-07 20:11:49 -03:00
Fakruddin Vohra
dce12613d7 mdm: dataipa: increase the size of prefetch buffer
prefetch buffer is updated from 128 to 256 byte for route
and filter rule read.

Change-Id: Ibddddfda355e8032d6ec40da73394037534d1d78
Signed-off-by: Fakruddin Vohra <quic_fakruddi@quicinc.com>
2023-08-07 01:05:13 -07:00
azrim
0b573cd72d
Merge tag 'LA.UM.9.1.r1-12200-SMxxx0.QSSI13.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14 into richelieu
"LA.UM.9.1.r1-12200-SMxxx0.QSSI13.0"

* tag 'LA.UM.9.1.r1-12200-SMxxx0.QSSI13.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14:
  smcinvoke : file private data validation, which is sent by userspace
  input: touchscreen: focaltech: queue touch suspend work on workqueue
  input: touchscreen: focaltech: fix return value
  haven: irq_lend: add support for IRQ notifications
  haven: Add support for the MEM_ACCEPTED notification
  msm: ADSPRPC: Restrict untrusted applications from attaching to GuestOS
  msm: vidc: fix msm_comm_get_vidc_buffer fd race issue
  msm: ipa: clear the ipa pipeline before any ep config
2022-08-25 14:53:06 +00:00
Ashok Vuyyuru
79102280fa
msm: ipa3: Fix to avoid gsi/sys len stats mismatch
In suspend just before stopping the channel possible to receive
the IEOB interrupt and xfer pointer will not be processed in this
mode but gsi stats are updated.  In resume after starting the channel
will receive the IEOB interrupt and xfer pointer will be overwritten
because of this observing the gsi/sys len stats are not matching and
buffers won't be replinished properly leading to HW stall.
To avoid this process all data in polling context, gsi/sys len
stats are updated properly.

Bug: 158990845
Test: 1.build pass and can boot to home
      2.Mobile data,VoLTE,WFC,MMS,MHS

Change-Id: Id665448165b6aa51b251cddd72573c6df64ee541
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-08-25 14:48:20 +00:00
azrim
602d801a9b
Merge tag 'LA.UM.9.1.r1-12100-SMxxx0.QSSI12.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14 into richelieu
"LA.UM.9.1.r1-12100-SMxxx0.QSSI12.0"

* tag 'LA.UM.9.1.r1-12100-SMxxx0.QSSI12.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.14:
  FROMGIT: cgroup: Use separate src/dst nodes when preloading css_sets for migration
  input: touchscreen: focaltech: Add trusted touch support
  input: touchscreen: focaltech_touch: support dynamic report rate
  input: touchscreen: focaltech_touch: Remove vfs_read()
  input: touchscreen: focaltech_touch: Configure power supply
  input: touchscreen: Enable new Focaltech touch driver
  ARM: dts: msm: Add support for facepay camera sensor on trinket
  msm: ipa: fix to NULL terminate the pointer
  input: touchscreen: Add new Focaltech touch driver
  ARM: dts: msm: Add support for HSUART for RS232 usecase
  msm: camera: Add page read support for EEPROM
  diag: Validate the dci client before sending dci packet
  ARM: dts: msm: changing sound card qcom  model
2022-07-26 12:18:35 +00:00
Kazuki Hashimoto
07e99197f6
ipa: Allocate page with __GFP_RETRY_MAYFAIL and __GFP_NOWARN
Taken from Google.

5c90cf2148

Signed-off-by: Kazuki Hashimoto <kazukih@tuta.io>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-07-26 07:19:51 +00:00
Michael Adisumarta
701e8496be msm: ipa: clear the ipa pipeline before any ep config
The packets on IPA RX pipe 0 are route back to IPA TX pipe 0
which is causing the IPA stall. This fix allows to clear ipa
pipeline for ep config such as set/reset DMA mode
for rmnet tethering config.

Change-Id: Idd923f67bebfbc0aed8afcd0ea94a175ff691395
Signed-off-by: Vinayaka B M <quic_vinaybm@quicinc.com>
2022-07-07 20:10:23 +05:30
Amir Levy
f8210cf554
msm: ipa: added likely/unlikely branch prediction to the lan dp
Added branch prediction in an effort to make
the data path more efficent.

Acked-by: Tal Gelbard <tgelbard@qti.qualcomm.com>
Change-Id: I3bd2157ee6c263d89de9425c7a0249370ab918fc
Signed-off-by: Amir Levy <alevy@codeaurora.org>
Signed-off-by: Andrzej Perczak <linux@andrzejperczak.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-06-30 14:12:58 +00:00
celtare21
5247018f03
rmnet_ipa: Fix netdev watchdog triggering on suspend
Sometimes remnet_ipa fails to suspend with the following trace:

NETDEV WATCHDOG: rmnet_ipa0 (): transmit queue 0 timed out

Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-06-30 14:12:31 +00:00
Prashanth Reddy Baddam
41049fa790 msm: ipa: fix to NULL terminate the pointer
Fix to NULL terminate the peers list ptr
after freeing it, to get rid of use after
free issue.

Change-Id: Ide9fde9e7648a7af561a5b0ae0fa085810e59ea6
Signed-off-by: Prashanth Reddy Baddam <quic_pbaddam@quicinc.com>
2022-06-16 03:41:05 -07:00
Vaisakh Murali
6dcb992b79
drivers: ipa_v3: Conditionally compile out ipa wakelock code
* This is spurious and does not get destroyed, which keeps this
  wakelock as pending. Remove this code to save power.

* To enable these wakelocks again, pass `-DIPA_WAKELOCKS` as a
  cflag.

Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-06-10 16:05:56 +07:00
Alex Naidis
bb87468a48
msm: ipa_v3: Mitigate usleep_range calls
Calling usleep_range with identical min and max values,
results in a delta of 0us.

This causes the issue that the scheduler gets no chance to re-use an already
scheduled interrupt for this wait which results in a negative performance
impact by adding uninterruptible sleep.

Fix the issue by allowing the delay to take 20% longer than requested.
This should be good enough for these cases.

Signed-off-by: Alex Naidis <alex.naidis@paranoidandroid.co>
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-06-10 16:05:09 +07:00
Sultan Alsawaf
25353ba8ea
msm: ipa3: Fix non-atomic read on atomic_t variable
Accessing an atomic variable without the atomic_*() helpers is illegal.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-05-03 06:11:16 +07:00
Sultan Alsawaf
df74fdf7d0
msm: ipa3: Fix format specifier warnings
Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-05-03 06:11:16 +07:00
Nauval Rizky
d5087944e9
msm: ipa3: Fix NAPI pool scheduling in process context
This mostly occurs after voting for clock synchronously :

[  151.601852] NOHZ: local_softirq_pending 08
[  151.601860] NOHZ: local_softirq_pending 08

To ensure that scheduling handled in a proper context, disable
bottom-halves while scheduling NAPI pool in the same way it was done at
commit 56ff8052b ("s390/qeth: invoke softirqs after napi_schedule()")

Signed-off-by: Nauval Rizky <enuma.alrizky@gmail.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-04-06 13:18:20 +07:00
Petri Gynther
b118cd1bd2 msm: cleanup: union gsi_evt_scratch
Remove __packed from the usage of union gsi_evt_scratch.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_evt_scratch {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: If3d0e1bc2674f01d5a9a02e73d33b28a648539bc
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 33c2fa85bdfd90436d4c975757eefc6706a785c5)
2022-03-15 19:48:30 +01:00
Petri Gynther
af5acd499c msm: cleanup: union gsi_wdi_channel_scratch3_reg
Remove __packed from the usage of union gsi_wdi_channel_scratch3_reg.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_wdi_channel_scratch3_reg {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: I70edc50fbbe4c004309f76c020ac4d77cad91aad
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 2871c785dd89dd0926d12a93161fca6e27a6cd2e)
2022-03-15 19:48:30 +01:00
neoyu
a80d5abf06 msm: cleanup: union gsi_channel_scratch
Remove __packed from the usage of union gsi_channel_scratch.
__packed is only needed in the union definition.

include/linux/msm_gsi.h:
union __packed gsi_channel_scratch {
    ...
}

Bug: 139442076
Bug: 139808631
Bug: 142366585
Change-Id: If59d3d217e6a4bae92b9931523e2f89a39a04be9
Signed-off-by: Petri Gynther <pgynther@google.com>
(cherry picked from commit 54ace836af62b9fc1edff9c3a436064e177fe2e4)
2022-03-15 19:48:29 +01:00
Himansu Nayak
5f9730fd1e msm: ipa3: Fix to validate the NAT table entries during NAT table init
During NAT table Initialization parameter pass from HLOS, if max/zero
table entries passed it was leading to out of bound read. Adding checks
to validate the table entries before passing to NAT table parameter.

Change-Id: Ie2b252ea18deed694c6f76a34955af604ffeb3f3
Signed-off-by: Himansu Nayak <quic_himansu@quicinc.com>
2022-01-25 00:13:05 -08:00
Ilia Lin
c15f420db9 ipa: Null persistent pointers after free
Assign NULL to pointers that may be used later
after calling kfree on them.

Change-Id: I3298eb484c92ee2373f0bc41aae8ae45fb373cf0
Signed-off-by: Ilia Lin <ilialin@codeaurora.org>
2021-11-17 03:43:49 -08:00
Jagadeesh Ponduru
42c4a0cc69 msm: ipa3: Fix to NULL terminate the header pointer in proc header table
While resetting the header rules if it finds invalid header ID it
will return before freeing proc header table it was leading to use
after free when accessing the header pointer from proc header table.
Adding changes to NULL terminating header pointer in proc header table
after header table deleted from the list.

Change-Id: If270d855d3907e61368336316161a250053e1e62
Signed-off-by: Jagadeesh Ponduru <jponduru@codeaurora.org>
2021-11-03 22:02:37 +05:30
Muralidharan M
92f57ef052 msm-ipa: fix use-after-free of rt_tbl
Fix use-after-free of rt_tbl in __ipa_del_flt_rule
by checking if the rt_tbl is already freed.

Change-Id: I09541f65f474dc42f262c603d99f6bbcbb0ce8ec
Signed-off-by: Muralidharan M <murm@codeaurora.org>
Signed-off-by: Marco Zhang <zhangx@codeaurora.org>
2021-10-20 08:42:03 +08:00
Sivakanth Vaka
dd4e62b37f msm: ipa: Add change to fix out of bound access issue
Non null terminated string from user space can cause out
of bound access issue. Hence added a NULL character
explicitly in dev name when received from user space.

Change-Id: I956b4cb2ceb1c3bac171e9f9e35929256c937948
Signed-off-by: Sivakanth Vaka <svaka@codeaurora.org>
Signed-off-by: Marco Zhang <zhangx@codeaurora.org>
2021-10-11 15:17:39 +08:00
qctecmdr
9ce5b14d5c Merge "msm: ipa3: Fix to avoid NULL pointer access" 2021-08-18 02:29:34 -07:00
Piyush Dhyani
8fe01a5437 msm: ipa3: Fix to prevent Integer Overflow
The value of `req->filter_spec_ex2_list_len`
is user input via ioctl and it's type is uint32,
so an integer overflow may occur. Which can result
in out of bound access in the following loop. Now
add changes to prevent Integer overflow.

Change-Id: Ia29b9ddc674e5dd3d5baf6623cf0a464c156d8f7
Signed-off-by: Piyush Dhyani <pdhyani@codeaurora.org>
2021-07-15 04:25:40 -07:00
qctecmdr
7393aa45de Merge "msm:ipa4: Fix race condition" 2021-07-13 13:59:43 -07:00
Raghavendar rao l
e76213ad76 msm:ipa4: Fix race condition
Add changes to fix race condition when freeing QMI
handles during SSR scenario.

Change-Id: Ie83f0386ea3bd9b40c4964327415421a144d4715
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
Signed-off-by: Raghavendar rao l <rlomte@codeaurora.org>
2021-07-13 10:41:29 +05:30
Raghavendar rao l
d61fdc998d msm: ipa3: Fix to avoid NULL pointer access
Adding changes to check ipa_q6_clnt pointer NULL or not
before accessing it.

Change-Id: I255dd021c9534fe6ca4d7b19c3b576a0d3c80c7d
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
Signed-off-by: Raghvaendar rao l <rlomte@codeaurora.org>
2021-07-12 13:52:35 +05:30
qctecmdr
1b577d4deb Merge "msm: ipa: fix to check for ECONNRESET" 2021-06-16 08:01:31 -07:00
Praveen Kurapati
7d249b536a msm: ipa: fix to check for ECONNRESET
ECONNRESET is returned if Q6 QMI service is down. Make changes to
check for ECONNRESET as well to detect SSR.

Change-Id: I9a88b816618558123b3623396f38dde010d62abd
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
2021-06-16 12:31:49 +05:30
raghavendar rao l
a338d17b7d msm: ipa3: Added pdn config type check
Added check to verify pdn config type
which may cause out-of-bounds read in wlan_msg_process.

Change-Id: Idce7cb966a5a1c33d4f6b040f4f9d2ec4fb203be
Signed-off-by: raghavendar rao l <rlomte@codeaurora.org>
2021-06-10 13:17:20 -07:00
qctecmdr
04aa64de9b Merge "msm: ipa: add check to see if pm client is not NULL" 2021-04-13 10:02:37 -07:00
Michael Adisumarta
f2b6dbf2d8 msm: ipa: Fix use-after-free in ipa3_alloc_counter_id
Make changes to memcopy before preload end.

Change-Id: 	Icc056a3bcd5b739b8165813202c87dd84e72c78a
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
2021-04-04 13:07:56 +05:30
Bojun Pan
d2eaa73c8a msm: ipa: correct the pointer in idr for FnR stats counter
The stats counter which saved in idr was some stack memory which
could be freed and cause memory corruption. The fix is to use
the memory allocated in heap instead.

Change-Id: Ie398b0271571fcff41cdb85de4d77d202b6552b5
Signed-off-by: Bojun Pan <bojunp@codeaurora.org>
2021-04-01 18:02:39 -07:00
Michael Adisumarta
8b52ab8426 msm: ipa: add check to see if pm client is not NULL
Add check to see if it is freed in pm deregister context
and trying to read again after free.

Change-Id: I764f012d0c7cd53f126aee221f7c1d6a914b7390
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
2021-04-01 18:01:30 -07:00
Piyush Dhyani
7c05ee6764 msm: ipa: Fix buffer overflow issue
Currently during IPA_IOC_GET_PHERIPHERAL_EP_INFO ioctl we are not
returning for the invalid values of max_ep_pairs and ep_pair_size,
which is resulting in call of functions with invalid parameters.
So now changing the control when we receive unexpected values.

Change-Id: Idc0a8986478ece5eaad2a31152c2a16cd758b612
Signed-off-by: Piyush Dhyani <pdhyani@codeaurora.org>
2020-12-14 05:31:28 -08:00
Praveen Kurapati
c4fd3519f3 msm: ipa3: Add check to validate rule_cnt
Add proper check to validate table rule count
which may lead to overflow error.

Change-Id: I9bdcafcaae4e4cff1b901929c8dc6ae804f85642
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
2020-12-01 18:34:55 -08:00
Akshay Pandit
372dbfa166 msm: ipa: Use pipe 6 & 18 for hastings on msmnile
Make change to use endpoint 6 & 18 for hastings WLAN2_CONS/PROD
on msmnile gvmq target.

Change-Id: I8e5a7711dccc53419e7a17851df7a878e2ef0063
Signed-off-by: Akshay Pandit <pandit@codeaurora.org>
2020-09-19 20:55:52 +05:30
qctecmdr
01e8388841 Merge "msm: ipa: disable status on ODL_DPL_CONS pipe above IPAv4.5 targets" 2020-09-15 19:51:18 -07:00
qctecmdr
42ab3fc2dc Merge "msm: ipa3: Fix to increase the inactivity timer" 2020-09-14 04:33:21 -07:00
qctecmdr
ade98cba6a Merge "ipa3: validate ipahal_ctx before use" 2020-09-09 00:10:34 -07:00
Ashok Vuyyuru
d102c2c11f msm: ipa3: Fix to increase the inactivity timer
In low latency ping scenario clock unvoting fastly due to this
ping RTT was increased. To avoid these scenario increased the
inactivity timer to 100msec.

Change-Id: I9b11e2adbe087aa67fa2e7ed751b190abb09d0ed
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
2020-09-08 15:11:39 +05:30
Ashok Vuyyuru
3a52242be6 msm: ipa: disable status on ODL_DPL_CONS pipe above IPAv4.5 targets
ADPLv3 targets do not require status to be enabled on ODL_DPL pipe.
Make changes to disable the status for targets with IPAv4.5 and above.

Change-Id: Ica07a25a01e742928d3ecb19a88b7ee2305235ae
Signed-off-by: Chaitanya Pratapa <cpratapa@codeaurora.org>
Signed-off-by: Ashok Vuyyuru <avuyyuru@codeaurora.org>
2020-09-08 02:38:55 -07:00