scst: Avoid that setting trace_level triggers an infinite loop (partial merge of trunk r4137)

Avoid that e.g. the following command triggers an infinite loop
echo "value 0x9c" > /sys/kernel/scst_tgt/trace_level

Reported-by: Jin Cheng <jcheng@vmem.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4665 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-12-27 08:53:40 +00:00
parent 1052aa7bce
commit a3288d27e3

View File

@@ -147,7 +147,7 @@ static int scst_write_trace(const char *buf, size_t length,
unsigned long *log_level, unsigned long default_level,
const char *name, const struct scst_trace_log *tbl)
{
int res = length;
int res;
int action;
unsigned long level = 0, oldlevel;
char *buffer, *p, *e;
@@ -286,6 +286,8 @@ static int scst_write_trace(const char *buf, size_t length,
PRINT_INFO("Changed trace level for \"%s\": old 0x%08lx, new 0x%08lx",
name, oldlevel, *log_level);
res = length;
out_free:
kfree(buffer);
out: