Re: [PATCH] scsi: qedf: Avoid reading past end of buffer

2017-05-08 Thread Martin K. Petersen
Kees, > Using memcpy() from a string that is shorter than the length copied > means the destination buffer is being filled with arbitrary data from > the kernel rodata segment. Instead, use strncpy() which will fill the > trailing bytes with zeros. Applied to 4.12/scsi-fixes, thanks! --

Re: [PATCH] scsi: qedf: Avoid reading past end of buffer

2017-05-06 Thread Chad Dupuis
On Fri, 5 May 2017, 7:10pm, Kees Cook wrote: > On Fri, May 5, 2017 at 4:01 PM, Bart Van Assche > wrote: > > On Fri, 2017-05-05 at 15:42 -0700, Kees Cook wrote: > >> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c > >> index

Re: [PATCH] scsi: qedf: Avoid reading past end of buffer

2017-05-05 Thread Kees Cook
On Fri, May 5, 2017 at 4:01 PM, Bart Van Assche wrote: > On Fri, 2017-05-05 at 15:42 -0700, Kees Cook wrote: >> diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c >> index cceddd995a4b..a5c97342fd5d 100644 >> --- a/drivers/scsi/qedf/qedf_main.c

Re: [PATCH] scsi: qedf: Avoid reading past end of buffer

2017-05-05 Thread Bart Van Assche
On Fri, 2017-05-05 at 15:42 -0700, Kees Cook wrote: > diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c > index cceddd995a4b..a5c97342fd5d 100644 > --- a/drivers/scsi/qedf/qedf_main.c > +++ b/drivers/scsi/qedf/qedf_main.c > @@ -2895,7 +2895,7 @@ static int

[PATCH] scsi: qedf: Avoid reading past end of buffer

2017-05-05 Thread Kees Cook
Using memcpy() from a string that is shorter than the length copied means the destination buffer is being filled with arbitrary data from the kernel rodata segment. Instead, use strncpy() which will fill the trailing bytes with zeros. This was found with the future CONFIG_FORTIFY_SOURCE feature.