* [PATCH] imsm: fix reading scsi serial
@ 2017-11-02 15:10 Artur Paszkiewicz
2017-11-02 15:33 ` Jes Sorensen
0 siblings, 1 reply; 2+ messages in thread
From: Artur Paszkiewicz @ 2017-11-02 15:10 UTC (permalink / raw)
To: jes.sorensen; +Cc: linux-raid, neilb, Artur Paszkiewicz
Improve error detection after SG_IO ioctl. Checking only the return
value and response length is insufficient and leads to anomalies if a
drive does not have a serial number.
Reported-by: NeilBrown <neilb@suse.com>
Tested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
---
Mailing list discussion: https://marc.info/?l=linux-raid&m=150950864700415&w=2
sg_io.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sg_io.c b/sg_io.c
index 42c91e1e..7889a95e 100644
--- a/sg_io.c
+++ b/sg_io.c
@@ -46,6 +46,9 @@ int scsi_get_serial(int fd, void *buf, size_t buf_len)
if (rv)
return rv;
+ if ((io_hdr.info & SG_INFO_OK_MASK) != SG_INFO_OK)
+ return -1;
+
rsp_len = rsp_buf[3];
if (!rsp_len || buf_len < rsp_len)
--
2.14.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] imsm: fix reading scsi serial
2017-11-02 15:10 [PATCH] imsm: fix reading scsi serial Artur Paszkiewicz
@ 2017-11-02 15:33 ` Jes Sorensen
0 siblings, 0 replies; 2+ messages in thread
From: Jes Sorensen @ 2017-11-02 15:33 UTC (permalink / raw)
To: Artur Paszkiewicz; +Cc: linux-raid, neilb
On 11/02/2017 11:10 AM, Artur Paszkiewicz wrote:
> Improve error detection after SG_IO ioctl. Checking only the return
> value and response length is insufficient and leads to anomalies if a
> drive does not have a serial number.
>
> Reported-by: NeilBrown <neilb@suse.com>
> Tested-by: NeilBrown <neilb@suse.com>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> ---
> Mailing list discussion: https://marc.info/?l=linux-raid&m=150950864700415&w=2
>
> sg_io.c | 3 +++
> 1 file changed, 3 insertions(+)
Seems reasonable - applied!
Thanks,
Jes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-02 15:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-02 15:10 [PATCH] imsm: fix reading scsi serial Artur Paszkiewicz
2017-11-02 15:33 ` Jes Sorensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).