Re: [GIT PULL] xen: xenfs fixes for 4.9-rc2

From: Linus Torvalds
Date: Mon Oct 24 2016 - 23:28:41 EST


On Mon, Oct 24, 2016 at 9:37 AM, David Vrabel <dvrabel@xxxxxxxxxx> wrote:
>
> I think the changes are trivial and uncontroversial.

Hmm. Sadly, they are also buggy.

This:

if (files->mode & S_IFLNK) {

is simply wrong. The correct test for S_IFLNK is to do

if ((files->mode & S_IFMT) == S_IFLNK) {

and quite frankly, the right model is almost certainly to just do a
switch-statement that does something like

switch (files->mode & S_IFMT) {
case S_IFLNK:
...
case S_IFREG:
case 0:
....
default:
..error..

because maybe somebody wants to add other cases later (and even if
not, it's just wrong to randomly change any other mode into S_IFREG).

And while I could easily do an evil merge and fix that part up, I
really don't want to do things like that. So I'm not going to pull
this.

Linus