wil6210: fix potential out-of-bounds read
Subsystems (6)
Sasha Levin
maintainerPATCH 1/158 wil6210: fix potential out-of-bounds read
From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit bfabdd6997323adbedccb13a3fed1967fb8cf8f5 ]
Notice that *rc* can evaluate to up to 5, include/linux/netdevice.h:
enum gro_result {
GRO_MERGED,
GRO_MERGED_FREE,
GRO_HELD,
GRO_NORMAL,
GRO_DROP,
GRO_CONSUMED,
};
typedef enum gro_result gro_result_t;
In case *rc* evaluates to 5, we end up having an out-of-bounds read at drivers/net/wireless/ath/wil6210/txrx.c:821:
wil_dbg_txrx(wil, "Rx complete %d bytes => %s\n", len, gro_res_str[rc]);
Fix this by adding element "GRO_CONSUMED" to array gro_res_str.
Addresses-Coverity-ID: 1444666 ("Out-of-bounds read")
--- drivers/net/wireless/ath/wil6210/txrx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/wil6210/txrx.c +1 -0
@@ -736,6 +736,7 @@ void wil_netif_rx_any(struct sk_buff *skb, struct net_device *ndev) [GRO_HELD] = "GRO_HELD", [GRO_NORMAL] = "GRO_NORMAL", [GRO_DROP] = "GRO_DROP", + [GRO_CONSUMED ] ="GRO_CONSUMED" , }; wil->txrx_ops.get_netif_rx_params (skb, &cid, &security);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/158 ath10k: Do not send probe response template for mesh
From: Surabhi Vishnoi <[email protected]>
[ Upstream commit 97354f2c432788e3163134df6bb144f4b6289d87 ]
Currently mac80211 do not support probe response template for mesh point. When WMI_SERVICE_BEACON_OFFLOAD is enabled, host driver tries to configure probe response template for mesh, but it fails because the interface type is not NL80211_IFTYPE_AP but NL80211_IFTYPE_MESH_POINT.
To avoid this failure, skip sending probe response template to firmware for mesh point.
Tested HW: WCN3990/QCA6174/QCA9984
--- drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/mac.c +4 -0
@@ -1624,6 +1624,10 @@ static int ath10k_mac_setup_prb_tmpl(struct ath10k_vif *arvif)if (arvif->vdev_type !=WMI_VDEV_TYPE_AP )return 0 ; +/* For mesh, probe response and beacon share the same template */ +if (ieee80211_vif_is_mesh (vif)) +return 0 ; + prb =ieee80211_proberesp_get (hw, vif);if (!prb) {ath10k_warn (ar,"failed to get probe resp template from mac80211\n" );
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 3/158 ath9k: Check for errors when reading SREV register
In reply to Sasha LevinFrom: Tim Schumacher <[email protected]>
[ Upstream commit 2f90c7e5d09437a4d8d5546feaae9f1cf48cfbe1 ]
Right now, if an error is encountered during the SREV register read (i.e. an EIO in ath9k_regread()), that error code gets passed all the way to __ath9k_hw_init(), where it is visible during the "Chip rev not supported" message.
ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
ath: phy2: Mac Chip Rev 0x0f.3 is not supported by this driver
ath: phy2: Unable to initialize hardware; initialization status: -95
ath: phy2: Unable to initialize hardware; initialization status: -95
ath9k_htc: Failed to initialize the device
Check for -EIO explicitly in ath9k_hw_read_revisions() and return a boolean based on the success of the operation. Check for that in __ath9k_hw_init() and abort with a more debugging-friendly message if reading the revisions wasn't successful.
ath9k_htc 1-1.4:1.0: ath9k_htc: HTC initialized with 33 credits
ath: phy2: Failed to read SREV register
ath: phy2: Could not read hardware revision
ath: phy2: Unable to initialize hardware; initialization status: -95
ath: phy2: Unable to initialize hardware; initialization status: -95
ath9k_htc: Failed to initialize the device
This helps when debugging by directly showing the first point of failure and it could prevent possible errors if a 0x0f.3 revision is ever supported.
--- drivers/net/wireless/ath/ath9k/hw.c | 32 +++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/hw.c +23 -9
@@ -252,8 +252,9 @@ void ath9k_hw_get_channel_centers(struct ath_hw *ah,/* Chip Revisions */ /******************/ -static void ath9k_hw_read_revisions (struct ath_hw *ah) +static bool ath9k_hw_read_revisions (struct ath_hw *ah) { +u32 srev;u32 val;if (ah->get_mac_revision)
@@ -269,25 +270,33 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah) val =REG_READ (ah,AR_SREV ); ah->hw_version.macRev =MS (val,AR_SREV_REVISION2 ); } -return ; +return true;case AR9300_DEVID_AR9340 : ah->hw_version.macVersion =AR_SREV_VERSION_9340 ; -return ; +return true;case AR9300_DEVID_QCA955X : ah->hw_version.macVersion =AR_SREV_VERSION_9550 ; -return ; +return true;case AR9300_DEVID_AR953X : ah->hw_version.macVersion =AR_SREV_VERSION_9531 ; -return ; +return true;case AR9300_DEVID_QCA956X : ah->hw_version.macVersion =AR_SREV_VERSION_9561 ; -return ; +return true; } - val =REG_READ (ah,AR_SREV ) &AR_SREV_ID ; + srev =REG_READ (ah,AR_SREV ); + +if (srev == -EIO ) { +ath_err (ath9k_hw_common (ah), +"Failed to read SREV register" ); +return false; + } + + val = srev &AR_SREV_ID ;if (val ==0xFF ) { - val =REG_READ (ah,AR_SREV ); + val = srev; ah->hw_version.macVersion = (val &AR_SREV_VERSION2 ) >>AR_SREV_TYPE2_S ; ah->hw_version.macRev =MS (val,AR_SREV_REVISION2 );
@@ -306,6 +315,8 @@ static void ath9k_hw_read_revisions(struct ath_hw *ah)if (ah->hw_version.macVersion ==AR_SREV_VERSION_5416_PCIE ) ah->is_pciexpress = true; } + +return true; }/************************************/
@@ -559,7 +570,10 @@ static int __ath9k_hw_init(struct ath_hw *ah)struct ath_common *common =ath9k_hw_common (ah);int r =0 ; -ath9k_hw_read_revisions (ah); +if (!ath9k_hw_read_revisions (ah)) { +ath_err (common,"Could not read hardware revisions" ); +return -EOPNOTSUPP ; + }switch (ah->hw_version.macVersion) {case AR_SREV_VERSION_5416_PCI :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/158 ath6kl: add some bounds checking
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 5d6751eaff672ea77642e74e92e6c0ac7f9709ab ]
The "ev->traffic_class" and "reply->ac" variables come from the network and they're used as an offset into the wmi->stream_exist_for_ac[] array. Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[] array only has WMM_NUM_AC (4) elements. We need to add a couple bounds checks to prevent array overflows.
I also modified one existing check from "if (traffic_class > 3) {" to "if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent.
--- drivers/net/wireless/ath/ath6kl/wmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath6kl/wmi.c +9 -1
@@ -1178,6 +1178,10 @@ static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap,return -EINVAL ; ev = (struct wmi_pstream_timeout_event *) datap; +if (ev->traffic_class >=WMM_NUM_AC ) { +ath6kl_err ("invalid traffic class: %d\n" , ev->traffic_class); +return -EINVAL ; + }/* * When the pstream (fat pipe == AC) timesout, it means there were
@@ -1519,6 +1523,10 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len,return -EINVAL ; reply = (struct wmi_cac_event *) datap; +if (reply->ac >=WMM_NUM_AC ) { +ath6kl_err ("invalid AC: %d\n" , reply->ac); +return -EINVAL ; + }if ((reply->cac_indication ==CAC_INDICATION_ADMISSION_RESP ) && (reply->status_code !=IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED )) {
@@ -2635,7 +2643,7 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class,u16 active_tsids =0 ;int ret; -if (traffic_class >3 ) { +if (traffic_class >=WMM_NUM_AC ) {ath6kl_err ("invalid traffic class: %d\n" , traffic_class);return -EINVAL ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/158 ath10k: add peer id check in ath10k_peer_find_by_id
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 49ed34b835e231aa941257394716bc689bc98d9f ]
For some SDIO chip, the peer id is 65535 for MPDU with error status, then test_bit will trigger buffer overflow for peer's memory, if kasan enabled, it will report error.
Reason is when station is in disconnecting status, firmware do not delete the peer info since it not disconnected completely, meanwhile some AP will still send data packet to station, then hardware will receive the packet and send to firmware, firmware's logic will report peer id of 65535 for MPDU with error status.
Add check for overflow the size of peer's peer_ids will avoid the buffer overflow access.
Call trace of kasan:
dump_backtrace+0x0/0x2ec show_stack+0x20/0x2c __dump_stack+0x20/0x28 dump_stack+0xc8/0xec print_address_description+0x74/0x240 kasan_report+0x250/0x26c __asan_report_load8_noabort+0x20/0x2c ath10k_peer_find_by_id+0x180/0x1e4 [ath10k_core] ath10k_htt_t2h_msg_handler+0x100c/0x2fd4 [ath10k_core] ath10k_htt_htc_t2h_msg_handler+0x20/0x34 [ath10k_core] ath10k_sdio_irq_handler+0xcc8/0x1678 [ath10k_sdio] process_sdio_pending_irqs+0xec/0x370 sdio_run_irqs+0x68/0xe4 sdio_irq_work+0x1c/0x28 process_one_work+0x3d8/0x8b0 worker_thread+0x508/0x7cc kthread+0x24c/0x264 ret_from_fork+0x10/0x18
Tested with QCA6174 SDIO with firmware
WLAN.RMH.4.4.1-00007-QCARMSWP-1.
--- drivers/net/wireless/ath/ath10k/txrx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath10k/txrx.c +3 -0
@@ -156,6 +156,9 @@ struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar, int peer_id) {struct ath10k_peer *peer; +if (peer_id >=BITS_PER_TYPE (peer->peer_ids)) +return NULL ; +lockdep_assert_held (&ar->data_lock);list_for_each_entry (peer, &ar->peers, list)
Signature · 7 lines
2.20.1 _______________________________________________ ath10k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath10k
Sasha Levin
maintainerPATCH 6/158 x86/tsc: Use CPUID.0x16 to calculate missing crystal frequency
In reply to Sasha LevinFrom: Daniel Drake <[email protected]>
[ Upstream commit 604dc9170f2435d27da5039a3efd757dceadc684 ]
native_calibrate_tsc() had a data mapping Intel CPU families and crystal clock speed, but hardcoded tables are not ideal, and this approach was already problematic at least in the Skylake X case, as seen in commit:
b51120309348 ("x86/tsc: Fix erroneous TSC rate on Skylake Xeon")
By examining CPUID data from http://instlatx64.atw.hu/ and units in the lab, we have found that 3 different scenarios need to be dealt with, and we can eliminate most of the hardcoded data using an approach a little more advanced than before:
1. ApolloLake, GeminiLake, CannonLake (and presumably all new chipsets from this point) report the crystal frequency directly via CPUID.0x15. That's definitive data that we can rely upon.
2. Skylake, Kabylake and all variants of those two chipsets report a crystal frequency of zero, however we can calculate the crystal clock speed by condidering data from CPUID.0x16.
This method correctly distinguishes between the two crystal clock frequencies present on different Skylake X variants that caused headaches before.
As the calculations do not quite match the previously-hardcoded values in some cases (e.g. 23913043Hz instead of 24MHz), TSC refinement is enabled on all platforms where we had to calculate the crystal frequency in this way.
3. Denverton (GOLDMONT_X) reports a crystal frequency of zero and does
not support CPUID.0x16, so we leave this entry hardcoded.
--- arch/x86/kernel/tsc.c | 47 +++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 20 deletions(-)
arch/x86/kernel/tsc.c +27 -20
@@ -628,31 +628,38 @@ unsigned long native_calibrate_tsc(void) crystal_khz = ecx_hz /1000 ; -if (crystal_khz ==0 ) { -switch (boot_cpu_data.x86_model) { -case INTEL_FAM6_SKYLAKE_MOBILE : -case INTEL_FAM6_SKYLAKE_DESKTOP : -case INTEL_FAM6_KABYLAKE_MOBILE : -case INTEL_FAM6_KABYLAKE_DESKTOP : - crystal_khz =24000 ;/* 24.0 MHz */ -break ; -case INTEL_FAM6_ATOM_GOLDMONT_X : - crystal_khz =25000 ;/* 25.0 MHz */ -break ; -case INTEL_FAM6_ATOM_GOLDMONT : - crystal_khz =19200 ;/* 19.2 MHz */ -break ; - } - } +/* +* Denverton SoCs don't report crystal clock, and also don't support +* CPUID.0x16 for the calculation below, so hardcode the 25MHz crystal +* clock. +*/ +if (crystal_khz ==0 && + boot_cpu_data.x86_model ==INTEL_FAM6_ATOM_GOLDMONT_X ) + crystal_khz =25000 ; -if (crystal_khz ==0 ) -return 0 ;/* -* TSC frequency determined by CPUID is a "hardware reported" +* TSC frequency reported directly by CPUID is a "hardware reported" * frequency and is the most accurate one so far we have. This * is considered a known frequency. */ -setup_force_cpu_cap (X86_FEATURE_TSC_KNOWN_FREQ ); +if (crystal_khz !=0 ) +setup_force_cpu_cap (X86_FEATURE_TSC_KNOWN_FREQ ); + +/* +* Some Intel SoCs like Skylake and Kabylake don't report the crystal +* clock, but we can easily calculate it to a high degree of accuracy +* by considering the crystal ratio and the CPU speed. +*/ +if (crystal_khz ==0 && boot_cpu_data.cpuid_level >=0x16 ) { +unsigned int eax_base_mhz, ebx, ecx, edx; + +cpuid (0x16 , &eax_base_mhz, &ebx, &ecx, &edx); + crystal_khz = eax_base_mhz *1000 * + eax_denominator / ebx_numerator; + } + +if (crystal_khz ==0 ) +return 0 ;/* * For Atom SoCs TSC is the only reliable clocksource.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/158 wil6210: fix spurious interrupts in 3-msi
In reply to Sasha LevinFrom: Maya Erez <[email protected]>
[ Upstream commit e10b0eddd5235aa5aef4e40b970e34e735611a80 ]
Interrupt is set in ICM (ICR & ~IMV) rising trigger. As the driver masks the IRQ after clearing it, there can be a race where an additional spurious interrupt is triggered when the driver unmask the IRQ.
This can happen in case HW triggers an interrupt after the clear and before the mask.
To prevent the second spurious interrupt the driver needs to mask the IRQ before reading and clearing it.
--- drivers/net/wireless/ath/wil6210/interrupt.c | 65 ++++++++++++-------- 1 file changed, 40 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/wil6210/interrupt.c +40 -25
@@ -296,21 +296,24 @@ void wil_configure_interrupt_moderation(struct wil6210_priv *wil)static irqreturn_t wil6210_irq_rx (int irq,void *cookie) {struct wil6210_priv *wil = cookie; -u32 isr =wil_ioread32_and_clear (wil->csr + -HOSTADDR (RGF_DMA_EP_RX_ICR ) + - offsetof(struct RGF_ICR , ICR)); +u32 isr;bool need_unmask = true; +wil6210_mask_irq_rx (wil); + + isr =wil_ioread32_and_clear (wil->csr + +HOSTADDR (RGF_DMA_EP_RX_ICR ) + + offsetof(struct RGF_ICR , ICR)); +trace_wil6210_irq_rx (isr);wil_dbg_irq (wil,"ISR RX 0x%08x\n" , isr);if (unlikely (!isr)) {wil_err_ratelimited (wil,"spurious IRQ: RX\n" ); +wil6210_unmask_irq_rx (wil);return IRQ_NONE ; } -wil6210_mask_irq_rx (wil); -/* RX_DONE and RX_HTRSH interrupts are the same if interrupt * moderation is not used. Interrupt moderation may cause RX * buffer overflow while RX_DONE is delayed. The required
@@ -355,21 +358,24 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)static irqreturn_t wil6210_irq_rx_edma (int irq,void *cookie) {struct wil6210_priv *wil = cookie; -u32 isr =wil_ioread32_and_clear (wil->csr + -HOSTADDR (RGF_INT_GEN_RX_ICR ) + - offsetof(struct RGF_ICR , ICR)); +u32 isr;bool need_unmask = true; +wil6210_mask_irq_rx_edma (wil); + + isr =wil_ioread32_and_clear (wil->csr + +HOSTADDR (RGF_INT_GEN_RX_ICR ) + + offsetof(struct RGF_ICR , ICR)); +trace_wil6210_irq_rx (isr);wil_dbg_irq (wil,"ISR RX 0x%08x\n" , isr);if (unlikely (!isr)) {wil_err (wil,"spurious IRQ: RX\n" ); +wil6210_unmask_irq_rx_edma (wil);return IRQ_NONE ; } -wil6210_mask_irq_rx_edma (wil); -if (likely (isr &BIT_RX_STATUS_IRQ )) {wil_dbg_irq (wil,"RX status ring\n" ); isr &= ~BIT_RX_STATUS_IRQ ;
@@ -403,21 +409,24 @@ static irqreturn_t wil6210_irq_rx_edma(int irq, void *cookie)static irqreturn_t wil6210_irq_tx_edma (int irq,void *cookie) {struct wil6210_priv *wil = cookie; -u32 isr =wil_ioread32_and_clear (wil->csr + -HOSTADDR (RGF_INT_GEN_TX_ICR ) + - offsetof(struct RGF_ICR , ICR)); +u32 isr;bool need_unmask = true; +wil6210_mask_irq_tx_edma (wil); + + isr =wil_ioread32_and_clear (wil->csr + +HOSTADDR (RGF_INT_GEN_TX_ICR ) + + offsetof(struct RGF_ICR , ICR)); +trace_wil6210_irq_tx (isr);wil_dbg_irq (wil,"ISR TX 0x%08x\n" , isr);if (unlikely (!isr)) {wil_err (wil,"spurious IRQ: TX\n" ); +wil6210_unmask_irq_tx_edma (wil);return IRQ_NONE ; } -wil6210_mask_irq_tx_edma (wil); -if (likely (isr &BIT_TX_STATUS_IRQ )) {wil_dbg_irq (wil,"TX status ring\n" ); isr &= ~BIT_TX_STATUS_IRQ ;
@@ -446,21 +455,24 @@ static irqreturn_t wil6210_irq_tx_edma(int irq, void *cookie)static irqreturn_t wil6210_irq_tx (int irq,void *cookie) {struct wil6210_priv *wil = cookie; -u32 isr =wil_ioread32_and_clear (wil->csr + -HOSTADDR (RGF_DMA_EP_TX_ICR ) + - offsetof(struct RGF_ICR , ICR)); +u32 isr;bool need_unmask = true; +wil6210_mask_irq_tx (wil); + + isr =wil_ioread32_and_clear (wil->csr + +HOSTADDR (RGF_DMA_EP_TX_ICR ) + + offsetof(struct RGF_ICR , ICR)); +trace_wil6210_irq_tx (isr);wil_dbg_irq (wil,"ISR TX 0x%08x\n" , isr);if (unlikely (!isr)) {wil_err_ratelimited (wil,"spurious IRQ: TX\n" ); +wil6210_unmask_irq_tx (wil);return IRQ_NONE ; } -wil6210_mask_irq_tx (wil); -if (likely (isr &BIT_DMA_EP_TX_ICR_TX_DONE )) {wil_dbg_irq (wil,"TX done\n" ); isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE ;
@@ -532,20 +544,23 @@ static bool wil_validate_mbox_regs(struct wil6210_priv *wil)static irqreturn_t wil6210_irq_misc (int irq,void *cookie) {struct wil6210_priv *wil = cookie; -u32 isr =wil_ioread32_and_clear (wil->csr + -HOSTADDR (RGF_DMA_EP_MISC_ICR ) + - offsetof(struct RGF_ICR , ICR)); +u32 isr; + +wil6210_mask_irq_misc (wil, false); + + isr =wil_ioread32_and_clear (wil->csr + +HOSTADDR (RGF_DMA_EP_MISC_ICR ) + + offsetof(struct RGF_ICR , ICR));trace_wil6210_irq_misc (isr);wil_dbg_irq (wil,"ISR MISC 0x%08x\n" , isr);if (!isr) {wil_err (wil,"spurious IRQ: MISC\n" ); +wil6210_unmask_irq_misc (wil, false);return IRQ_NONE ; } -wil6210_mask_irq_misc (wil, false); -if (isr &ISR_MISC_FW_ERROR ) {u32 fw_assert_code =wil_r (wil, wil->rgf_fw_assert_code_addr); u32 ucode_assert_code =
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/158 ath: DFS JP domain W56 fixed pulse type 3 RADAR detection
In reply to Sasha LevinFrom: Anilkumar Kolli <[email protected]>
[ Upstream commit d8792393a783158cbb2c39939cb897dc5e5299b6 ]
Increase pulse width range from 1-2usec to 0-4usec.
During data traffic HW occasionally fails detecting radar pulses, so that SW cannot get enough radar reports to achieve the success rate.
Tested ath10k hw and fw:
* QCA9888(10.4-3.5.1-00052)
* QCA4019(10.4-3.2.1.1-00017)
* QCA9984(10.4-3.6-00104)
* QCA988X(10.2.4-1.0-00041)
Tested ath9k hw: AR9300
--- drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/dfs_pattern_detector.c +1 -1
@@ -111,7 +111,7 @@ static const struct radar_detector_specs jp_radar_ref_types[] = {JP_PATTERN (0 ,0 ,1 ,1428 ,1428 ,1 ,18 ,29 , false),JP_PATTERN (1 ,2 ,3 ,3846 ,3846 ,1 ,18 ,29 , false),JP_PATTERN (2 ,0 ,1 ,1388 ,1388 ,1 ,18 ,50 , false), -JP_PATTERN (3 ,1 ,2 ,4000 ,4000 ,1 ,18 ,50 , false), +JP_PATTERN (3 ,0 ,4 ,4000 ,4000 ,1 ,18 ,50 , false),JP_PATTERN (4 ,0 ,5 ,150 ,230 ,1 ,23 ,50 , false),JP_PATTERN (5 ,6 ,10 ,200 ,500 ,1 ,16 ,50 , false), JP_PATTERN(6, 11, 20, 200, 500, 1, 12, 50, false),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/158 regmap: debugfs: Fix memory leak in regmap_debugfs_init
In reply to Sasha LevinFrom: Daniel Baluta <[email protected]>
[ Upstream commit 2899872b627e99b7586fe3b6c9f861da1b4d5072 ]
As detected by kmemleak running on i.MX6ULL board:
nreferenced object 0xd8366600 (size 64):
comm "swapper/0", pid 1, jiffies 4294937370 (age 933.220s) hex dump (first 32 bytes):
64 75 6d 6d 79 2d 69 6f 6d 75 78 63 2d 67 70 72 dummy-iomuxc-gpr
40 32 30 65 34 30 30 30 00 e3 f3 ab fe d1 1b dd @20e4000........
backtrace:
[<b0402aec>] kasprintf+0x2c/0x54
[<a6fbad2c>] regmap_debugfs_init+0x7c/0x31c
[<9c8d91fa>] __regmap_init+0xb5c/0xcf4
[<5b1c3d2a>] of_syscon_register+0x164/0x2c4
[<596a5d80>] syscon_node_to_regmap+0x64/0x90
[<49bd597b>] imx6ul_init_machine+0x34/0xa0
[<250a4dac>] customize_machine+0x1c/0x30
[<2d19fdaf>] do_one_initcall+0x7c/0x398
[<e6084469>] kernel_init_freeable+0x328/0x448
[<168c9101>] kernel_init+0x8/0x114
[<913268aa>] ret_from_fork+0x14/0x20
[<ce7b131a>] 0x0Root cause is that map->debugfs_name is allocated using kasprintf and then the pointer is lost by assigning it other memory address.
--- drivers/base/regmap/regmap-debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/regmap/regmap-debugfs.c +2 -0
@@ -575,6 +575,8 @@ void regmap_debugfs_init(struct regmap *map, const char *name) }if (!strcmp (name,"dummy" )) { +kfree (map->debugfs_name); + map->debugfs_name =kasprintf (GFP_KERNEL ,"dummy%d" , dummy_index); name = map->debugfs_name;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/158 batman-adv: fix for leaked TVLV handler.
In reply to Sasha LevinFrom: Jeremy Sowden <[email protected]>
[ Upstream commit 17f78dd1bd624a4dd78ed5db3284a63ee807fcc3 ]
A handler for BATADV_TVLV_ROAM was being registered when the translation-table was initialized, but not unregistered when the translation-table was freed. Unregister it.
--- net/batman-adv/translation-table.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/translation-table.c +2 -0
@@ -3821,6 +3821,8 @@ static void batadv_tt_purge(struct work_struct *work)*/ void batadv_tt_free (struct batadv_priv *bat_priv) { +batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_ROAM ,1 ); +batadv_tvlv_container_unregister (bat_priv,BATADV_TVLV_TT ,1 );batadv_tvlv_handler_unregister (bat_priv,BATADV_TVLV_TT ,1 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/158 media: dvb: usb: fix use after free in dvb_usb_device_exit
In reply to Sasha LevinFrom: Oliver Neukum <[email protected]>
[ Upstream commit 6cf97230cd5f36b7665099083272595c55d72be7 ]
dvb_usb_device_exit() frees and uses the device name in that order. Fix by storing the name in a buffer before freeing it.
--- drivers/media/usb/dvb-usb/dvb-usb-init.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/dvb-usb-init.c +5 -2
@@ -287,12 +287,15 @@ EXPORT_SYMBOL(dvb_usb_device_init);void dvb_usb_device_exit (struct usb_interface *intf) {struct dvb_usb_device *d =usb_get_intfdata (intf); -const char *name ="generic DVB-USB module" ; +const char *default_name ="generic DVB-USB module" ; +char name[40 ];usb_set_intfdata (intf,NULL );if (d !=NULL && d->desc !=NULL ) { - name = d->desc->name; +strscpy (name, d->desc->name,sizeof (name));dvb_usb_exit (d); + }else { +strscpy (name, default_name,sizeof (name)); }info ("%s successfully deinitialized and disconnected." , name);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/158 media: spi: IR LED: add missing of table registration
In reply to Sasha LevinFrom: Daniel Gomez <[email protected]>
[ Upstream commit 24e4cf770371df6ad49ed873f21618d9878f64c8 ]
MODULE_DEVICE_TABLE(of, <of_match_table> should be called to complete DT OF mathing mechanism and register it.
Before this patch:
modinfo drivers/media/rc/ir-spi.ko | grep alias
After this patch:
modinfo drivers/media/rc/ir-spi.ko | grep alias
alias: of:N*T*Cir-spi-ledC* alias: of:N*T*Cir-spi-led
--- drivers/media/rc/ir-spi.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/rc/ir-spi.c +1 -0
@@ -161,6 +161,7 @@ static const struct of_device_id ir_spi_of_match[] = { { .compatible = "ir-spi-led" }, {}, }; +MODULE_DEVICE_TABLE (of, ir_spi_of_match);static struct spi_driver ir_spi_driver = { .probe = ir_spi_probe,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/158 crypto: talitos - fix skcipher failure due to wrong output IV
In reply to Sasha LevinFrom: Christophe Leroy <[email protected]>
[ Upstream commit 3e03e792865ae48b8cfc69a0b4d65f02f467389f ]
Selftests report the following:
[ 2.984845] alg: skcipher: cbc-aes-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 2.995377] 00000000: 3d af ba 42 9d 9e b4 30 b4 22 da 80 2c 9f ac 41 [ 3.032673] alg: skcipher: cbc-des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.043185] 00000000: fe dc ba 98 76 54 32 10 [ 3.063238] alg: skcipher: cbc-3des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.073818] 00000000: 7d 33 88 93 0f 93 b2 42
This above dumps show that the actual output IV is indeed the input IV. This is due to the IV not being copied back into the request.
This patch fixes that.
--- drivers/crypto/talitos.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/crypto/talitos.c +4 -0
@@ -1571,11 +1571,15 @@ static void ablkcipher_done(struct device *dev, int err) {struct ablkcipher_request *areq = context; +struct crypto_ablkcipher *cipher =crypto_ablkcipher_reqtfm (areq); +struct talitos_ctx *ctx =crypto_ablkcipher_ctx (cipher); +unsigned int ivsize =crypto_ablkcipher_ivsize (cipher);struct talitos_edesc *edesc; edesc = container_of(desc, struct talitos_edesc, desc);common_nonsnoop_unmap (dev, edesc, areq); +memcpy (areq->info, ctx->iv, ivsize);kfree (edesc);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/158 media: ov7740: avoid invalid framesize setting
In reply to Sasha LevinFrom: Akinobu Mita <[email protected]>
[ Upstream commit 6e4ab830ac6d6a0d7cd7f87dc5d6536369bf24a8 ]
If the requested framesize by VIDIOC_SUBDEV_S_FMT is larger than supported framesizes, it causes an out of bounds array access and the resulting framesize is unexpected.
Avoid out of bounds array access and select the default framesize.
--- drivers/media/i2c/ov7740.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/i2c/ov7740.c +5 -1
@@ -761,7 +761,11 @@ static int ov7740_try_fmt_internal(struct v4l2_subdev *sd, fsize++; } - +if (i >=ARRAY_SIZE (ov7740_framesizes)) { + fsize = &ov7740_framesizes[0 ]; + fmt->width = fsize->width; + fmt->height = fsize->height; + }if (ret_frmsize !=NULL ) *ret_frmsize = fsize;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/158 media: marvell-ccic: fix DMA s/g desc number calculation
In reply to Sasha LevinFrom: Lubomir Rintel <[email protected]>
[ Upstream commit 0c7aa32966dab0b8a7424e1b34c7f206817953ec ]
The commit d790b7eda953 ("[media] vb2-dma-sg: move dma_(un)map_sg here") left dma_desc_nent unset. It previously contained the number of DMA descriptors as returned from dma_map_sg().
We can now (since the commit referred to above) obtain the same value from the sg_table and drop dma_desc_nent altogether.
Tested on OLPC XO-1.75 machine. Doesn't affect the OLPC XO-1's Cafe driver, since that one doesn't do DMA.
[[email protected]: fix a checkpatch warning]
--- drivers/media/platform/marvell-ccic/mcam-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/marvell-ccic/mcam-core.c +3 -2
@@ -200,7 +200,6 @@ struct mcam_vb_buffer {struct list_head queue;struct mcam_dma_desc *dma_desc;/* Descriptor virtual address */ dma_addr_t dma_desc_pa;/* Descriptor physical address */ -int dma_desc_nent;/* Number of mapped descriptors */ };static inline struct mcam_vb_buffer *vb_to_mvb (struct vb2_v4l2_buffer *vb)
@@ -608,9 +607,11 @@ static void mcam_dma_contig_done(struct mcam_camera *cam, int frame)static void mcam_sg_next_buffer (struct mcam_camera *cam) {struct mcam_vb_buffer *buf; +struct sg_table *sg_table; buf = list_first_entry(&cam->buffers, struct mcam_vb_buffer, queue);list_del_init (&buf->queue); + sg_table =vb2_dma_sg_plane_desc (&buf->vb_buf.vb2_buf,0 );/* * Very Bad Not Good Things happen if you don't clear * C1_DESC_ENA before making any descriptor changes.
@@ -618,7 +619,7 @@ static void mcam_sg_next_buffer(struct mcam_camera *cam)mcam_reg_clear_bit (cam,REG_CTRL1 ,C1_DESC_ENA );mcam_reg_write (cam,REG_DMA_DESC_Y , buf->dma_desc_pa);mcam_reg_write (cam,REG_DESC_LEN_Y , - buf->dma_desc_nent*sizeof (struct mcam_dma_desc )); + sg_table->nents *sizeof (struct mcam_dma_desc ));mcam_reg_write (cam,REG_DESC_LEN_U ,0 );mcam_reg_write (cam,REG_DESC_LEN_V ,0 );mcam_reg_set_bit (cam,REG_CTRL1 ,C1_DESC_ENA );
Signature · 1 line
2.20.1