Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ipmi: ssif_bmc: fix missing check for copy_to_user() partial failure

copy_to_user() returns the number of bytes that could not be copied,
with a non-zero value indicating a partial or complete failure. The
current code only checks for negative return values and treats all
non-negative results as success.

Treating any positive return value from copy_to_user() as
an error and returning -EFAULT.

Fixes: dd2bc5cc9e25 ("ipmi: ssif_bmc: Add SSIF BMC driver")
Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
Message-ID: <20260403090603.3988423-2-zhangjian.3032@bytedance.com>
Signed-off-by: Corey Minyard <corey@minyard.net>

authored by

Jian Zhang and committed by
Corey Minyard
ea641be7 7fc3e254

+2
+2
drivers/char/ipmi/ssif_bmc.c
··· 163 163 spin_unlock_irqrestore(&ssif_bmc->lock, flags); 164 164 165 165 ret = copy_to_user(buf, &msg, count); 166 + if (ret > 0) 167 + ret = -EFAULT; 166 168 } 167 169 168 170 return (ret < 0) ? ret : count;