linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cheng Lin <cheng.lin130@zte.com.cn>
To: mcgrof@kernel.org
Cc: keescook@chromium.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, zhong.weidong@zte.com.cn,
	wang.yi59@zte.com.cn, Cheng Lin <cheng.lin130@zte.com.cn>
Subject: [PATCH] proc/sysctl: fix return error for proc_doulongvec_minmax
Date: Fri, 30 Nov 2018 14:35:17 +0800	[thread overview]
Message-ID: <1543559717-27534-1-git-send-email-cheng.lin130@zte.com.cn> (raw)

If the number of input parameters is less than the total
parameters, an INVAL error will be returned.

This patch ensure no error returned in this condition, just
like other interfaces do.

Signed-off-by: Cheng Lin <cheng.lin130@zte.com.cn>
---
 kernel/sysctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 5fc724e..9ee261f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2779,6 +2779,8 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
 			bool neg;
 
 			left -= proc_skip_spaces(&p);
+			if (!left)
+				break;
 
 			err = proc_get_long(&p, &left, &val, &neg,
 					     proc_wspace_sep,
-- 
1.8.3.1


             reply	other threads:[~2018-11-30  6:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-30  6:35 Cheng Lin [this message]
2018-11-30 19:14 ` [PATCH] proc/sysctl: fix return error for proc_doulongvec_minmax Luis Chamberlain
     [not found]   ` <201812031312398404610@zte.com.cn>
2018-12-03 20:14     ` Luis Chamberlain
     [not found]       ` <201812051510071985717@zte.com.cn>
2018-12-05 18:08         ` Re: Re: [PATCH] proc/sysctl: fix return error forproc_doulongvec_minmax Luis Chamberlain
2018-12-05 23:30       ` Re: [PATCH] proc/sysctl: fix return error for proc_doulongvec_minmax Kees Cook
2018-12-06  7:36 Cheng Lin
2018-12-06  8:52 ` Luis Chamberlain
2018-12-06 20:57   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543559717-27534-1-git-send-email-cheng.lin130@zte.com.cn \
    --to=cheng.lin130@zte.com.cn \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=wang.yi59@zte.com.cn \
    --cc=zhong.weidong@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).