This is a note to let you know that I've just added the patch titled scsi: ses: Don't attach if enclosure has no components to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: scsi-ses-don-t-attach-if-enclosure-has-no-components.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3fe97ff3d94934649abb0652028dd7296170c8d0 Mon Sep 17 00:00:00 2001 From: James Bottomley <jejb@xxxxxxxxxxxxx> Date: Sat, 28 Nov 2020 15:27:21 -0800 Subject: scsi: ses: Don't attach if enclosure has no components From: James Bottomley <jejb@xxxxxxxxxxxxx> commit 3fe97ff3d94934649abb0652028dd7296170c8d0 upstream. An enclosure with no components can't usefully be operated by the driver (since effectively it has nothing to manage), so report the problem and don't attach. Not attaching also fixes an oops which could occur if the driver tries to manage a zero component enclosure. [mkp: Switched to KERN_WARNING since this scenario is common] Link: https://lore.kernel.org/r/c5deac044ac409e32d9ad9968ce0dcbc996bfc7a.camel@xxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx Reported-by: Ding Hui <dinghui@xxxxxxxxxxxxxx> Signed-off-by: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/scsi/ses.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -704,6 +704,12 @@ static int ses_intf_add(struct device *c type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; } + + if (components == 0) { + sdev_printk(KERN_WARNING, sdev, "enclosure has no enumerated components\n"); + goto err_free; + } + ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL; Patches currently in stable-queue which might be from jejb@xxxxxxxxxxxxx are queue-6.2/scsi-snic-fix-memory-leak-with-using-debugfs_lookup.patch queue-6.2/scsi-aacraid-allocate-cmd_priv-with-scsicmd.patch queue-6.2/scsi-ses-don-t-attach-if-enclosure-has-no-components.patch