Unverified Commit c01c470f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2286 scsi: lpfc: Prevent lpfc_debugfs_lockstat_write() buffer overflow

parents b4ca97ce 50853c0e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2159,10 +2159,13 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf,
	char mybuf[64];
	char *pbuf;
	int i;
	size_t bsize;

	memset(mybuf, 0, sizeof(mybuf));

	if (copy_from_user(mybuf, buf, nbytes))
	bsize = min(nbytes, (sizeof(mybuf) - 1));

	if (copy_from_user(mybuf, buf, bsize))
		return -EFAULT;
	pbuf = &mybuf[0];

@@ -2183,7 +2186,7 @@ lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf,
			qp->lock_conflict.wq_access = 0;
		}
	}
	return nbytes;
	return bsize;
}
#endif