[PATCH] block: xen-blkfront: Fix possible NULL ptr dereference
In the blkif_release function the bdget_disk() call might returns a NULL ptr which might be dereferenced on bdev->bd_openers checking Signed-off-by: Felipe Pena --- drivers/block/xen-blkfront.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index a4660bb..7bb1552 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1959,6 +1959,9 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) bdev = bdget_disk(disk, 0); + if (!bdev) + goto out_mutex; + if (bdev->bd_openers) goto out; @@ -1989,6 +1992,7 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) out: bdput(bdev); +out_mutex: mutex_unlock(_mutex); } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] block: xen-blkfront: Fix possible NULL ptr dereference
In the blkif_release function the bdget_disk() call might returns a NULL ptr which might be dereferenced on bdev-bd_openers checking Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/block/xen-blkfront.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index a4660bb..7bb1552 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1959,6 +1959,9 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) bdev = bdget_disk(disk, 0); + if (!bdev) + goto out_mutex; + if (bdev-bd_openers) goto out; @@ -1989,6 +1992,7 @@ static void blkif_release(struct gendisk *disk, fmode_t mode) out: bdput(bdev); +out_mutex: mutex_unlock(blkfront_mutex); } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ 3/7] ext4: fix memory leak in xattr
Hi, On Fri, Oct 18, 2013 at 4:52 PM, Greg Kroah-Hartman wrote: > 3.0-stable review patch. If anyone has any objections, please let me know. > > -- > > From: Dave Jones > > commit 6e4ea8e33b2057b85d75175dd89b93f5e26de3bc upstream. > > If we take the 2nd retry path in ext4_expand_extra_isize_ea, we > potentionally return from the function without having freed these > allocations. If we don't do the return, we over-write the previous > allocation pointers, so we leak either way. > > Spotted with Coverity. > > [ Fixed by tytso to set is and bs to NULL after freeing these > pointers, in case in the retry loop we later end up triggering an > error causing a jump to cleanup, at which point we could have a double > free bug. -- Ted ] > > Signed-off-by: Dave Jones > Signed-off-by: "Theodore Ts'o" > Reviewed-by: Eric Sandeen > Signed-off-by: Greg Kroah-Hartman > > --- > fs/ext4/xattr.c |2 ++ > 1 file changed, 2 insertions(+) > > --- a/fs/ext4/xattr.c > +++ b/fs/ext4/xattr.c > @@ -1271,6 +1271,8 @@ retry: > s_min_extra_isize) { > tried_min_extra_isize++; > new_extra_isize = s_min_extra_isize; > + kfree(is); is = NULL; > + kfree(bs); bs = NULL; Looks like such lines are not conforming to coding style, or? > goto retry; > } > error = -1; > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [ 3/7] ext4: fix memory leak in xattr
Hi, On Fri, Oct 18, 2013 at 4:52 PM, Greg Kroah-Hartman gre...@linuxfoundation.org wrote: 3.0-stable review patch. If anyone has any objections, please let me know. -- From: Dave Jones da...@redhat.com commit 6e4ea8e33b2057b85d75175dd89b93f5e26de3bc upstream. If we take the 2nd retry path in ext4_expand_extra_isize_ea, we potentionally return from the function without having freed these allocations. If we don't do the return, we over-write the previous allocation pointers, so we leak either way. Spotted with Coverity. [ Fixed by tytso to set is and bs to NULL after freeing these pointers, in case in the retry loop we later end up triggering an error causing a jump to cleanup, at which point we could have a double free bug. -- Ted ] Signed-off-by: Dave Jones da...@fedoraproject.org Signed-off-by: Theodore Ts'o ty...@mit.edu Reviewed-by: Eric Sandeen sand...@redhat.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org --- fs/ext4/xattr.c |2 ++ 1 file changed, 2 insertions(+) --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1271,6 +1271,8 @@ retry: s_min_extra_isize) { tried_min_extra_isize++; new_extra_isize = s_min_extra_isize; + kfree(is); is = NULL; + kfree(bs); bs = NULL; Looks like such lines are not conforming to coding style, or? goto retry; } error = -1; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] rtlwifi: rtl8192se: Fix wrong assignment
There is a typo in the struct member name on assignment when checking rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40 for bound limit and uses pwrgroup_ht20 when assigning instead. Signed-off-by: Felipe Pena --- drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 5061f1d..92d38ab 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, rtlefuse->pwrgroup_ht40 [RF90_PATH_A][chnl - 1]) { pwrdiff_limit[i] = - rtlefuse->pwrgroup_ht20 + rtlefuse->pwrgroup_ht40 [RF90_PATH_A][chnl - 1]; } } else { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] wireless: rt2800lib: Fix typo on checking
On rt2800_config_channel_rf53xx function the member default_power1 is checked for bound limit, but default_power2 is used instead. Signed-off-by: Felipe Pena --- drivers/net/wireless/rt2x00/rt2800lib.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 88ce656..1c2ce93 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -2650,7 +2650,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, if (rt2x00_rt(rt2x00dev, RT5392)) { rt2800_rfcsr_read(rt2x00dev, 50, ); - if (info->default_power1 > POWER_BOUND) + if (info->default_power2 > POWER_BOUND) rt2x00_set_field8(, RFCSR50_TX, POWER_BOUND); else rt2x00_set_field8(, RFCSR50_TX, -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: scsi: lpfc_debugfs: Fix wrong assignment
On lpfc_debugfs_initialize function the dumpHostSlim member setup happens when 'phba->sli_rev < LPFC_SLI_REV4' is true, however when it is false NULL has been assigned to debug_dumpHBASlim instead of debug_dumpHostSlim. Signed-off-by: Felipe Pena --- drivers/scsi/lpfc/lpfc_debugfs.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 60084e6..b800cc9 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -4001,7 +4001,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; } } else - phba->debug_dumpHBASlim = NULL; + phba->debug_dumpHostSlim = NULL; /* Setup dumpData */ snprintf(name, sizeof(name), "dumpData"); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] drivers: net: wireless: rtlwifi: Fix wrong assignment
On Fri, Oct 18, 2013 at 7:27 PM, Larry Finger wrote: > On 10/18/2013 05:15 PM, Felipe Pena wrote: >> >> There is a typo in the struct member name on assignment when checking >> rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses >> pwrgroup_ht40 >> for bound limit and uses pwrgroup_ht20 when assigning instead. >> >> Signed-off-by: Felipe Pena >> --- >> drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c >> b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c >> index 5061f1d..92d38ab 100644 >> --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c >> +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c >> @@ -265,7 +265,7 @@ static void >> _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, >> rtlefuse->pwrgroup_ht40 >> [RF90_PATH_A][chnl - 1]) { >> pwrdiff_limit[i] = >> - rtlefuse->pwrgroup_ht20 >> + rtlefuse->pwrgroup_ht40 >> [RF90_PATH_A][chnl - 1]; >> } >> } else { > > > Good catch. There is only one problem - by convention we skip > drivers/net/wireless in the subject. That would probably be OK, but you are > missing the rtl8192se part, which needs to be there. I suggest that you use > the subject "rtlwifi: rtl8192de: Fix wrong assignment". > > Larry > > Thanks for the reply. I'll re-send it with the suggested subject. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] thinkpad-acpi: Fix wrong assignment
In the thermal_init function when checking for thinkpad_id.ec_model, the 'ta2' variable is being OR'd when acpi_ec_read call succeeds, on fail it is setting 0 to 'ta1' variable instead. Signed-off-by: Felipe Pena --- drivers/platform/x86/thinkpad_acpi.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 03ca6c1..ac6f938 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -5730,7 +5730,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm) if (acpi_ec_read(TP_EC_THERMAL_TMP8 + i, )) { ta2 |= t; } else { - ta1 = 0; + ta2 = 0; break; } } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: net: wireless: rtlwifi: Fix wrong assignment
There is a typo in the struct member name on assignment when checking rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40 for bound limit and uses pwrgroup_ht20 when assigning instead. Signed-off-by: Felipe Pena --- drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 5061f1d..92d38ab 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, rtlefuse->pwrgroup_ht40 [RF90_PATH_A][chnl - 1]) { pwrdiff_limit[i] = - rtlefuse->pwrgroup_ht20 + rtlefuse->pwrgroup_ht40 [RF90_PATH_A][chnl - 1]; } } else { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: net: wireless: rtlwifi: Fix wrong assignment
There is a typo in the struct member name on assignment when checking rtlphy-current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40 for bound limit and uses pwrgroup_ht20 when assigning instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 5061f1d..92d38ab 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]) { pwrdiff_limit[i] = - rtlefuse-pwrgroup_ht20 + rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]; } } else { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] thinkpad-acpi: Fix wrong assignment
In the thermal_init function when checking for thinkpad_id.ec_model, the 'ta2' variable is being OR'd when acpi_ec_read call succeeds, on fail it is setting 0 to 'ta1' variable instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/platform/x86/thinkpad_acpi.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 03ca6c1..ac6f938 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -5730,7 +5730,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm) if (acpi_ec_read(TP_EC_THERMAL_TMP8 + i, t)) { ta2 |= t; } else { - ta1 = 0; + ta2 = 0; break; } } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] drivers: net: wireless: rtlwifi: Fix wrong assignment
On Fri, Oct 18, 2013 at 7:27 PM, Larry Finger larry.fin...@lwfinger.net wrote: On 10/18/2013 05:15 PM, Felipe Pena wrote: There is a typo in the struct member name on assignment when checking rtlphy-current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40 for bound limit and uses pwrgroup_ht20 when assigning instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 5061f1d..92d38ab 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]) { pwrdiff_limit[i] = - rtlefuse-pwrgroup_ht20 + rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]; } } else { Good catch. There is only one problem - by convention we skip drivers/net/wireless in the subject. That would probably be OK, but you are missing the rtl8192se part, which needs to be there. I suggest that you use the subject rtlwifi: rtl8192de: Fix wrong assignment. Larry Thanks for the reply. I'll re-send it with the suggested subject. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: scsi: lpfc_debugfs: Fix wrong assignment
On lpfc_debugfs_initialize function the dumpHostSlim member setup happens when 'phba-sli_rev LPFC_SLI_REV4' is true, however when it is false NULL has been assigned to debug_dumpHBASlim instead of debug_dumpHostSlim. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/scsi/lpfc/lpfc_debugfs.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 60084e6..b800cc9 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -4001,7 +4001,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) goto debug_failed; } } else - phba-debug_dumpHBASlim = NULL; + phba-debug_dumpHostSlim = NULL; /* Setup dumpData */ snprintf(name, sizeof(name), dumpData); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] wireless: rt2800lib: Fix typo on checking
On rt2800_config_channel_rf53xx function the member default_power1 is checked for bound limit, but default_power2 is used instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/rt2x00/rt2800lib.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 88ce656..1c2ce93 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c @@ -2650,7 +2650,7 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev, if (rt2x00_rt(rt2x00dev, RT5392)) { rt2800_rfcsr_read(rt2x00dev, 50, rfcsr); - if (info-default_power1 POWER_BOUND) + if (info-default_power2 POWER_BOUND) rt2x00_set_field8(rfcsr, RFCSR50_TX, POWER_BOUND); else rt2x00_set_field8(rfcsr, RFCSR50_TX, -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] rtlwifi: rtl8192se: Fix wrong assignment
There is a typo in the struct member name on assignment when checking rtlphy-current_chan_bw == HT_CHANNEL_WIDTH_20_40, the check uses pwrgroup_ht40 for bound limit and uses pwrgroup_ht20 when assigning instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/rtlwifi/rtl8192se/rf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c index 5061f1d..92d38ab 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c @@ -265,7 +265,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw, rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]) { pwrdiff_limit[i] = - rtlefuse-pwrgroup_ht20 + rtlefuse-pwrgroup_ht40 [RF90_PATH_A][chnl - 1]; } } else { -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: net: wireless: b43: Fix possible NULL ptr dereference
On the ternary expression the 'e' variable could be NULL dereferenced, when b43_nphy_get_rf_ctl_over_rev7 function returns NULL. Signed-off-by: Felipe Pena --- drivers/net/wireless/b43/phy_n.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 7c970d3..05ee7f1 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c @@ -164,7 +164,8 @@ static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field, } en_addr = en_addrs[override][i]; - val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1; + if (e) + val_addr = (i == 0) ? e->val_addr_core0 : e->val_addr_core1; if (off) { b43_phy_mask(dev, en_addr, ~en_mask); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: net: wireless: b43: Fix possible NULL ptr dereference
On the ternary expression the 'e' variable could be NULL dereferenced, when b43_nphy_get_rf_ctl_over_rev7 function returns NULL. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/b43/phy_n.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c index 7c970d3..05ee7f1 100644 --- a/drivers/net/wireless/b43/phy_n.c +++ b/drivers/net/wireless/b43/phy_n.c @@ -164,7 +164,8 @@ static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field, } en_addr = en_addrs[override][i]; - val_addr = (i == 0) ? e-val_addr_core0 : e-val_addr_core1; + if (e) + val_addr = (i == 0) ? e-val_addr_core0 : e-val_addr_core1; if (off) { b43_phy_mask(dev, en_addr, ~en_mask); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: scsi: lpfc: Fix typo on NULL assignment
In the lpfc_ct_free_iocb function after freeing associated memory to the ctiocb->context3, the ctiocb->context1 is set to NULL instead of context3. Signed-off-by: Felipe Pena --- drivers/scsi/lpfc/lpfc_ct.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 02e8cd9..da61d8d 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -280,7 +280,7 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) buf_ptr = (struct lpfc_dmabuf *) ctiocb->context3; lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); kfree(buf_ptr); - ctiocb->context1 = NULL; + ctiocb->context3 = NULL; } lpfc_sli_release_iocbq(phba, ctiocb); return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: net: wireless: Fix wrong check for reassociation request retry counter
There is a typo where the checking for priv->ReAssociationRequestRetryCnt must be, it was checking for priv->AssociationRequestRetryCnt instead. Signed-off-by: Felipe Pena --- drivers/net/wireless/atmel.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index b827d51..9c35479 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -3212,7 +3212,7 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) if (subtype == IEEE80211_STYPE_REASSOC_RESP && status != WLAN_STATUS_ASSOC_DENIED_RATES && status != WLAN_STATUS_CAPS_UNSUPPORTED && - priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { + priv->ReAssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) { mod_timer(>management_timer, jiffies + MGMT_JIFFIES); priv->ReAssociationRequestRetryCnt++; send_association_request(priv, 1); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: md: bcache: Fix wrong check on can_attach_cache
There is a wrong check on can_attach_cache() function which bucket_size is compared to block_size value. Signed-off-by: Felipe Pena --- drivers/md/bcache/super.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 547c4c5..d5bc1eb 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1650,7 +1650,7 @@ err: static bool can_attach_cache(struct cache *ca, struct cache_set *c) { return ca->sb.block_size== c->sb.block_size && - ca->sb.bucket_size == c->sb.block_size && + ca->sb.bucket_size == c->sb.bucket_size && ca->sb.nr_in_set== c->sb.nr_in_set; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: hv: Fix wrong check for synic_event_page
The check for calling free_page() on hv_context.synic_event_page[cpu] is the same for hv_context.synic_message_page[cpu], like a copy-paste error. Signed-off-by: Felipe Pena --- drivers/hv/hv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 88f4096..f0c5e07 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -304,7 +304,7 @@ err: void hv_synic_free_cpu(int cpu) { kfree(hv_context.event_dpc[cpu]); - if (hv_context.synic_message_page[cpu]) + if (hv_context.synic_event_page[cpu]) free_page((unsigned long)hv_context.synic_event_page[cpu]); if (hv_context.synic_message_page[cpu]) free_page((unsigned long)hv_context.synic_message_page[cpu]); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: net: wireless: Fix wrong check for reassociation request retry counter
There is a typo where the checking for priv-ReAssociationRequestRetryCnt must be, it was checking for priv-AssociationRequestRetryCnt instead. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/net/wireless/atmel.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index b827d51..9c35479 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -3212,7 +3212,7 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype) if (subtype == IEEE80211_STYPE_REASSOC_RESP status != WLAN_STATUS_ASSOC_DENIED_RATES status != WLAN_STATUS_CAPS_UNSUPPORTED - priv-AssociationRequestRetryCnt MAX_ASSOCIATION_RETRIES) { + priv-ReAssociationRequestRetryCnt MAX_ASSOCIATION_RETRIES) { mod_timer(priv-management_timer, jiffies + MGMT_JIFFIES); priv-ReAssociationRequestRetryCnt++; send_association_request(priv, 1); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: scsi: lpfc: Fix typo on NULL assignment
In the lpfc_ct_free_iocb function after freeing associated memory to the ctiocb-context3, the ctiocb-context1 is set to NULL instead of context3. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/scsi/lpfc/lpfc_ct.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 02e8cd9..da61d8d 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -280,7 +280,7 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb) buf_ptr = (struct lpfc_dmabuf *) ctiocb-context3; lpfc_mbuf_free(phba, buf_ptr-virt, buf_ptr-phys); kfree(buf_ptr); - ctiocb-context1 = NULL; + ctiocb-context3 = NULL; } lpfc_sli_release_iocbq(phba, ctiocb); return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: hv: Fix wrong check for synic_event_page
The check for calling free_page() on hv_context.synic_event_page[cpu] is the same for hv_context.synic_message_page[cpu], like a copy-paste error. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/hv/hv.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 88f4096..f0c5e07 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -304,7 +304,7 @@ err: void hv_synic_free_cpu(int cpu) { kfree(hv_context.event_dpc[cpu]); - if (hv_context.synic_message_page[cpu]) + if (hv_context.synic_event_page[cpu]) free_page((unsigned long)hv_context.synic_event_page[cpu]); if (hv_context.synic_message_page[cpu]) free_page((unsigned long)hv_context.synic_message_page[cpu]); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: md: bcache: Fix wrong check on can_attach_cache
There is a wrong check on can_attach_cache() function which bucket_size is compared to block_size value. Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/md/bcache/super.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 547c4c5..d5bc1eb 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1650,7 +1650,7 @@ err: static bool can_attach_cache(struct cache *ca, struct cache_set *c) { return ca-sb.block_size== c-sb.block_size - ca-sb.bucket_size == c-sb.block_size + ca-sb.bucket_size == c-sb.bucket_size ca-sb.nr_in_set== c-sb.nr_in_set; } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:perf/core] perf tests: Fix memory leak in dso-data.c
Commit-ID: 1df9297c8535a5bb2b776381e63d8334f87d4abe Gitweb: http://git.kernel.org/tip/1df9297c8535a5bb2b776381e63d8334f87d4abe Author: Felipe Pena AuthorDate: Wed, 9 Oct 2013 23:00:38 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 14 Oct 2013 10:28:54 -0300 perf tests: Fix memory leak in dso-data.c Fix for a memory leak on test_file() function in dso-data.c. Signed-off-by: Felipe Pena Acked-by: Jiri Olsa Cc: Ingo Molnar Cc: Jiri Olsa Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1381370438-4209-1-git-send-email-felipe...@gmail.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/dso-data.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index dffe055..9cc81a3 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -35,6 +35,7 @@ static char *test_file(int size) if (size != write(fd, buf, size)) templ = NULL; + free(buf); close(fd); return templ; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: media: usb: Fix typo on variable name
The variable txlen was used instead of rxlen in a bound checking. (copy-paste error) Signed-off-by: Felipe Pena --- drivers/media/usb/dvb-usb/technisat-usb2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 40832a1..98d24ae 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c @@ -102,7 +102,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, if (rxlen > 62) { err("i2c RX buffer can't exceed 62 bytes (dev 0x%02x)", device_addr); - txlen = 62; + rxlen = 62; } b[0] = I2C_SPEED_100KHZ_BIT; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena --- tools/perf/util/trace-event-info.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..83b3a67 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -496,7 +496,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, { struct tracepoint_path *tps; struct tracing_data *tdata; - int err; + int err = -1; output_fd = fd; @@ -506,7 +506,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, tdata = malloc(sizeof(*tdata)); if (!tdata) - return NULL; + goto err_tps; tdata->temp = temp; tdata->size = 0; @@ -518,13 +518,13 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, "/tmp/perf-XX"); if (!mkstemp(tdata->temp_file)) { pr_debug("Can't make temp file"); - return NULL; + goto err_tdata; } temp_fd = open(tdata->temp_file, O_RDWR); if (temp_fd < 0) { pr_debug("Can't read '%s'", tdata->temp_file); - return NULL; + goto err_tdata; } /* @@ -562,11 +562,13 @@ out: output_fd = fd; } +err_tdata: if (err) { free(tdata); tdata = NULL; } +err_tps: put_tracepoints_path(tps); return tdata; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c
Hi, On Mon, Oct 14, 2013 at 8:59 AM, Mark Brown wrote: > On Sat, Oct 12, 2013 at 07:35:06PM -0300, Felipe Pena wrote: >> When audmux_clk is used and clk_prepare_enable function succeed, >> the memory alloc'd to buf variable is leaked > > Applied, thanks. Please try to use subject lines appropriate for the > subsystem and keep your CC lists focused - you want to send to > maintainers and people working on the specific code but it's best to > avoid people working on tree wide cleanups like Bill so they don't get > too much spam. Thanks guys for accepting the patch. Sorry for inconvenience about the subject line. About the CC list I just use the one that I get from scripts/get_maintainer.pl. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c
Hi, On Mon, Oct 14, 2013 at 8:59 AM, Mark Brown broo...@kernel.org wrote: On Sat, Oct 12, 2013 at 07:35:06PM -0300, Felipe Pena wrote: When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked Applied, thanks. Please try to use subject lines appropriate for the subsystem and keep your CC lists focused - you want to send to maintainers and people working on the specific code but it's best to avoid people working on tree wide cleanups like Bill so they don't get too much spam. Thanks guys for accepting the patch. Sorry for inconvenience about the subject line. About the CC list I just use the one that I get from scripts/get_maintainer.pl. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena felipe...@gmail.com --- tools/perf/util/trace-event-info.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..83b3a67 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -496,7 +496,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, { struct tracepoint_path *tps; struct tracing_data *tdata; - int err; + int err = -1; output_fd = fd; @@ -506,7 +506,7 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, tdata = malloc(sizeof(*tdata)); if (!tdata) - return NULL; + goto err_tps; tdata-temp = temp; tdata-size = 0; @@ -518,13 +518,13 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, /tmp/perf-XX); if (!mkstemp(tdata-temp_file)) { pr_debug(Can't make temp file); - return NULL; + goto err_tdata; } temp_fd = open(tdata-temp_file, O_RDWR); if (temp_fd 0) { pr_debug(Can't read '%s', tdata-temp_file); - return NULL; + goto err_tdata; } /* @@ -562,11 +562,13 @@ out: output_fd = fd; } +err_tdata: if (err) { free(tdata); tdata = NULL; } +err_tps: put_tracepoints_path(tps); return tdata; } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] drivers: media: usb: Fix typo on variable name
The variable txlen was used instead of rxlen in a bound checking. (copy-paste error) Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/media/usb/dvb-usb/technisat-usb2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c index 40832a1..98d24ae 100644 --- a/drivers/media/usb/dvb-usb/technisat-usb2.c +++ b/drivers/media/usb/dvb-usb/technisat-usb2.c @@ -102,7 +102,7 @@ static int technisat_usb2_i2c_access(struct usb_device *udev, if (rxlen 62) { err(i2c RX buffer can't exceed 62 bytes (dev 0x%02x), device_addr); - txlen = 62; + rxlen = 62; } b[0] = I2C_SPEED_100KHZ_BIT; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[tip:perf/core] perf tests: Fix memory leak in dso-data.c
Commit-ID: 1df9297c8535a5bb2b776381e63d8334f87d4abe Gitweb: http://git.kernel.org/tip/1df9297c8535a5bb2b776381e63d8334f87d4abe Author: Felipe Pena felipe...@gmail.com AuthorDate: Wed, 9 Oct 2013 23:00:38 -0300 Committer: Arnaldo Carvalho de Melo a...@redhat.com CommitDate: Mon, 14 Oct 2013 10:28:54 -0300 perf tests: Fix memory leak in dso-data.c Fix for a memory leak on test_file() function in dso-data.c. Signed-off-by: Felipe Pena felipe...@gmail.com Acked-by: Jiri Olsa jo...@redhat.com Cc: Ingo Molnar mi...@redhat.com Cc: Jiri Olsa jo...@redhat.com Cc: Paul Mackerras pau...@samba.org Cc: Peter Zijlstra a.p.zijls...@chello.nl Link: http://lkml.kernel.org/r/1381370438-4209-1-git-send-email-felipe...@gmail.com Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com --- tools/perf/tests/dso-data.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index dffe055..9cc81a3 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -35,6 +35,7 @@ static char *test_file(int size) if (size != write(fd, buf, size)) templ = NULL; + free(buf); close(fd); return templ; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: infiniband: ulp: Fix possible use-after-free
The tx_desc variable is being used to access its type member after a kmem_cache_free call Signed-off-by: Felipe Pena --- drivers/infiniband/ulp/iser/iser_initiator.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 5388226..15b545c 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -610,17 +610,15 @@ void iser_snd_completion(struct iser_tx_desc *tx_desc, ib_dma_unmap_single(device->ib_device, tx_desc->dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); kmem_cache_free(ig.desc_cache, tx_desc); - } - - atomic_dec(_conn->post_send_buf_count); - - if (tx_desc->type == ISCSI_TX_CONTROL) { + } else if (tx_desc->type == ISCSI_TX_CONTROL) { /* this arithmetic is legal by libiscsi dd_data allocation */ task = (void *) ((long)(void *)tx_desc - sizeof(struct iscsi_task)); if (task->hdr->itt == RESERVED_ITT) iscsi_put_task(task); } + + atomic_dec(_conn->post_send_buf_count); } void iser_task_rdma_init(struct iscsi_iser_task *iser_task) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] drivers: infiniband: ulp: Fix possible use-after-free
The tx_desc variable is being used to access its type member after a kmem_cache_free call Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/infiniband/ulp/iser/iser_initiator.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 5388226..15b545c 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -610,17 +610,15 @@ void iser_snd_completion(struct iser_tx_desc *tx_desc, ib_dma_unmap_single(device-ib_device, tx_desc-dma_addr, ISER_HEADERS_LEN, DMA_TO_DEVICE); kmem_cache_free(ig.desc_cache, tx_desc); - } - - atomic_dec(ib_conn-post_send_buf_count); - - if (tx_desc-type == ISCSI_TX_CONTROL) { + } else if (tx_desc-type == ISCSI_TX_CONTROL) { /* this arithmetic is legal by libiscsi dd_data allocation */ task = (void *) ((long)(void *)tx_desc - sizeof(struct iscsi_task)); if (task-hdr-itt == RESERVED_ITT) iscsi_put_task(task); } + + atomic_dec(ib_conn-post_send_buf_count); } void iser_task_rdma_init(struct iscsi_iser_task *iser_task) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c
When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked Signed-off-by: Felipe Pena --- sound/soc/fsl/imx-audmux.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index d3bf71a..ac86993 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -66,13 +66,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + char *buf; int port = (int)file->private_data; u32 pdcr, ptcr; - if (!buf) - return -ENOMEM; - if (audmux_clk) { ret = clk_prepare_enable(audmux_clk); if (ret) @@ -85,6 +82,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, if (audmux_clk) clk_disable_unprepare(audmux_clk); + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n", pdcr, ptcr); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: soc: fsl: Fix memory leak in imx-audmux.c
When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked Signed-off-by: Felipe Pena --- sound/soc/fsl/imx-audmux.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index d3bf71a..977759a 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -66,19 +66,20 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + char *buf; int port = (int)file->private_data; u32 pdcr, ptcr; - if (!buf) - return -ENOMEM; - if (audmux_clk) { ret = clk_prepare_enable(audmux_clk); if (ret) return ret; } + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] sound: soc: fsl: Fix memory leak in imx-audmux.c
When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked Signed-off-by: Felipe Pena felipe...@gmail.com --- sound/soc/fsl/imx-audmux.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index d3bf71a..977759a 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -66,19 +66,20 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + char *buf; int port = (int)file-private_data; u32 pdcr, ptcr; - if (!buf) - return -ENOMEM; - if (audmux_clk) { ret = clk_prepare_enable(audmux_clk); if (ret) return ret; } + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + ptcr = readl(audmux_base + IMX_AUDMUX_V2_PTCR(port)); pdcr = readl(audmux_base + IMX_AUDMUX_V2_PDCR(port)); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] sound: soc: fsl: Fix memory leak in imx-audmux.c
When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked Signed-off-by: Felipe Pena felipe...@gmail.com --- sound/soc/fsl/imx-audmux.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index d3bf71a..ac86993 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -66,13 +66,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + char *buf; int port = (int)file-private_data; u32 pdcr, ptcr; - if (!buf) - return -ENOMEM; - if (audmux_clk) { ret = clk_prepare_enable(audmux_clk); if (ret) @@ -85,6 +82,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, if (audmux_clk) clk_disable_unprepare(audmux_clk); + buf = kmalloc(PAGE_SIZE, GFP_KERNEL); + if (!buf) + return -ENOMEM; + ret = snprintf(buf, PAGE_SIZE, PDCR: %08x\nPTCR: %08x\n, pdcr, ptcr); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] tools/testing/selftests: Fix uninitialized variable
The err variable is intended to receive the timer_create() return before checking it Signed-off-by: Felipe Pena --- tools/testing/selftests/timers/posix_timers.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 4fa655d..41bd855 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -151,7 +151,7 @@ static int check_timer_create(int which) fflush(stdout); done = 0; - timer_create(which, NULL, ); + err = timer_create(which, NULL, ); if (err < 0) { perror("Can't create timer\n"); return -1; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena --- tools/perf/util/trace-event-info.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..2a0c3c9 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -518,13 +518,15 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, "/tmp/perf-XX"); if (!mkstemp(tdata->temp_file)) { pr_debug("Can't make temp file"); - return NULL; + err = -1; + goto err_tdata; } temp_fd = open(tdata->temp_file, O_RDWR); if (temp_fd < 0) { pr_debug("Can't read '%s'", tdata->temp_file); - return NULL; + err = -1; + goto err_tdata; } /* @@ -562,6 +564,7 @@ out: output_fd = fd; } +err_tdata: if (err) { free(tdata); tdata = NULL; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena felipe...@gmail.com --- tools/perf/util/trace-event-info.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..2a0c3c9 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -518,13 +518,15 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, /tmp/perf-XX); if (!mkstemp(tdata-temp_file)) { pr_debug(Can't make temp file); - return NULL; + err = -1; + goto err_tdata; } temp_fd = open(tdata-temp_file, O_RDWR); if (temp_fd 0) { pr_debug(Can't read '%s', tdata-temp_file); - return NULL; + err = -1; + goto err_tdata; } /* @@ -562,6 +564,7 @@ out: output_fd = fd; } +err_tdata: if (err) { free(tdata); tdata = NULL; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] tools/testing/selftests: Fix uninitialized variable
The err variable is intended to receive the timer_create() return before checking it Signed-off-by: Felipe Pena felipe...@gmail.com --- tools/testing/selftests/timers/posix_timers.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index 4fa655d..41bd855 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c @@ -151,7 +151,7 @@ static int check_timer_create(int which) fflush(stdout); done = 0; - timer_create(which, NULL, id); + err = timer_create(which, NULL, id); if (err 0) { perror(Can't create timer\n); return -1; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena --- tools/perf/util/trace-event-info.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..06f8624 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -518,13 +518,13 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, "/tmp/perf-XX"); if (!mkstemp(tdata->temp_file)) { pr_debug("Can't make temp file"); - return NULL; + goto err_tdata; } temp_fd = open(tdata->temp_file, O_RDWR); if (temp_fd < 0) { pr_debug("Can't read '%s'", tdata->temp_file); - return NULL; + goto err_tdata; } /* @@ -569,6 +569,10 @@ out: put_tracepoints_path(tps); return tdata; + +err_tdata: + free(tdata); + return NULL; } int tracing_data_put(struct tracing_data *tdata) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tools/perf/tests: Fix memory leak in dso-data.c
Fix for a memory leak on test_file() function in dso-data.c Signed-off-by: Felipe Pena --- tools/perf/tests/dso-data.c |1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index dffe055..9cc81a3 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -35,6 +35,7 @@ static char *test_file(int size) if (size != write(fd, buf, size)) templ = NULL; + free(buf); close(fd); return templ; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Kernel-BR] [PATCH] btrfs: Fix memory leakage in the tree-log.c
Hi, On Wed, Oct 9, 2013 at 8:13 PM, Geyslan G. Bem wrote: > In some cases, add_inode_ref() is returning without freeing > the 'name' pointer. > > Added bail out to explicitly call kfree when necessary. > > Signed-off-by: Geyslan G. Bem > --- > fs/btrfs/tree-log.c | 13 ++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c > index 79f057c..37d32c3 100644 > --- a/fs/btrfs/tree-log.c > +++ b/fs/btrfs/tree-log.c > @@ -1170,13 +1170,18 @@ static noinline int add_inode_ref(struct > btrfs_trans_handle *trans, > if (!dir) > dir = read_one_inode(root, parent_objectid); > if (!dir) > - return -ENOENT; > + { > + ret = -ENOENT; > + goto bail; > + } No braces required here. > } else { > ret = ref_get_fields(eb, ref_ptr, , , > _index); > } > if (ret) > - return ret; > + { > + goto bail; > + } > Ditto. > /* if we already have a perfect match, we're done */ > if (!inode_in_dir(root, path, btrfs_ino(dir), > btrfs_ino(inode), > @@ -1214,7 +1219,6 @@ static noinline int add_inode_ref(struct > btrfs_trans_handle *trans, > } > > ref_ptr = (unsigned long)(ref_ptr + ref_struct_size) + > namelen; > - kfree(name); > if (log_ref_ver) { > iput(dir); > dir = NULL; > @@ -1227,6 +1231,9 @@ out: > btrfs_release_path(path); > iput(dir); > iput(inode); > +bail: > + if (name) > + kfree(name); > return ret; > } > > -- > 1.8.4 > > -- > Você está recebendo esta mensagem porque se inscreveu no grupo "Kernel > Brasil" dos Grupos do Google. > Para cancelar a inscrição neste grupo e parar de receber seus e-mails, envie > um e-mail para kernel-br+unsubscr...@googlegroups.com. > Para postar neste grupo, envie um e-mail para kernel...@googlegroups.com. > Para ver esta discussão na web, acesse > https://groups.google.com/d/msgid/kernel-br/1381360387-27535-1-git-send-email-geyslan%40gmail.com. > Para obter mais opções, acesse https://groups.google.com/groups/opt_out. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [Kernel-BR] [PATCH] btrfs: Fix memory leakage in the tree-log.c
Hi, On Wed, Oct 9, 2013 at 8:13 PM, Geyslan G. Bem geys...@gmail.com wrote: In some cases, add_inode_ref() is returning without freeing the 'name' pointer. Added bail out to explicitly call kfree when necessary. Signed-off-by: Geyslan G. Bem geys...@gmail.com --- fs/btrfs/tree-log.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 79f057c..37d32c3 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -1170,13 +1170,18 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, if (!dir) dir = read_one_inode(root, parent_objectid); if (!dir) - return -ENOENT; + { + ret = -ENOENT; + goto bail; + } No braces required here. } else { ret = ref_get_fields(eb, ref_ptr, namelen, name, ref_index); } if (ret) - return ret; + { + goto bail; + } Ditto. /* if we already have a perfect match, we're done */ if (!inode_in_dir(root, path, btrfs_ino(dir), btrfs_ino(inode), @@ -1214,7 +1219,6 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, } ref_ptr = (unsigned long)(ref_ptr + ref_struct_size) + namelen; - kfree(name); if (log_ref_ver) { iput(dir); dir = NULL; @@ -1227,6 +1231,9 @@ out: btrfs_release_path(path); iput(dir); iput(inode); +bail: + if (name) + kfree(name); return ret; } -- 1.8.4 -- Você está recebendo esta mensagem porque se inscreveu no grupo Kernel Brasil dos Grupos do Google. Para cancelar a inscrição neste grupo e parar de receber seus e-mails, envie um e-mail para kernel-br+unsubscr...@googlegroups.com. Para postar neste grupo, envie um e-mail para kernel...@googlegroups.com. Para ver esta discussão na web, acesse https://groups.google.com/d/msgid/kernel-br/1381360387-27535-1-git-send-email-geyslan%40gmail.com. Para obter mais opções, acesse https://groups.google.com/groups/opt_out. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tools/perf/tests: Fix memory leak in dso-data.c
Fix for a memory leak on test_file() function in dso-data.c Signed-off-by: Felipe Pena felipe...@gmail.com --- tools/perf/tests/dso-data.c |1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index dffe055..9cc81a3 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -35,6 +35,7 @@ static char *test_file(int size) if (size != write(fd, buf, size)) templ = NULL; + free(buf); close(fd); return templ; } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly Signed-off-by: Felipe Pena felipe...@gmail.com --- tools/perf/util/trace-event-info.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index f3c9e55..06f8624 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -518,13 +518,13 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs, /tmp/perf-XX); if (!mkstemp(tdata-temp_file)) { pr_debug(Can't make temp file); - return NULL; + goto err_tdata; } temp_fd = open(tdata-temp_file, O_RDWR); if (temp_fd 0) { pr_debug(Can't read '%s', tdata-temp_file); - return NULL; + goto err_tdata; } /* @@ -569,6 +569,10 @@ out: put_tracepoints_path(tps); return tdata; + +err_tdata: + free(tdata); + return NULL; } int tracing_data_put(struct tracing_data *tdata) -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 1/1] clk/zynq: Fix possible memory leak
The zynq_clk_register_fclk function can leak memory (fclk_lock) when unable to alloc memory for fclk_gate_lock Signed-off-by: Felipe Pena Acked-by: Sören Brinkmann --- drivers/clk/zynq/clkc.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index cc40fe6..10772aa 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -117,13 +117,19 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, goto err; fclk_gate_lock = kmalloc(sizeof(*fclk_gate_lock), GFP_KERNEL); if (!fclk_gate_lock) - goto err; + goto err_fclk_gate_lock; spin_lock_init(fclk_lock); spin_lock_init(fclk_gate_lock); mux_name = kasprintf(GFP_KERNEL, "%s_mux", clk_name); + if (!mux_name) + goto err_mux_name; div0_name = kasprintf(GFP_KERNEL, "%s_div0", clk_name); + if (!div0_name) + goto err_div0_name; div1_name = kasprintf(GFP_KERNEL, "%s_div1", clk_name); + if (!div1_name) + goto err_div1_name; clk = clk_register_mux(NULL, mux_name, parents, 4, CLK_SET_RATE_NO_REPARENT, fclk_ctrl_reg, 4, 2, 0, @@ -147,6 +153,14 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, return; +err_div1_name: + kfree(div0_name); +err_div0_name: + kfree(mux_name); +err_mux_name: + kfree(fclk_gate_lock); +err_fclk_gate_lock: + kfree(fclk_lock); err: clks[fclk] = ERR_PTR(-ENOMEM); } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] drm: nouveau: fix nvbe leakage
Hi, On Mon, Oct 7, 2013 at 7:35 PM, Ben Skeggs wrote: > - Original Message - >> From: "Geyslan G. Bem" >> To: airl...@linux.ie, bske...@redhat.com, dri-de...@lists.freedesktop.org >> Cc: linux-kernel@vger.kernel.org, kernel...@googlegroups.com, "Geyslan G. >> Bem" >> Sent: Tuesday, 8 October, 2013 8:14:26 AM >> Subject: [PATCH] drm: nouveau: fix nvbe leakage >> >> Free memory allocated to nvbe when returning NULL. >> >> Signed-off-by: Geyslan G. Bem > NACK. ttm_dma_tt_init() calls the destructor if it fails, which frees the > memory. > > Ben. > But ttm_tt_destroy() just handles the ttm_tt part from nvbe, the nvbe pointer itself is not being free'd. >> --- >> drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c >> b/drivers/gpu/drm/nouveau/nouveau_sgdma.c >> index 0843ebc..af8b66d 100644 >> --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c >> +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c >> @@ -105,6 +105,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, >> nvbe->ttm.ttm.func = _sgdma_backend; >> >> if (ttm_dma_tt_init(>ttm, bdev, size, page_flags, >> dummy_read_page)) >> + { >> + kfree(nvbe); >> return NULL; >> + } >> return >ttm.ttm; >> } >> -- >> 1.8.4 >> >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] drm: nouveau: fix nvbe leakage
Hi, On Mon, Oct 7, 2013 at 7:35 PM, Ben Skeggs bske...@redhat.com wrote: - Original Message - From: Geyslan G. Bem geys...@gmail.com To: airl...@linux.ie, bske...@redhat.com, dri-de...@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, kernel...@googlegroups.com, Geyslan G. Bem geys...@gmail.com Sent: Tuesday, 8 October, 2013 8:14:26 AM Subject: [PATCH] drm: nouveau: fix nvbe leakage Free memory allocated to nvbe when returning NULL. Signed-off-by: Geyslan G. Bem geys...@gmail.com NACK. ttm_dma_tt_init() calls the destructor if it fails, which frees the memory. Ben. But ttm_tt_destroy() just handles the ttm_tt part from nvbe, the nvbe pointer itself is not being free'd. --- drivers/gpu/drm/nouveau/nouveau_sgdma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 0843ebc..af8b66d 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -105,6 +105,9 @@ nouveau_sgdma_create_ttm(struct ttm_bo_device *bdev, nvbe-ttm.ttm.func = nv50_sgdma_backend; if (ttm_dma_tt_init(nvbe-ttm, bdev, size, page_flags, dummy_read_page)) + { + kfree(nvbe); return NULL; + } return nvbe-ttm.ttm; } -- 1.8.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 1/1] clk/zynq: Fix possible memory leak
The zynq_clk_register_fclk function can leak memory (fclk_lock) when unable to alloc memory for fclk_gate_lock Signed-off-by: Felipe Pena felipe...@gmail.com Acked-by: Sören Brinkmann soren.brinkm...@xilinx.com --- drivers/clk/zynq/clkc.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index cc40fe6..10772aa 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -117,13 +117,19 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, goto err; fclk_gate_lock = kmalloc(sizeof(*fclk_gate_lock), GFP_KERNEL); if (!fclk_gate_lock) - goto err; + goto err_fclk_gate_lock; spin_lock_init(fclk_lock); spin_lock_init(fclk_gate_lock); mux_name = kasprintf(GFP_KERNEL, %s_mux, clk_name); + if (!mux_name) + goto err_mux_name; div0_name = kasprintf(GFP_KERNEL, %s_div0, clk_name); + if (!div0_name) + goto err_div0_name; div1_name = kasprintf(GFP_KERNEL, %s_div1, clk_name); + if (!div1_name) + goto err_div1_name; clk = clk_register_mux(NULL, mux_name, parents, 4, CLK_SET_RATE_NO_REPARENT, fclk_ctrl_reg, 4, 2, 0, @@ -147,6 +153,14 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, return; +err_div1_name: + kfree(div0_name); +err_div0_name: + kfree(mux_name); +err_mux_name: + kfree(fclk_gate_lock); +err_fclk_gate_lock: + kfree(fclk_lock); err: clks[fclk] = ERR_PTR(-ENOMEM); } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] clk/zynq: Fix possible memory leak
The zynq_clk_register_fclk function can leak memory (fclk_lock) when unable to alloc memory for fclk_gate_lock Signed-off-by: Felipe Pena --- drivers/clk/zynq/clkc.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index cc40fe6..7ea4b5c 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -117,6 +117,7 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, goto err; fclk_gate_lock = kmalloc(sizeof(*fclk_gate_lock), GFP_KERNEL); if (!fclk_gate_lock) + kfree(fclk_lock); goto err; spin_lock_init(fclk_lock); spin_lock_init(fclk_gate_lock); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] clk/zynq: Fix possible memory leak
The zynq_clk_register_fclk function can leak memory (fclk_lock) when unable to alloc memory for fclk_gate_lock Signed-off-by: Felipe Pena felipe...@gmail.com --- drivers/clk/zynq/clkc.c |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c index cc40fe6..7ea4b5c 100644 --- a/drivers/clk/zynq/clkc.c +++ b/drivers/clk/zynq/clkc.c @@ -117,6 +117,7 @@ static void __init zynq_clk_register_fclk(enum zynq_clk fclk, goto err; fclk_gate_lock = kmalloc(sizeof(*fclk_gate_lock), GFP_KERNEL); if (!fclk_gate_lock) + kfree(fclk_lock); goto err; spin_lock_init(fclk_lock); spin_lock_init(fclk_gate_lock); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 1/1] arch/parisc: mm: fix uninitialized variable usage
The FAULT_FLAG_WRITE flag has been set based on uninitialized variable Signed-off-by: Felipe Pena --- arch/parisc/mm/fault.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d10d27a..00c0ed3 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -182,6 +182,9 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) flags |= FAULT_FLAG_USER; + + acc_type = parisc_acctyp(code, regs->iir); + if (acc_type & VM_WRITE) flags |= FAULT_FLAG_WRITE; retry: @@ -196,8 +199,6 @@ retry: good_area: - acc_type = parisc_acctyp(code,regs->iir); - if ((vma->vm_flags & acc_type) != acc_type) goto bad_area; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] arch/parisc: mm: fix uninitialized variable usage
Hello Johannes, On Sun, Sep 22, 2013 at 7:58 PM, Johannes Weiner wrote: > Hello Felipe, > > On Sun, Sep 22, 2013 at 03:17:46PM -0300, Felipe Pena wrote: >> The FAULT_FLAG_WRITE flag has been set based on uninitialized variable > > Oops, you are right. > >> Signed-off-by: Felipe Pena >> --- >> arch/parisc/mm/fault.c |5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c >> index d10d27a..6b38026 100644 >> --- a/arch/parisc/mm/fault.c >> +++ b/arch/parisc/mm/fault.c >> @@ -182,8 +182,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long >> code, >> >> if (user_mode(regs)) >> flags |= FAULT_FLAG_USER; >> - if (acc_type & VM_WRITE) >> - flags |= FAULT_FLAG_WRITE; >> retry: >> down_read(>mmap_sem); >> vma = find_vma_prev(mm, address, _vma); >> @@ -201,6 +199,9 @@ good_area: >> if ((vma->vm_flags & acc_type) != acc_type) >> goto bad_area; >> >> + if (acc_type & VM_WRITE) >> + flags |= FAULT_FLAG_WRITE; > > Can acc_type actually change between between the first round and a > retry? Otherwise, it might make sense to pull this up and place it > next to the flag initialization instead of pulling one flag down. >From what I've analyzed, this make sense. I'll make the suggested changes and send another patch. Thanks. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] arch/parisc: mm: fix uninitialized variable usage
The FAULT_FLAG_WRITE flag has been set based on uninitialized variable Signed-off-by: Felipe Pena --- arch/parisc/mm/fault.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d10d27a..6b38026 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -182,8 +182,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) flags |= FAULT_FLAG_USER; - if (acc_type & VM_WRITE) - flags |= FAULT_FLAG_WRITE; retry: down_read(>mmap_sem); vma = find_vma_prev(mm, address, _vma); @@ -201,6 +199,9 @@ good_area: if ((vma->vm_flags & acc_type) != acc_type) goto bad_area; + if (acc_type & VM_WRITE) + flags |= FAULT_FLAG_WRITE; + /* * If for any reason at all we couldn't handle the fault, make * sure we exit gracefully rather than endlessly redo the -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] arch/parisc: mm: fix uninitialized variable usage
The FAULT_FLAG_WRITE flag has been set based on uninitialized variable Signed-off-by: Felipe Pena felipe...@gmail.com --- arch/parisc/mm/fault.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d10d27a..6b38026 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -182,8 +182,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) flags |= FAULT_FLAG_USER; - if (acc_type VM_WRITE) - flags |= FAULT_FLAG_WRITE; retry: down_read(mm-mmap_sem); vma = find_vma_prev(mm, address, prev_vma); @@ -201,6 +199,9 @@ good_area: if ((vma-vm_flags acc_type) != acc_type) goto bad_area; + if (acc_type VM_WRITE) + flags |= FAULT_FLAG_WRITE; + /* * If for any reason at all we couldn't handle the fault, make * sure we exit gracefully rather than endlessly redo the -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] arch/parisc: mm: fix uninitialized variable usage
Hello Johannes, On Sun, Sep 22, 2013 at 7:58 PM, Johannes Weiner han...@cmpxchg.org wrote: Hello Felipe, On Sun, Sep 22, 2013 at 03:17:46PM -0300, Felipe Pena wrote: The FAULT_FLAG_WRITE flag has been set based on uninitialized variable Oops, you are right. Signed-off-by: Felipe Pena felipe...@gmail.com --- arch/parisc/mm/fault.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d10d27a..6b38026 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -182,8 +182,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) flags |= FAULT_FLAG_USER; - if (acc_type VM_WRITE) - flags |= FAULT_FLAG_WRITE; retry: down_read(mm-mmap_sem); vma = find_vma_prev(mm, address, prev_vma); @@ -201,6 +199,9 @@ good_area: if ((vma-vm_flags acc_type) != acc_type) goto bad_area; + if (acc_type VM_WRITE) + flags |= FAULT_FLAG_WRITE; Can acc_type actually change between between the first round and a retry? Otherwise, it might make sense to pull this up and place it next to the flag initialization instead of pulling one flag down. From what I've analyzed, this make sense. I'll make the suggested changes and send another patch. Thanks. -- Regards, Felipe Pena -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCHv2 1/1] arch/parisc: mm: fix uninitialized variable usage
The FAULT_FLAG_WRITE flag has been set based on uninitialized variable Signed-off-by: Felipe Pena felipe...@gmail.com --- arch/parisc/mm/fault.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index d10d27a..00c0ed3 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -182,6 +182,9 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) flags |= FAULT_FLAG_USER; + + acc_type = parisc_acctyp(code, regs-iir); + if (acc_type VM_WRITE) flags |= FAULT_FLAG_WRITE; retry: @@ -196,8 +199,6 @@ retry: good_area: - acc_type = parisc_acctyp(code,regs-iir); - if ((vma-vm_flags acc_type) != acc_type) goto bad_area; -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/