mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
powerpc/pseries: lparcfg - fix kbuf[] underflow
In lparcfg_write(), a count of 0 results in kbuf[] being indexed at -1.
Check for count == 0 in the existing check for count > sizeof(kbuf) and
return -EINVAL if true.
Fixes: 74422e2b19 ("powerpc/pseries: Remove VLA from lparcfg_write()")
Acked-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: R Nageswara Sastry <rnsastry@linux.ibm.com>
Cc: stable@vger.kernel.org # 4.20
Signed-off-by: George Wilson <gcwilson@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
This commit is contained in:
parent
649c10bff5
commit
fb442a6673
|
|
@ -699,7 +699,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
|
|||
if (!firmware_has_feature(FW_FEATURE_SPLPAR))
|
||||
return -EINVAL;
|
||||
|
||||
if (count > sizeof(kbuf))
|
||||
if (count == 0 || count > sizeof(kbuf))
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(kbuf, buf, count))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user