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

Configure Feed

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

net/9p: insulate the client against an invalid error code sent by a 9p server

A looney tunes server sending an invalid error code (which is !IS_ERR_VALUE)
can result in a client oops. So fix it by adding a check and converting unknown
or invalid error codes to -ESERVERFAULT.

Signed-off-by: Abhishek Kulkarni <adkulkar@umail.iu.edu>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

authored by

Abhishek Kulkarni and committed by
Eric Van Hensbergen
0aad37ef 48559b4c

+2 -7
+1 -6
net/9p/client.c
··· 411 411 if (c->dotu) 412 412 err = -ecode; 413 413 414 - if (!err) { 414 + if (!err || !IS_ERR_VALUE(err)) 415 415 err = p9_errstr2errno(ename, strlen(ename)); 416 - 417 - /* string match failed */ 418 - if (!err) 419 - err = -ESERVERFAULT; 420 - } 421 416 422 417 P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); 423 418
+1 -1
net/9p/error.c
··· 239 239 errstr[len] = 0; 240 240 printk(KERN_ERR "%s: server reported unknown error %s\n", 241 241 __func__, errstr); 242 - errno = 1; 242 + errno = ESERVERFAULT; 243 243 } 244 244 245 245 return -errno;