Skip to content

Commit 8f5d9f2

Browse files
committed
compat_ioctl: ppp: move simple commands into ppp_generic.c
All ppp commands that are not already handled in ppp_compat_ioctl() are compatible, so they can now handled by calling the native ppp_ioctl() directly. Without CONFIG_BLOCK, the generic compat_ioctl table is now empty, so add a check to avoid a build failure in the looking function for that configuration. Cc: [email protected] Cc: [email protected] Cc: Paul Mackerras <[email protected]> Cc: "David S. Miller" <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 17c7e7f commit 8f5d9f2

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

drivers/net/ppp/ppp_generic.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,10 @@ static long ppp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long
903903
}
904904
mutex_unlock(&ppp_mutex);
905905

906+
/* all other commands have compatible arguments */
907+
if (err == -ENOIOCTLCMD)
908+
err = ppp_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
909+
906910
return err;
907911
}
908912
#endif

fs/compat_ioctl.c

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -144,38 +144,6 @@ COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE)
144144
COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN)
145145
COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN)
146146
#endif
147-
/* PPP stuff */
148-
COMPATIBLE_IOCTL(PPPIOCGFLAGS)
149-
COMPATIBLE_IOCTL(PPPIOCSFLAGS)
150-
COMPATIBLE_IOCTL(PPPIOCGASYNCMAP)
151-
COMPATIBLE_IOCTL(PPPIOCSASYNCMAP)
152-
COMPATIBLE_IOCTL(PPPIOCGUNIT)
153-
COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP)
154-
COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP)
155-
COMPATIBLE_IOCTL(PPPIOCGMRU)
156-
COMPATIBLE_IOCTL(PPPIOCSMRU)
157-
COMPATIBLE_IOCTL(PPPIOCSMAXCID)
158-
COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP)
159-
COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP)
160-
COMPATIBLE_IOCTL(PPPIOCXFERUNIT)
161-
/* PPPIOCSCOMPRESS is translated */
162-
COMPATIBLE_IOCTL(PPPIOCGNPMODE)
163-
COMPATIBLE_IOCTL(PPPIOCSNPMODE)
164-
COMPATIBLE_IOCTL(PPPIOCGDEBUG)
165-
COMPATIBLE_IOCTL(PPPIOCSDEBUG)
166-
/* PPPIOCSPASS is translated */
167-
/* PPPIOCSACTIVE is translated */
168-
COMPATIBLE_IOCTL(PPPIOCGIDLE32)
169-
COMPATIBLE_IOCTL(PPPIOCGIDLE64)
170-
COMPATIBLE_IOCTL(PPPIOCNEWUNIT)
171-
COMPATIBLE_IOCTL(PPPIOCATTACH)
172-
COMPATIBLE_IOCTL(PPPIOCDETACH)
173-
COMPATIBLE_IOCTL(PPPIOCSMRRU)
174-
COMPATIBLE_IOCTL(PPPIOCCONNECT)
175-
COMPATIBLE_IOCTL(PPPIOCDISCONN)
176-
COMPATIBLE_IOCTL(PPPIOCATTCHAN)
177-
COMPATIBLE_IOCTL(PPPIOCGCHAN)
178-
COMPATIBLE_IOCTL(PPPIOCGL2TPSTATS)
179147
};
180148

181149
/*
@@ -202,6 +170,7 @@ static long do_ioctl_trans(unsigned int cmd,
202170

203171
static int compat_ioctl_check_table(unsigned int xcmd)
204172
{
173+
#ifdef CONFIG_BLOCK
205174
int i;
206175
const int max = ARRAY_SIZE(ioctl_pointer) - 1;
207176

@@ -220,6 +189,9 @@ static int compat_ioctl_check_table(unsigned int xcmd)
220189
i--;
221190

222191
return ioctl_pointer[i] == xcmd;
192+
#else
193+
return 0;
194+
#endif
223195
}
224196

225197
COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd,

0 commit comments

Comments
 (0)