xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
Subsystems (6)
Sasha Levin
maintainerPATCH 4/13 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 3/13 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
@@ -1806,7 +1806,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 )
@@ -2129,9 +2129,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) {
@@ -2145,7 +2147,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
Sasha Levin
maintainerPATCH 7/13 objtool: Support Clang non-section symbols in ORC dump
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit 8782e7cab51b6bf01a5a86471dd82228af1ac185 ]
Historically, the relocation symbols for ORC entries have only been section symbols:
.text+0: sp:sp+8 bp:(und) type:call end:0
However, the Clang assembler is aggressive about stripping section symbols. In that case we will need to use function symbols:
freezing_slow_path+0: sp:sp+8 bp:(und) type:call end:0
In preparation for the generation of such entries in "objtool orc generate", add support for reading them in "objtool orc dump".
--- tools/objtool/orc_dump.c | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-)
tools/objtool/orc_dump.c +27 -17
@@ -78,7 +78,7 @@ int orc_dump(const char *_objname)char *name;size_t nr_sections;Elf64_Addr orc_ip_addr =0 ; -size_t shstrtab_idx; +size_t shstrtab_idx, strtab_idx =0 ;Elf *elf;Elf_Scn *scn;GElf_Shdr sh;
@@ -139,6 +139,8 @@ int orc_dump(const char *_objname)if (!strcmp (name,".symtab" )) { symtab = data; + }else if (!strcmp (name,".strtab" )) { + strtab_idx = i; }else if (!strcmp (name,".orc_unwind" )) { orc = data->d_buf; orc_size = sh.sh_size;
@@ -150,7 +152,7 @@ int orc_dump(const char *_objname) } } -if (!symtab || !orc || !orc_ip) +if (!symtab || !strtab_idx || !orc || !orc_ip)return 0 ;if (orc_size %sizeof (*orc) !=0 ) {
@@ -171,21 +173,29 @@ int orc_dump(const char *_objname)return -1 ; } - scn =elf_getscn (elf, sym.st_shndx); -if (!scn) { -WARN_ELF ("elf_getscn" ); -return -1 ; - } - -if (!gelf_getshdr (scn, &sh)) { -WARN_ELF ("gelf_getshdr" ); -return -1 ; - } - - name =elf_strptr (elf, shstrtab_idx, sh.sh_name); -if (!name || !*name) { -WARN_ELF ("elf_strptr" ); -return -1 ; +if (GELF_ST_TYPE (sym.st_info) ==STT_SECTION ) { + scn =elf_getscn (elf, sym.st_shndx); +if (!scn) { +WARN_ELF ("elf_getscn" ); +return -1 ; + } + +if (!gelf_getshdr (scn, &sh)) { +WARN_ELF ("gelf_getshdr" ); +return -1 ; + } + + name =elf_strptr (elf, shstrtab_idx, sh.sh_name); +if (!name) { +WARN_ELF ("elf_strptr" ); +return -1 ; + } + }else { + name =elf_strptr (elf, strtab_idx, sym.st_name); +if (!name) { +WARN_ELF ("elf_strptr" ); +return -1 ; + } }printf ("%s+%llx:" , name, (unsigned long long )rela.r_addend);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/13 objtool: Fix switch table detection in .text.unlikely
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit b401efc120a399dfda1f4d2858a4de365c9b08ef ]
If a switch jump table's indirect branch is in a ".cold" subfunction in .text.unlikely, objtool doesn't detect it, and instead prints a false warning:
drivers/media/v4l2-core/v4l2-ioctl.o: warning: objtool: v4l_print_format.cold()+0xd6: sibling call from callable instruction with modified stack frame drivers/hwmon/max6650.o: warning: objtool: max6650_probe.cold()+0xa5: sibling call from callable instruction with modified stack frame drivers/media/dvb-frontends/drxk_hard.o: warning: objtool: init_drxk.cold()+0x16f: sibling call from callable instruction with modified stack frame
Fix it by comparing the function, instead of the section and offset.
--- tools/objtool/check.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/objtool/check.c +1 -4
@@ -914,10 +914,7 @@ static struct rela *find_switch_table(struct objtool_file *file,* it. */ for (; - &insn->list != &file->insn_list && - insn->sec == func->sec && - insn->offset >= func->offset; - + &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func; insn = insn->first_jump_src ?:list_prev_entry (insn, list)) {if (insn != orig_insn && insn->type ==INSN_JUMP_DYNAMIC )
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/13 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 11/13 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 13/13 hwmon: (jc42) Fix name to have no illegal characters
In reply to Sasha LevinFrom: Sascha Hauer <[email protected]>
[ Upstream commit c843b382e61b5f28a3d917712c69a344f632387c ]
The jc42 driver passes I2C client's name as hwmon device name. In case of device tree probed devices this ends up being part of the compatible string, "jc-42.4-temp". This name contains hyphens and the hwmon core doesn't like this:
jc42 2-0018: hwmon: 'jc-42.4-temp' is not a valid name attribute, please fix
This changes the name to "jc42" which doesn't have any illegal characters.
--- drivers/hwmon/jc42.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/jc42.c +1 -1
@@ -508,7 +508,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id) } data->config = config; - hwmon_dev =devm_hwmon_device_register_with_info (dev, client->name, + hwmon_dev =devm_hwmon_device_register_with_info (dev,"jc42" , data, &jc42_chip_info,NULL );return PTR_ERR_OR_ZERO (hwmon_dev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/13 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
@@ -539,6 +539,10 @@ static void __init of_unittest_changeset(void)unittest (!of_changeset_revert (&chgset),"revert failed\n" );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 10/13 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
@@ -3400,7 +3400,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 6/13 objtool: Fix CONFIG_UBSAN_TRAP unreachable warnings
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit bd841d6154f5f41f8a32d3c1b0bc229e326e640a ]
CONFIG_UBSAN_TRAP causes GCC to emit a UD2 whenever it encounters an unreachable code path. This includes __builtin_unreachable(). Because the BUG() macro uses __builtin_unreachable() after it emits its own UD2, this results in a double UD2. In this case objtool rightfully detects that the second UD2 is unreachable:
init/main.o: warning: objtool: repair_env_string()+0x1c8: unreachable instruction
We weren't able to figure out a way to get rid of the double UD2s, so just silence the warning.
--- tools/objtool/check.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
tools/objtool/check.c +15 -2
@@ -2038,14 +2038,27 @@ static bool ignore_unreachable_insn(struct instruction *insn) !strcmp(insn->sec->name, ".altinstr_aux"))return true; +if (!insn->func) +return false; + +/* +* CONFIG_UBSAN_TRAP inserts a UD2 when it sees +* __builtin_unreachable(). The BUG() macro has an unreachable() after +* the UD2, which causes GCC's undefined trap logic to emit another UD2 +* (or occasionally a JMP to UD2). +*/ +if (list_prev_entry (insn, list)->dead_end && + (insn->type ==INSN_BUG || + (insn->type ==INSN_JUMP_UNCONDITIONAL && + insn->jump_dest && insn->jump_dest->type ==INSN_BUG ))) +return true; +/* * Check if this (or a subsequent) instruction is related to * CONFIG_UBSAN or CONFIG_KASAN. * * End the search at 5 instructions to avoid going into the weeds. */ -if (!insn->func) -return false;for (i =0 ; i <5 ; i++) {if (is_kasan_insn (insn) ||is_ubsan_insn (insn))
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/13 scsi: sg: add sg_remove_request in sg_common_write
In reply to Sasha LevinFrom: 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
@@ -809,8 +809,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 2/13 ALSA: hda: Don't release card at firmware loading error
In reply to Sasha LevinFrom: 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
@@ -1828,24 +1828,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 1/13 xfs: fix partially uninitialized structure in xfs_reflink_remap_extent
From: "Darrick J. Wong" <[email protected]>
[ Upstream commit c142932c29e533ee892f87b44d8abc5719edceec ]
In the reflink extent remap function, it turns out that uirec (the block mapping corresponding only to the part of the passed-in mapping that got unmapped) was not fully initialized. Specifically, br_state was not being copied from the passed-in struct to the uirec. This could lead to unpredictable results such as the reflinked mapping being marked unwritten in the destination file.
--- fs/xfs/xfs_reflink.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/xfs_reflink.c +1 -0
@@ -1162,6 +1162,7 @@ xfs_reflink_remap_extent( uirec.br_startblock = irec->br_startblock + rlen; uirec.br_startoff = irec->br_startoff + rlen; uirec.br_blockcount = unmap_len - rlen; + uirec.br_state = irec->br_state; unmap_len = rlen;/* If this isn't a real mapping, we're done. */
Signature · 1 line
2.20.1
Re: [PATCH AUTOSEL 4.9 03/13] ALSA: hda: Keep the controller initialization even if no codecs found
In reply to Sasha LevinQuoted 18 lines · Sasha Levin
From: 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.
Quoted 5 lines
Tested-by Roy Spliet <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Applying this without other commits isn't recommended, especially for the older branches. Maybe OK up from 4.19, but I'd avoid applying for the older.
thanks,
Takashi
Quoted 44 lines
--- sound/pci/hda/hda_intel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)sound/pci/hda/hda_intel.c +7
-5@@ -1806,7 +1806,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 )@@ -2129,9 +2129,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) {@@ -2145,7 +2147,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
Sasha Levin
maintainerRe: [PATCH AUTOSEL 4.9 03/13] ALSA: hda: Keep the controller initialization even if no codecs found
Quoted 26 lines · Takashi Iwai
Quoted 18 lines · Sasha Levin
From: 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.
Quoted 5 lines
Tested-by Roy Spliet <[email protected]>Signed-off-by Takashi Iwai <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Quoted 3 lines
Applying this without other commits isn't recommended, especially for the older branches. Maybe OK up from 4.19, but I'd avoid applying for the older.
Okay, I've dropped it from branches older than 4.19. Thanks!
Signature · 2 lines
Thanks, Sasha