2024-01-05 14:46:26

by Greg KH

[permalink] [raw]
Subject: Linux 5.10.206

I'm announcing the release of the 5.10.206 kernel.

All users of the 5.10 kernel series must upgrade.

The updated 5.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.10.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h

------------

Documentation/devicetree/bindings/nvmem/mxs-ocotp.yaml | 10
Makefile | 2
arch/arm/boot/dts/am33xx.dtsi | 1
arch/arm/mach-omap2/id.c | 5
arch/mips/Kconfig | 2
arch/mips/include/asm/mach-loongson64/boot_param.h | 3
arch/mips/loongson64/env.c | 10
arch/s390/include/asm/fpu/api.h | 2
arch/x86/kernel/alternative.c | 2
drivers/bus/ti-sysc.c | 18 +
drivers/i2c/busses/i2c-aspeed.c | 48 ++--
drivers/iio/adc/ti_am335x_adc.c | 4
drivers/iio/common/ms_sensors/ms_sensors_i2c.c | 4
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 4
drivers/input/keyboard/ipaq-micro-keys.c | 3
drivers/input/misc/soc_button_array.c | 5
drivers/interconnect/core.c | 3
drivers/md/dm-integrity.c | 11 -
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 5
drivers/net/ethernet/mellanox/mlx5/core/diag/fw_tracer.c | 2
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 10
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2
drivers/net/ethernet/mellanox/mlx5/core/vport.c | 2
drivers/net/ethernet/micrel/ks8851.h | 3
drivers/net/ethernet/micrel/ks8851_common.c | 20 -
drivers/net/ethernet/micrel/ks8851_spi.c | 42 ++-
drivers/pinctrl/pinctrl-at91-pio4.c | 8
drivers/reset/core.c | 3
drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 9
drivers/scsi/scsi.c | 2
drivers/scsi/scsi_error.c | 34 +--
drivers/scsi/scsi_lib.c | 38 ++-
drivers/scsi/scsi_logging.c | 18 -
drivers/scsi/scsi_priv.h | 1
drivers/spi/spi-atmel.c | 133 +++---------
drivers/usb/host/fotg210-hcd.c | 3
drivers/usb/serial/ftdi_sio.c | 6
drivers/usb/serial/ftdi_sio_ids.h | 6
drivers/usb/serial/option.c | 5
fs/afs/cell.c | 6
fs/afs/dynroot.c | 31 +-
fs/btrfs/ioctl.c | 9
fs/cifs/misc.c | 4
fs/cifs/smb2misc.c | 26 --
fs/cifs/smb2ops.c | 26 +-
fs/cifs/smb2pdu.c | 29 ++
fs/cifs/smb2pdu.h | 2
include/linux/key-type.h | 1
include/net/bluetooth/hci_core.h | 5
include/net/bluetooth/mgmt.h | 2
include/scsi/scsi_cmnd.h | 29 ++
include/scsi/scsi_device.h | 16 -
kernel/trace/ring_buffer.c | 12 -
kernel/trace/synth_event_gen_test.c | 11 +
kernel/trace/trace.c | 20 +
lib/vsprintf.c | 11 -
net/8021q/vlan_core.c | 9
net/9p/client.c | 7
net/9p/protocol.c | 17 +
net/bluetooth/af_bluetooth.c | 7
net/bluetooth/hci_event.c | 3
net/bluetooth/l2cap_core.c | 21 +
net/bluetooth/mgmt.c | 35 ++-
net/bluetooth/smp.c | 161 ++++++++-------
net/bluetooth/smp.h | 6
net/core/dev.c | 8
net/dns_resolver/dns_key.c | 10
net/ife/ife.c | 1
net/mac80211/mesh_plink.c | 10
net/netfilter/nf_tables_api.c | 2
net/rfkill/rfkill-gpio.c | 8
net/rose/af_rose.c | 39 +++
net/wireless/certs/wens.hex | 87 ++++++++
security/keys/gc.c | 31 +-
security/keys/internal.h | 11 -
security/keys/key.c | 15 -
security/keys/proc.c | 2
sound/pci/hda/patch_hdmi.c | 2
78 files changed, 778 insertions(+), 443 deletions(-)

Alexander Atanasov (1):
scsi: core: Always send batch on reset or error handling command

Alexis Lothoré (1):
pinctrl: at91-pio4: use dedicated lock class for IRQ

Alper Ak (1):
USB: serial: option: add Quectel EG912Y module support

Archie Pusaka (1):
Bluetooth: use inclusive language in SMP

Bart Van Assche (3):
scsi: core: Introduce scsi_get_sector()
scsi: core: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
scsi: core: Use a structure member to track the SCSI command submitter

Chen-Yu Tsai (1):
wifi: cfg80211: Add my certificate

Christoffer Sandberg (1):
Input: soc_button_array - add mapping for airplane mode button

Dan Carpenter (1):
usb: fotg210-hcd: delete an incorrect bounds test

Dan Sneddon (2):
spi: atmel: Switch to transfer_one transfer method
spi: atmel: Fix CS and initialization bug

David Howells (4):
afs: Fix the dynamic root's d_delete to always delete unused dentries
afs: Fix dynamic root lookup DNS check
keys, dns: Allow key types (eg. DNS) to be reclaimed immediately on expiry
afs: Fix overwriting of result of DNS query

Eric Dumazet (3):
net: sched: ife: fix potential use-after-free
net/rose: fix races in rose_kill_by_device()
net: check dev->gso_max_size in gso_features_check()

Fabio Estevam (1):
dt-bindings: nvmem: mxs-ocotp: Document fsl,ocotp

Fedor Pchelkin (1):
net: 9p: avoid freeing uninit memory in p9pdu_vreadf

Frédéric Danis (1):
Bluetooth: L2CAP: Send reject on command corrupted request

Geert Uytterhoeven (1):
reset: Fix crash when freeing non-existent optional resets

Greg Kroah-Hartman (2):
Revert "MIPS: Loongson64: Enable DMA noncoherent support"
Linux 5.10.206

Hangyu Hua (1):
9p/net: fix possible memory leak in p9_check_errors()

Haoran Liu (1):
Input: ipaq-micro-keys - add error handling for devm_kmemdup

Heiko Carstens (1):
s390/vx: fix save/restore of fpu kernel context

Heiner Kallweit (1):
net: warn if gso_type isn't set for a GSO SKB

Herve Codina (1):
lib/vsprintf: Fix %pfwf when current node refcount == 0

Hyunwoo Kim (1):
Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg

Javier Carrasco (1):
iio: common: ms_sensors: ms_sensors_i2c: fix humidity conversion time table

Johannes Berg (2):
wifi: mac80211: mesh_plink: fix matches_local logic
wifi: cfg80211: fix certs build to not depend on file order

Josef Bacik (1):
btrfs: do not allow non subvolume root targets for snapshot

Kai Vehmanen (2):
ALSA: hda/hdmi: Add quirk to force pin connectivity on NUC10
ALSA: hda/hdmi: add force-connect quirk for NUC5CPYB

Kunwu Chan (1):
ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init

Liu Jian (1):
net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev()

Luiz Augusto von Dentz (3):
Bluetooth: hci_event: Fix not checking if HCI_OP_INQUIRY has been sent
Bluetooth: SMP: Convert BT_ERR/BT_DBG to bt_dev_err/bt_dev_dbg
Bluetooth: SMP: Fix crash when receiving new connection when debug is enabled

Mark Glover (1):
USB: serial: ftdi_sio: update Actisense PIDs constant names

Martin K. Petersen (2):
scsi: core: Add scsi_prot_ref_tag() helper
scsi: core: Make scsi_get_lba() return the LBA

Mike Tipton (1):
interconnect: Treat xlate() returning NULL node as an error

Mikulas Patocka (1):
dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata()

Moshe Shemesh (1):
net/mlx5: Fix fw tracer first block check

Namjae Jeon (1):
ksmbd: fix wrong name of SMB2_CREATE_ALLOCATION_SIZE

Pablo Neira Ayuso (1):
netfilter: nf_tables: skip set commit for deleted/destroyed sets

Paulo Alcantara (4):
smb: client: fix OOB in smb2_query_reparse_point()
smb: client: fix NULL deref in asn1_ber_decoder()
smb: client: fix OOB in SMB2_query_info_init()
smb: client: fix OOB in smbCalcSize()

Quan Nguyen (1):
i2c: aspeed: Handle the coalesced stop conditions with the start conditions.

Rahul Rameshbabu (1):
net/mlx5e: Correct snprintf truncation handling for fw_version buffer used by representors

Reinhard Speyerer (1):
USB: serial: option: add Quectel RM500Q R13 firmware support

Ronald Wahl (1):
net: ks8851: Fix TX stall caused by TX buffer overrun

Rouven Czerwinski (1):
net: rfkill: gpio: set GPIO direction

Shifeng Li (1):
net/mlx5e: Fix slab-out-of-bounds in mlx5_query_nic_vport_mac_list()

Slark Xiao (1):
USB: serial: option: add Foxconn T99W265 with new baseline

Steven Rostedt (Google) (3):
tracing / synthetic: Disable events after testing in synth_event_gen_test_init()
ring-buffer: Fix wake ups when buffer_percent is set to 100
tracing: Fix blocked reader of snapshot buffer

Su Hui (1):
iio: imu: inv_mpu6050: fix an error code problem in inv_mpu6050_read_raw

Thomas Gleixner (1):
x86/alternatives: Sync core before enabling interrupts

Tony Lindgren (2):
bus: ti-sysc: Flush posted write only after srst_udelay
ARM: dts: Fix occasional boot hang for am3 usb

Ville Baillie (1):
spi: atmel: Fix PDC transfer setup bug

Vlad Buslov (1):
Revert "net/mlx5e: fix double free of encap_header"

Wadim Egorov (1):
iio: adc: ti_am335x_adc: Fix return value check of tiadc_request_dma()

Wei Yongjun (1):
scsi: bnx2fc: Fix skb double free in bnx2fc_rcv()

Xiao Yao (1):
Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE

Zhipeng Lu (1):
ethernet: atheros: fix a memleak in atl1e_setup_ring_resources



2024-01-09 12:16:19

by Pavel Machek

[permalink] [raw]
Subject: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206

Hi!

> I'm announcing the release of the 5.10.206 kernel.


> Martin K. Petersen (2):
> scsi: core: Make scsi_get_lba() return the LBA

This is bad idea. This changes return value, but without fixing
callers; there will be subtle bugs somewhere.

At minimum, we need this:

87662a472a9d8980b26ba5803447df2c4981d467 scsi: iser: Use scsi_get_sector() instead of scsi_get_lba()

That will fix iser, but there's also:

drivers/s390/scsi/zfcp_fsf.c: io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
drivers/scsi/isci/request.c: tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
drivers/scsi/isci/request.c: tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
drivers/scsi/lpfc/lpfc_scsi.c: lba = scsi_get_lba(sc);
drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
drivers/scsi/lpfc/lpfc_scsi.c: start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: failing_sector = scsi_get_lba(cmd);
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
drivers/scsi/qla2xxx/qla_isr.c: cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
drivers/scsi/qla2xxx/qla_isr.c: sector_t lba_s = scsi_get_lba(cmd);
include/scsi/scsi_cmnd.h:static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)

That needs to be fixed somehow. This may be quite critical due to data
corruption...?

Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.


Attachments:
(No filename) (3.04 kB)
signature.asc (201.00 B)
Download all attachments

2024-01-09 14:13:58

by Martin K. Petersen

[permalink] [raw]
Subject: Re: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206


Pavel,

> This is bad idea. This changes return value, but without fixing
> callers; there will be subtle bugs somewhere.

I'm not sure why this particular change was backported since it was part
of a larger cleanup of explicitly distinguishing between block layer
sectors and device-specific LBAs. This was done to fix devices using PI
with 4 KB blocks which would otherwise end up getting programmed with
the wrong reference tag value.

> At minimum, we need this:
>
> 87662a472a9d8980b26ba5803447df2c4981d467 scsi: iser: Use scsi_get_sector() instead of scsi_get_lba()

I agree this would be appropriate. Otherwise we'll print the error being
at the wrong sector in case of an error on a PI device with 4 KB blocks.
However, the message is purely informative.

> That will fix iser, but there's also:
>
> drivers/s390/scsi/zfcp_fsf.c: io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
> drivers/scsi/isci/request.c: tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
> drivers/scsi/isci/request.c: tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
> drivers/scsi/lpfc/lpfc_scsi.c: lba = scsi_get_lba(sc);
> drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> drivers/scsi/lpfc/lpfc_scsi.c: start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: failing_sector = scsi_get_lba(cmd);
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> drivers/scsi/qla2xxx/qla_isr.c: cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
> drivers/scsi/qla2xxx/qla_isr.c: sector_t lba_s = scsi_get_lba(cmd);

Save for two cases in lpfc_queuecommand (which like the iser case will
print the wrong sector number on error) all these look OK to me. Note
that almost all callers of scsi_get_lba() actually intended to get the
protocol LBA as the name indicates and not the block layer sector
number.

--
Martin K. Petersen Oracle Linux Engineering

2024-01-10 09:17:52

by Greg KH

[permalink] [raw]
Subject: Re: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206

On Tue, Jan 09, 2024 at 08:55:52AM -0500, Martin K. Petersen wrote:
>
> Pavel,
>
> > This is bad idea. This changes return value, but without fixing
> > callers; there will be subtle bugs somewhere.
>
> I'm not sure why this particular change was backported since it was part
> of a larger cleanup of explicitly distinguishing between block layer
> sectors and device-specific LBAs. This was done to fix devices using PI
> with 4 KB blocks which would otherwise end up getting programmed with
> the wrong reference tag value.
>
> > At minimum, we need this:
> >
> > 87662a472a9d8980b26ba5803447df2c4981d467 scsi: iser: Use scsi_get_sector() instead of scsi_get_lba()
>
> I agree this would be appropriate. Otherwise we'll print the error being
> at the wrong sector in case of an error on a PI device with 4 KB blocks.
> However, the message is purely informative.
>
> > That will fix iser, but there's also:
> >
> > drivers/s390/scsi/zfcp_fsf.c: io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
> > drivers/scsi/isci/request.c: tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
> > drivers/scsi/isci/request.c: tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
> > drivers/scsi/lpfc/lpfc_scsi.c: lba = scsi_get_lba(sc);
> > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > drivers/scsi/lpfc/lpfc_scsi.c: start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: failing_sector = scsi_get_lba(cmd);
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > drivers/scsi/qla2xxx/qla_isr.c: cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
> > drivers/scsi/qla2xxx/qla_isr.c: sector_t lba_s = scsi_get_lba(cmd);
>
> Save for two cases in lpfc_queuecommand (which like the iser case will
> print the wrong sector number on error) all these look OK to me. Note
> that almost all callers of scsi_get_lba() actually intended to get the
> protocol LBA as the name indicates and not the block layer sector
> number.

Ick, this is going to get complex fast. How about I revert the whole
series, and then just add the one bugfix at the end, in a "fixed by
hand" version like I have here below. Would that be better overall?

Thanks,

greg k-h


diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 0c4bc42b55c2..3d3d139127ee 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1069,6 +1069,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,

scsi_log_send(scmd);
scmd->scsi_done = scsi_eh_done;
+ scmd->flags |= SCMD_LAST;

/*
* Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
@@ -2361,6 +2362,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
scsi_init_command(dev, scmd);
scmd->request = rq;
scmd->cmnd = scsi_req(rq)->cmd;
+ scmd->flags |= SCMD_LAST;

scmd->scsi_done = scsi_reset_provider_done_command;
memset(&scmd->sdb, 0, sizeof(scmd->sdb));

2024-01-11 09:47:42

by Greg KH

[permalink] [raw]
Subject: Re: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206

On Wed, Jan 10, 2024 at 10:15:34AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Jan 09, 2024 at 08:55:52AM -0500, Martin K. Petersen wrote:
> >
> > Pavel,
> >
> > > This is bad idea. This changes return value, but without fixing
> > > callers; there will be subtle bugs somewhere.
> >
> > I'm not sure why this particular change was backported since it was part
> > of a larger cleanup of explicitly distinguishing between block layer
> > sectors and device-specific LBAs. This was done to fix devices using PI
> > with 4 KB blocks which would otherwise end up getting programmed with
> > the wrong reference tag value.
> >
> > > At minimum, we need this:
> > >
> > > 87662a472a9d8980b26ba5803447df2c4981d467 scsi: iser: Use scsi_get_sector() instead of scsi_get_lba()
> >
> > I agree this would be appropriate. Otherwise we'll print the error being
> > at the wrong sector in case of an error on a PI device with 4 KB blocks.
> > However, the message is purely informative.
> >
> > > That will fix iser, but there's also:
> > >
> > > drivers/s390/scsi/zfcp_fsf.c: io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
> > > drivers/scsi/isci/request.c: tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
> > > drivers/scsi/isci/request.c: tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
> > > drivers/scsi/lpfc/lpfc_scsi.c: lba = scsi_get_lba(sc);
> > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > > drivers/scsi/lpfc/lpfc_scsi.c: reftag = (uint32_t)scsi_get_lba(sc); /* Truncate LBA */
> > > drivers/scsi/lpfc/lpfc_scsi.c: start_ref_tag = (uint32_t)scsi_get_lba(cmd); /* Truncate LBA */
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: failing_sector = scsi_get_lba(cmd);
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> > > drivers/scsi/lpfc/lpfc_scsi.c: (unsigned long long)scsi_get_lba(cmnd),
> > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > > drivers/scsi/qla2xxx/qla_iocb.c: (0xffffffff & scsi_get_lba(cmd)));
> > > drivers/scsi/qla2xxx/qla_isr.c: cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
> > > drivers/scsi/qla2xxx/qla_isr.c: sector_t lba_s = scsi_get_lba(cmd);
> >
> > Save for two cases in lpfc_queuecommand (which like the iser case will
> > print the wrong sector number on error) all these look OK to me. Note
> > that almost all callers of scsi_get_lba() actually intended to get the
> > protocol LBA as the name indicates and not the block layer sector
> > number.
>
> Ick, this is going to get complex fast. How about I revert the whole
> series, and then just add the one bugfix at the end, in a "fixed by
> hand" version like I have here below. Would that be better overall?
>
> Thanks,
>
> greg k-h
>
>
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 0c4bc42b55c2..3d3d139127ee 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -1069,6 +1069,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
>
> scsi_log_send(scmd);
> scmd->scsi_done = scsi_eh_done;
> + scmd->flags |= SCMD_LAST;
>
> /*
> * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
> @@ -2361,6 +2362,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
> scsi_init_command(dev, scmd);
> scmd->request = rq;
> scmd->cmnd = scsi_req(rq)->cmd;
> + scmd->flags |= SCMD_LAST;
>
> scmd->scsi_done = scsi_reset_provider_done_command;
> memset(&scmd->sdb, 0, sizeof(scmd->sdb));

Ok, I have now done this and will push out a -rc1 with these changes in
it.

greg k-h
>

2024-01-12 02:21:40

by Martin K. Petersen

[permalink] [raw]
Subject: Re: scsi_get_lba breakage in 5.10 -- Re: Linux 5.10.206


Greg,

>> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
>> index 0c4bc42b55c2..3d3d139127ee 100644
>> --- a/drivers/scsi/scsi_error.c
>> +++ b/drivers/scsi/scsi_error.c
>> @@ -1069,6 +1069,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd,
>>
>> scsi_log_send(scmd);
>> scmd->scsi_done = scsi_eh_done;
>> + scmd->flags |= SCMD_LAST;
>>
>> /*
>> * Lock sdev->state_mutex to avoid that scsi_device_quiesce() can
>> @@ -2361,6 +2362,7 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
>> scsi_init_command(dev, scmd);
>> scmd->request = rq;
>> scmd->cmnd = scsi_req(rq)->cmd;
>> + scmd->flags |= SCMD_LAST;
>>
>> scmd->scsi_done = scsi_reset_provider_done_command;
>> memset(&scmd->sdb, 0, sizeof(scmd->sdb));
>
> Ok, I have now done this and will push out a -rc1 with these changes in
> it.

Yeah, no need to bring in all those PI updates with associated driver
changes just for this.

--
Martin K. Petersen Oracle Linux Engineering