On 2020/11/29 7:27, James Bottomley wrote:
---8>8>8><8<8<8-------- From: James Bottomley James.Bottomley@HansenPartnership.com Subject: [PATCH] scsi: ses: don't attach if enclosure has no components
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.
Reported-by: Ding Hui dinghui@sangfor.com.cn Cc: stable@vger.kernel.org Signed-off-by: James Bottomley James.Bottomley@HansenPartnership.com
drivers/scsi/ses.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index c2afba2a5414..9624298b9c89 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c @@ -690,6 +690,11 @@ static int ses_intf_add(struct device *cdev, type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE) components += type_ptr[1]; }
- if (components == 0) {
sdev_printk(KERN_ERR, sdev, "enclosure has no enumerated components\n");
goto err_free;
- }
- ses_dev->page1 = buf; ses_dev->page1_len = len; buf = NULL;
Can I ask you to resubmit your patch ("scsi: ses: don't attach if enclosure has no components") to kernel, thanks