ALSA: hda: Don't release card at firmware loading error
Subsystems (5)
Sasha Levin
maintainerPATCH 3/8 scsi: target: fix PR IN / READ FULL STATUS for FC
In reply to Sasha LevinFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 8fed04eb79a74cbf471dfaa755900a51b37273ab ]
Creation of the response to READ FULL STATUS fails for FC based reservations. Reason is the too high loop limit (< 24) in fc_get_pr_transport_id(). The string representation of FC WWPN is 23 chars long only ("11:22:33:44:55:66:77:88"). So when i is 23, the loop body is executed a last time for the ending '\0' of the string and thus hex2bin() reports an error.
--- drivers/target/target_core_fabric_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_fabric_lib.c +1 -1
@@ -75,7 +75,7 @@ static int fc_get_pr_transport_id(* encoded TransportID. */ ptr = &se_nacl->initiatorname[0 ]; -for (i =0 ; i <24 ; ) { +for (i =0 ; i <23 ; ) {if (!strncmp (&ptr[i],":" ,1 )) { i++;continue ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 1/8 ALSA: hda: Don't release card at firmware loading error
From: Takashi Iwai <[email protected]>
[ Upstream commit 25faa4bd37c10f19e4b848b9032a17a3d44c6f09 ]
At the error path of the firmware loading error, the driver tries to release the card object and set NULL to drvdata. This may be referred badly at the possible PM action, as the driver itself is still bound and the PM callbacks read the card object.
Instead, we continue the probing as if it were no option set. This is often a better choice than the forced abort, too.
--- sound/pci/hda/hda_intel.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
sound/pci/hda/hda_intel.c +5 -14
@@ -1839,24 +1839,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context) {struct snd_card *card = context;struct azx *chip = card->private_data; -struct pci_dev *pci = chip->pci; - -if (!fw) { -dev_err (card->dev,"Cannot load firmware, aborting\n" ); - goto error; - } - chip->fw = fw; +if (fw) + chip->fw = fw; +else +dev_err (card->dev,"Cannot load firmware, continue without patching\n" );if (!chip->disabled) {/* continue probing */ -if (azx_probe_continue (chip)) - goto error; +azx_probe_continue (chip); } -return ;/* OK */ - - error: -snd_card_free (card); -pci_set_drvdata (pci,NULL ); }#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/8 scsi: sg: add sg_remove_request in sg_common_write
From: Li Bin <[email protected]>
[ Upstream commit 849f8583e955dbe3a1806e03ecacd5e71cce0a08 ]
If the dxfer_len is greater than 256M then the request is invalid and we need to call sg_remove_request in sg_common_write.
--- drivers/scsi/sg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/sg.c +3 -1
@@ -820,8 +820,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,"sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n" , (int) cmnd[0], (int) hp->cmd_len)); -if (hp->dxfer_len >=SZ_256M ) +if (hp->dxfer_len >=SZ_256M ) { +sg_remove_request (sfp, srp);return -EINVAL ; + } k =sg_start_req (srp, cmnd);if (k) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/8 net/cxgb4: Check the return from t4_query_params properly
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit c799fca8baf18d1bbbbad6c3b736eefbde8bdb90 ]
Positive return values are also failures that don't set val, although this probably can't happen. Fixes gcc 10 warning:
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c: In function ‘t4_phy_fw_ver’:drivers/net/ethernet/chelsio/cxgb4/t4_hw.c:3747:14: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
3747 | *phy_fw_ver = val;
--- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +1 -1
@@ -3341,7 +3341,7 @@ int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) FW_PARAMS_PARAM_Z_V(FW_PARAMS_PARAM_DEV_PHYFW_VERSION)); ret =t4_query_params (adap, adap->mbox, adap->pf,0 ,1 , ¶m, &val); -if (ret <0 ) +if (ret)return ret; *phy_fw_ver = val;return 0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/8 ext4: convert BUG_ON's to WARN_ON's in mballoc.c
In reply to Sasha LevinFrom: Theodore Ts'o <[email protected]>
[ Upstream commit 907ea529fc4c3296701d2bfc8b831dd2a8121a34 ]
If the in-core buddy bitmap gets corrupted (or out of sync with the block bitmap), issue a WARN_ON and try to recover. In most cases this involves skipping trying to allocate out of a particular block group. We can end up declaring the file system corrupted, which is fair, since the file system probably should be checked before we proceed any further.
Google-Bug-Id: 34811296
Google-Bug-Id: 34639169
--- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +4 -2
@@ -1944,7 +1944,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,int free; free = e4b->bd_info->bb_free; -BUG_ON (free <=0 ); +if (WARN_ON (free <=0 )) +return ; i = e4b->bd_info->bb_first_free;
@@ -1965,7 +1966,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, }mb_find_extent (e4b, i, ac->ac_g_ex.fe_len, &ex); -BUG_ON (ex.fe_len <=0 ); +if (WARN_ON (ex.fe_len <=0 )) +break ;if (free < ex.fe_len) {ext4_grp_locked_error (sb, e4b->bd_group,0 ,0 , "%d free clusters as per "
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/8 xen/xenbus: ensure xenbus_map_ring_valloc() returns proper grant status
In reply to Sasha LevinFrom: Juergen Gross <[email protected]>
[ Upstream commit 6b51fd3f65a22e3d1471b18a1d56247e246edd46 ]
xenbus_map_ring_valloc() maps a ring page and returns the status of the used grant (0 meaning success).
There are Xen hypervisors which might return the value 1 for the status of a failed grant mapping due to a bug. Some callers of xenbus_map_ring_valloc() test for errors by testing the returned status to be less than zero, resulting in no error detected and crashing later due to a not available ring page.
Set the return value of xenbus_map_ring_valloc() to GNTST_general_error in case the grant status reported by Xen is greater than zero.
This is part of XSA-316.
--- drivers/xen/xenbus/xenbus_client.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/xen/xenbus/xenbus_client.c +8 -1
@@ -469,7 +469,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);int xenbus_map_ring_valloc (struct xenbus_device *dev,grant_ref_t *gnt_refs,unsigned int nr_grefs,void **vaddr) { -return ring_ops->map (dev, gnt_refs, nr_grefs, vaddr); +int err; + + err = ring_ops->map (dev, gnt_refs, nr_grefs, vaddr); +/* Some hypervisors are buggy and can return 1. */ +if (err >0 ) + err = GNTST_general_error; + +return err; }EXPORT_SYMBOL_GPL (xenbus_map_ring_valloc);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/8 of: unittest: kmemleak on changeset destroy
In reply to Sasha LevinFrom: Frank Rowand <[email protected]>
[ Upstream commit b3fb36ed694b05738d45218ea72cf7feb10ce2b1 ]
kmemleak reports several memory leaks from devicetree unittest. This is the fix for problem 1 of 5.
of_unittest_changeset() reaches deeply into the dynamic devicetree functions. Several nodes were left with an elevated reference count and thus were not properly cleaned up. Fix the reference counts so that the memory will be freed.
--- drivers/of/unittest.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/of/unittest.c +4 -0
@@ -544,6 +544,10 @@ static void __init of_unittest_changeset(void)mutex_unlock (&of_mutex);of_changeset_destroy (&chgset); + +of_node_put (n1); +of_node_put (n2); +of_node_put (n21);#endif }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/8 ALSA: hda: Keep the controller initialization even if no codecs found
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9479e75fca370a5220784f7596bf598c4dad0b9b ]
Currently, when the HD-audio controller driver doesn't detect any codecs, it tries to abort the probe. But this abort happens at the delayed probe, i.e. the primary probe call already returned success, hence the driver is never unbound until user does so explicitly. As a result, it may leave the HD-audio device in the running state without the runtime PM. More badly, if the device is a HD-audio bus that is tied with a GPU, GPU cannot reach to the full power down and consumes unnecessarily much power.
This patch changes the logic after no-codec situation; it continues probing without the further codec initialization but keep the controller driver running normally.
--- sound/pci/hda/hda_intel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
sound/pci/hda/hda_intel.c +7 -5
@@ -1817,7 +1817,7 @@ static int azx_first_init(struct azx *chip)/* codec detection */ if (!azx_bus (chip)->codec_mask) {dev_err (card->dev,"no codecs found!\n" ); -return -ENODEV ; +/* keep running the rest for the runtime PM */ }if (azx_acquire_irq (chip,0 ) <0 )
@@ -2140,9 +2140,11 @@ static int azx_probe_continue(struct azx *chip)#endif /* create codec instances */ - err =azx_probe_codecs (chip, azx_max_codecs[chip->driver_type]); -if (err <0 ) - goto out_free; +if (bus->codec_mask) { + err =azx_probe_codecs (chip, azx_max_codecs[chip->driver_type]); +if (err <0 ) + goto out_free; + }#ifdef CONFIG_SND_HDA_PATCH_LOADER if (chip->fw) {
@@ -2156,7 +2158,7 @@ static int azx_probe_continue(struct azx *chip) #endif }#endif -if ((probe_only[dev] &1 ) ==0 ) { +if (bus->codec_mask && !(probe_only[dev] &1 )) { err =azx_codec_configure (chip);if (err <0 ) goto out_free;
Signature · 1 line
2.20.1