lpfc: fix missing zero termination in debugfs
Subsystems (2)
PATCH 1/1 lpfc: fix missing zero termination in debugfs
If you feed 32 bytes in then the kstrtoull() doesn't receive a terminated string so will run off the end.
Signed-off-by Alan Cox <[email protected]>
--- drivers/scsi/lpfc/lpfc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -1054,11 +1054,11 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, {struct dentry *dent = file->f_path.dentry;struct lpfc_hba *phba = file->private_data; -char dstbuf[32 ]; +char dstbuf[33 ];uint64_t tmp =0 ;int size; -memset (dstbuf,0 ,32 ); +memset (dstbuf,0 ,33 ); size = (nbytes <32 ) ? nbytes :32 ;if (copy_from_user (dstbuf, buf, size))return 0 ;
Quoted 17 lines · Alan
If you feed 32 bytes in then the
kstrtoull()doesn't receive a terminated string so will run off the end.Signed-off-by Alan Cox <[email protected]>--- drivers/scsi/lpfc/lpfc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_debugfs.c +0
-0@@ -1054,11 +1054,11 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, {struct dentry *dent = file->f_path.dentry;struct lpfc_hba *phba = file->private_data;
drivers/scsi/lpfc/lpfc_debugfs.c lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, · line 1064
Quoted 10 lines
drivers/scsi/lpfc/lpfc_debugfs.c +2
-2-char dstbuf[32 ]; +char dstbuf[33 ];uint64_t tmp =0 ;int size; -memset (dstbuf,0 ,32 ); +memset (dstbuf,0 ,33 ); size = (nbytes <32 ) ? nbytes :32 ;if (copy_from_user (dstbuf, buf, size))return 0 ;
Reviewed-by Johannes Thumshirn <[email protected]>
Signature · 10 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Martin K. Petersen
AppliedQuoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Alan" == Alan <[email protected]> writes:
Alan> If you feed 32 bytes in then the kstrtoull() doesn't receive a Alan> terminated string so will run off the end.
Applied to 4.6/scsi-queue.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering