ioctl.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. * ioctl.c
  3. *
  4. * Copyright (C) 1995, 1996 by Volker Lendecke
  5. * Modified 1997 Peter Waltenberg, Bill Hawes, David Woodhouse for 2.1 dcache
  6. * Modified 1998, 1999 Wolfram Pienkoss for NLS
  7. *
  8. */
  9. #include <linux/config.h>
  10. #include <asm/uaccess.h>
  11. #include <linux/capability.h>
  12. #include <linux/errno.h>
  13. #include <linux/fs.h>
  14. #include <linux/ioctl.h>
  15. #include <linux/time.h>
  16. #include <linux/mm.h>
  17. #include <linux/highuid.h>
  18. #include <linux/vmalloc.h>
  19. #include <linux/ncp_fs.h>
  20. #include "ncplib_kernel.h"
  21. /* maximum limit for ncp_objectname_ioctl */
  22. #define NCP_OBJECT_NAME_MAX_LEN 4096
  23. /* maximum limit for ncp_privatedata_ioctl */
  24. #define NCP_PRIVATE_DATA_MAX_LEN 8192
  25. /* maximum negotiable packet size */
  26. #define NCP_PACKET_SIZE_INTERNAL 65536
  27. static int
  28. ncp_get_fs_info(struct ncp_server * server, struct file *file,
  29. struct ncp_fs_info __user *arg)
  30. {
  31. struct inode *inode = file->f_dentry->d_inode;
  32. struct ncp_fs_info info;
  33. if ((file_permission(file, MAY_WRITE) != 0)
  34. && (current->uid != server->m.mounted_uid)) {
  35. return -EACCES;
  36. }
  37. if (copy_from_user(&info, arg, sizeof(info)))
  38. return -EFAULT;
  39. if (info.version != NCP_GET_FS_INFO_VERSION) {
  40. DPRINTK("info.version invalid: %d\n", info.version);
  41. return -EINVAL;
  42. }
  43. /* TODO: info.addr = server->m.serv_addr; */
  44. SET_UID(info.mounted_uid, server->m.mounted_uid);
  45. info.connection = server->connection;
  46. info.buffer_size = server->buffer_size;
  47. info.volume_number = NCP_FINFO(inode)->volNumber;
  48. info.directory_id = NCP_FINFO(inode)->DosDirNum;
  49. if (copy_to_user(arg, &info, sizeof(info)))
  50. return -EFAULT;
  51. return 0;
  52. }
  53. static int
  54. ncp_get_fs_info_v2(struct ncp_server * server, struct file *file,
  55. struct ncp_fs_info_v2 __user * arg)
  56. {
  57. struct inode *inode = file->f_dentry->d_inode;
  58. struct ncp_fs_info_v2 info2;
  59. if ((file_permission(file, MAY_WRITE) != 0)
  60. && (current->uid != server->m.mounted_uid)) {
  61. return -EACCES;
  62. }
  63. if (copy_from_user(&info2, arg, sizeof(info2)))
  64. return -EFAULT;
  65. if (info2.version != NCP_GET_FS_INFO_VERSION_V2) {
  66. DPRINTK("info.version invalid: %d\n", info2.version);
  67. return -EINVAL;
  68. }
  69. info2.mounted_uid = server->m.mounted_uid;
  70. info2.connection = server->connection;
  71. info2.buffer_size = server->buffer_size;
  72. info2.volume_number = NCP_FINFO(inode)->volNumber;
  73. info2.directory_id = NCP_FINFO(inode)->DosDirNum;
  74. info2.dummy1 = info2.dummy2 = info2.dummy3 = 0;
  75. if (copy_to_user(arg, &info2, sizeof(info2)))
  76. return -EFAULT;
  77. return 0;
  78. }
  79. #ifdef CONFIG_NCPFS_NLS
  80. /* Here we are select the iocharset and the codepage for NLS.
  81. * Thanks Petr Vandrovec for idea and many hints.
  82. */
  83. static int
  84. ncp_set_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
  85. {
  86. struct ncp_nls_ioctl user;
  87. struct nls_table *codepage;
  88. struct nls_table *iocharset;
  89. struct nls_table *oldset_io;
  90. struct nls_table *oldset_cp;
  91. if (!capable(CAP_SYS_ADMIN))
  92. return -EACCES;
  93. if (server->root_setuped)
  94. return -EBUSY;
  95. if (copy_from_user(&user, arg, sizeof(user)))
  96. return -EFAULT;
  97. codepage = NULL;
  98. user.codepage[NCP_IOCSNAME_LEN] = 0;
  99. if (!user.codepage[0] || !strcmp(user.codepage, "default"))
  100. codepage = load_nls_default();
  101. else {
  102. codepage = load_nls(user.codepage);
  103. if (!codepage) {
  104. return -EBADRQC;
  105. }
  106. }
  107. iocharset = NULL;
  108. user.iocharset[NCP_IOCSNAME_LEN] = 0;
  109. if (!user.iocharset[0] || !strcmp(user.iocharset, "default")) {
  110. iocharset = load_nls_default();
  111. NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
  112. } else if (!strcmp(user.iocharset, "utf8")) {
  113. iocharset = load_nls_default();
  114. NCP_SET_FLAG(server, NCP_FLAG_UTF8);
  115. } else {
  116. iocharset = load_nls(user.iocharset);
  117. if (!iocharset) {
  118. unload_nls(codepage);
  119. return -EBADRQC;
  120. }
  121. NCP_CLR_FLAG(server, NCP_FLAG_UTF8);
  122. }
  123. oldset_cp = server->nls_vol;
  124. server->nls_vol = codepage;
  125. oldset_io = server->nls_io;
  126. server->nls_io = iocharset;
  127. if (oldset_cp)
  128. unload_nls(oldset_cp);
  129. if (oldset_io)
  130. unload_nls(oldset_io);
  131. return 0;
  132. }
  133. static int
  134. ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
  135. {
  136. struct ncp_nls_ioctl user;
  137. int len;
  138. memset(&user, 0, sizeof(user));
  139. if (server->nls_vol && server->nls_vol->charset) {
  140. len = strlen(server->nls_vol->charset);
  141. if (len > NCP_IOCSNAME_LEN)
  142. len = NCP_IOCSNAME_LEN;
  143. strncpy(user.codepage, server->nls_vol->charset, len);
  144. user.codepage[len] = 0;
  145. }
  146. if (NCP_IS_FLAG(server, NCP_FLAG_UTF8))
  147. strcpy(user.iocharset, "utf8");
  148. else if (server->nls_io && server->nls_io->charset) {
  149. len = strlen(server->nls_io->charset);
  150. if (len > NCP_IOCSNAME_LEN)
  151. len = NCP_IOCSNAME_LEN;
  152. strncpy(user.iocharset, server->nls_io->charset, len);
  153. user.iocharset[len] = 0;
  154. }
  155. if (copy_to_user(arg, &user, sizeof(user)))
  156. return -EFAULT;
  157. return 0;
  158. }
  159. #endif /* CONFIG_NCPFS_NLS */
  160. int ncp_ioctl(struct inode *inode, struct file *filp,
  161. unsigned int cmd, unsigned long arg)
  162. {
  163. struct ncp_server *server = NCP_SERVER(inode);
  164. int result;
  165. struct ncp_ioctl_request request;
  166. char* bouncebuffer;
  167. void __user *argp = (void __user *)arg;
  168. switch (cmd) {
  169. case NCP_IOC_NCPREQUEST:
  170. if ((file_permission(filp, MAY_WRITE) != 0)
  171. && (current->uid != server->m.mounted_uid)) {
  172. return -EACCES;
  173. }
  174. if (copy_from_user(&request, argp, sizeof(request)))
  175. return -EFAULT;
  176. if ((request.function > 255)
  177. || (request.size >
  178. NCP_PACKET_SIZE - sizeof(struct ncp_request_header))) {
  179. return -EINVAL;
  180. }
  181. bouncebuffer = vmalloc(NCP_PACKET_SIZE_INTERNAL);
  182. if (!bouncebuffer)
  183. return -ENOMEM;
  184. if (copy_from_user(bouncebuffer, request.data, request.size)) {
  185. vfree(bouncebuffer);
  186. return -EFAULT;
  187. }
  188. ncp_lock_server(server);
  189. /* FIXME: We hack around in the server's structures
  190. here to be able to use ncp_request */
  191. server->has_subfunction = 0;
  192. server->current_size = request.size;
  193. memcpy(server->packet, bouncebuffer, request.size);
  194. result = ncp_request2(server, request.function,
  195. bouncebuffer, NCP_PACKET_SIZE_INTERNAL);
  196. if (result < 0)
  197. result = -EIO;
  198. else
  199. result = server->reply_size;
  200. ncp_unlock_server(server);
  201. DPRINTK("ncp_ioctl: copy %d bytes\n",
  202. result);
  203. if (result >= 0)
  204. if (copy_to_user(request.data, bouncebuffer, result))
  205. result = -EFAULT;
  206. vfree(bouncebuffer);
  207. return result;
  208. case NCP_IOC_CONN_LOGGED_IN:
  209. if (!capable(CAP_SYS_ADMIN))
  210. return -EACCES;
  211. if (!(server->m.int_flags & NCP_IMOUNT_LOGGEDIN_POSSIBLE))
  212. return -EINVAL;
  213. if (server->root_setuped)
  214. return -EBUSY;
  215. server->root_setuped = 1;
  216. return ncp_conn_logged_in(inode->i_sb);
  217. case NCP_IOC_GET_FS_INFO:
  218. return ncp_get_fs_info(server, filp, argp);
  219. case NCP_IOC_GET_FS_INFO_V2:
  220. return ncp_get_fs_info_v2(server, filp, argp);
  221. case NCP_IOC_GETMOUNTUID2:
  222. {
  223. unsigned long tmp = server->m.mounted_uid;
  224. if ((file_permission(filp, MAY_READ) != 0)
  225. && (current->uid != server->m.mounted_uid))
  226. {
  227. return -EACCES;
  228. }
  229. if (put_user(tmp, (unsigned long __user *)argp))
  230. return -EFAULT;
  231. return 0;
  232. }
  233. case NCP_IOC_GETROOT:
  234. {
  235. struct ncp_setroot_ioctl sr;
  236. if ((file_permission(filp, MAY_READ) != 0)
  237. && (current->uid != server->m.mounted_uid))
  238. {
  239. return -EACCES;
  240. }
  241. if (server->m.mounted_vol[0]) {
  242. struct dentry* dentry = inode->i_sb->s_root;
  243. if (dentry) {
  244. struct inode* inode = dentry->d_inode;
  245. if (inode) {
  246. sr.volNumber = NCP_FINFO(inode)->volNumber;
  247. sr.dirEntNum = NCP_FINFO(inode)->dirEntNum;
  248. sr.namespace = server->name_space[sr.volNumber];
  249. } else
  250. DPRINTK("ncpfs: s_root->d_inode==NULL\n");
  251. } else
  252. DPRINTK("ncpfs: s_root==NULL\n");
  253. } else {
  254. sr.volNumber = -1;
  255. sr.namespace = 0;
  256. sr.dirEntNum = 0;
  257. }
  258. if (copy_to_user(argp, &sr, sizeof(sr)))
  259. return -EFAULT;
  260. return 0;
  261. }
  262. case NCP_IOC_SETROOT:
  263. {
  264. struct ncp_setroot_ioctl sr;
  265. __u32 vnum;
  266. __le32 de;
  267. __le32 dosde;
  268. struct dentry* dentry;
  269. if (!capable(CAP_SYS_ADMIN))
  270. {
  271. return -EACCES;
  272. }
  273. if (server->root_setuped) return -EBUSY;
  274. if (copy_from_user(&sr, argp, sizeof(sr)))
  275. return -EFAULT;
  276. if (sr.volNumber < 0) {
  277. server->m.mounted_vol[0] = 0;
  278. vnum = NCP_NUMBER_OF_VOLUMES;
  279. de = 0;
  280. dosde = 0;
  281. } else if (sr.volNumber >= NCP_NUMBER_OF_VOLUMES) {
  282. return -EINVAL;
  283. } else if (ncp_mount_subdir(server, sr.volNumber,
  284. sr.namespace, sr.dirEntNum,
  285. &vnum, &de, &dosde)) {
  286. return -ENOENT;
  287. }
  288. dentry = inode->i_sb->s_root;
  289. server->root_setuped = 1;
  290. if (dentry) {
  291. struct inode* inode = dentry->d_inode;
  292. if (inode) {
  293. NCP_FINFO(inode)->volNumber = vnum;
  294. NCP_FINFO(inode)->dirEntNum = de;
  295. NCP_FINFO(inode)->DosDirNum = dosde;
  296. } else
  297. DPRINTK("ncpfs: s_root->d_inode==NULL\n");
  298. } else
  299. DPRINTK("ncpfs: s_root==NULL\n");
  300. return 0;
  301. }
  302. #ifdef CONFIG_NCPFS_PACKET_SIGNING
  303. case NCP_IOC_SIGN_INIT:
  304. if ((file_permission(filp, MAY_WRITE) != 0)
  305. && (current->uid != server->m.mounted_uid))
  306. {
  307. return -EACCES;
  308. }
  309. if (argp) {
  310. if (server->sign_wanted)
  311. {
  312. struct ncp_sign_init sign;
  313. if (copy_from_user(&sign, argp, sizeof(sign)))
  314. return -EFAULT;
  315. memcpy(server->sign_root,sign.sign_root,8);
  316. memcpy(server->sign_last,sign.sign_last,16);
  317. server->sign_active = 1;
  318. }
  319. /* ignore when signatures not wanted */
  320. } else {
  321. server->sign_active = 0;
  322. }
  323. return 0;
  324. case NCP_IOC_SIGN_WANTED:
  325. if ((file_permission(filp, MAY_READ) != 0)
  326. && (current->uid != server->m.mounted_uid))
  327. {
  328. return -EACCES;
  329. }
  330. if (put_user(server->sign_wanted, (int __user *)argp))
  331. return -EFAULT;
  332. return 0;
  333. case NCP_IOC_SET_SIGN_WANTED:
  334. {
  335. int newstate;
  336. if ((file_permission(filp, MAY_WRITE) != 0)
  337. && (current->uid != server->m.mounted_uid))
  338. {
  339. return -EACCES;
  340. }
  341. /* get only low 8 bits... */
  342. if (get_user(newstate, (unsigned char __user *)argp))
  343. return -EFAULT;
  344. if (server->sign_active) {
  345. /* cannot turn signatures OFF when active */
  346. if (!newstate) return -EINVAL;
  347. } else {
  348. server->sign_wanted = newstate != 0;
  349. }
  350. return 0;
  351. }
  352. #endif /* CONFIG_NCPFS_PACKET_SIGNING */
  353. #ifdef CONFIG_NCPFS_IOCTL_LOCKING
  354. case NCP_IOC_LOCKUNLOCK:
  355. if ((file_permission(filp, MAY_WRITE) != 0)
  356. && (current->uid != server->m.mounted_uid))
  357. {
  358. return -EACCES;
  359. }
  360. {
  361. struct ncp_lock_ioctl rqdata;
  362. int result;
  363. if (copy_from_user(&rqdata, argp, sizeof(rqdata)))
  364. return -EFAULT;
  365. if (rqdata.origin != 0)
  366. return -EINVAL;
  367. /* check for cmd */
  368. switch (rqdata.cmd) {
  369. case NCP_LOCK_EX:
  370. case NCP_LOCK_SH:
  371. if (rqdata.timeout == 0)
  372. rqdata.timeout = NCP_LOCK_DEFAULT_TIMEOUT;
  373. else if (rqdata.timeout > NCP_LOCK_MAX_TIMEOUT)
  374. rqdata.timeout = NCP_LOCK_MAX_TIMEOUT;
  375. break;
  376. case NCP_LOCK_LOG:
  377. rqdata.timeout = NCP_LOCK_DEFAULT_TIMEOUT; /* has no effect */
  378. case NCP_LOCK_CLEAR:
  379. break;
  380. default:
  381. return -EINVAL;
  382. }
  383. /* locking needs both read and write access */
  384. if ((result = ncp_make_open(inode, O_RDWR)) != 0)
  385. {
  386. return result;
  387. }
  388. result = -EIO;
  389. if (!ncp_conn_valid(server))
  390. goto outrel;
  391. result = -EISDIR;
  392. if (!S_ISREG(inode->i_mode))
  393. goto outrel;
  394. if (rqdata.cmd == NCP_LOCK_CLEAR)
  395. {
  396. result = ncp_ClearPhysicalRecord(NCP_SERVER(inode),
  397. NCP_FINFO(inode)->file_handle,
  398. rqdata.offset,
  399. rqdata.length);
  400. if (result > 0) result = 0; /* no such lock */
  401. }
  402. else
  403. {
  404. int lockcmd;
  405. switch (rqdata.cmd)
  406. {
  407. case NCP_LOCK_EX: lockcmd=1; break;
  408. case NCP_LOCK_SH: lockcmd=3; break;
  409. default: lockcmd=0; break;
  410. }
  411. result = ncp_LogPhysicalRecord(NCP_SERVER(inode),
  412. NCP_FINFO(inode)->file_handle,
  413. lockcmd,
  414. rqdata.offset,
  415. rqdata.length,
  416. rqdata.timeout);
  417. if (result > 0) result = -EAGAIN;
  418. }
  419. outrel:
  420. ncp_inode_close(inode);
  421. return result;
  422. }
  423. #endif /* CONFIG_NCPFS_IOCTL_LOCKING */
  424. case NCP_IOC_GETOBJECTNAME:
  425. if (current->uid != server->m.mounted_uid) {
  426. return -EACCES;
  427. }
  428. {
  429. struct ncp_objectname_ioctl user;
  430. size_t outl;
  431. if (copy_from_user(&user, argp, sizeof(user)))
  432. return -EFAULT;
  433. user.auth_type = server->auth.auth_type;
  434. outl = user.object_name_len;
  435. user.object_name_len = server->auth.object_name_len;
  436. if (outl > user.object_name_len)
  437. outl = user.object_name_len;
  438. if (outl) {
  439. if (copy_to_user(user.object_name,
  440. server->auth.object_name,
  441. outl)) return -EFAULT;
  442. }
  443. if (copy_to_user(argp, &user, sizeof(user)))
  444. return -EFAULT;
  445. return 0;
  446. }
  447. case NCP_IOC_SETOBJECTNAME:
  448. if (current->uid != server->m.mounted_uid) {
  449. return -EACCES;
  450. }
  451. {
  452. struct ncp_objectname_ioctl user;
  453. void* newname;
  454. void* oldname;
  455. size_t oldnamelen;
  456. void* oldprivate;
  457. size_t oldprivatelen;
  458. if (copy_from_user(&user, argp, sizeof(user)))
  459. return -EFAULT;
  460. if (user.object_name_len > NCP_OBJECT_NAME_MAX_LEN)
  461. return -ENOMEM;
  462. if (user.object_name_len) {
  463. newname = kmalloc(user.object_name_len, GFP_USER);
  464. if (!newname)
  465. return -ENOMEM;
  466. if (copy_from_user(newname, user.object_name, user.object_name_len)) {
  467. kfree(newname);
  468. return -EFAULT;
  469. }
  470. } else {
  471. newname = NULL;
  472. }
  473. /* enter critical section */
  474. /* maybe that kfree can sleep so do that this way */
  475. /* it is at least more SMP friendly (in future...) */
  476. oldname = server->auth.object_name;
  477. oldnamelen = server->auth.object_name_len;
  478. oldprivate = server->priv.data;
  479. oldprivatelen = server->priv.len;
  480. server->auth.auth_type = user.auth_type;
  481. server->auth.object_name_len = user.object_name_len;
  482. server->auth.object_name = newname;
  483. server->priv.len = 0;
  484. server->priv.data = NULL;
  485. /* leave critical section */
  486. kfree(oldprivate);
  487. kfree(oldname);
  488. return 0;
  489. }
  490. case NCP_IOC_GETPRIVATEDATA:
  491. if (current->uid != server->m.mounted_uid) {
  492. return -EACCES;
  493. }
  494. {
  495. struct ncp_privatedata_ioctl user;
  496. size_t outl;
  497. if (copy_from_user(&user, argp, sizeof(user)))
  498. return -EFAULT;
  499. outl = user.len;
  500. user.len = server->priv.len;
  501. if (outl > user.len) outl = user.len;
  502. if (outl) {
  503. if (copy_to_user(user.data,
  504. server->priv.data,
  505. outl)) return -EFAULT;
  506. }
  507. if (copy_to_user(argp, &user, sizeof(user)))
  508. return -EFAULT;
  509. return 0;
  510. }
  511. case NCP_IOC_SETPRIVATEDATA:
  512. if (current->uid != server->m.mounted_uid) {
  513. return -EACCES;
  514. }
  515. {
  516. struct ncp_privatedata_ioctl user;
  517. void* new;
  518. void* old;
  519. size_t oldlen;
  520. if (copy_from_user(&user, argp, sizeof(user)))
  521. return -EFAULT;
  522. if (user.len > NCP_PRIVATE_DATA_MAX_LEN)
  523. return -ENOMEM;
  524. if (user.len) {
  525. new = kmalloc(user.len, GFP_USER);
  526. if (!new)
  527. return -ENOMEM;
  528. if (copy_from_user(new, user.data, user.len)) {
  529. kfree(new);
  530. return -EFAULT;
  531. }
  532. } else {
  533. new = NULL;
  534. }
  535. /* enter critical section */
  536. old = server->priv.data;
  537. oldlen = server->priv.len;
  538. server->priv.len = user.len;
  539. server->priv.data = new;
  540. /* leave critical section */
  541. kfree(old);
  542. return 0;
  543. }
  544. #ifdef CONFIG_NCPFS_NLS
  545. case NCP_IOC_SETCHARSETS:
  546. return ncp_set_charsets(server, argp);
  547. case NCP_IOC_GETCHARSETS:
  548. return ncp_get_charsets(server, argp);
  549. #endif /* CONFIG_NCPFS_NLS */
  550. case NCP_IOC_SETDENTRYTTL:
  551. if ((file_permission(filp, MAY_WRITE) != 0) &&
  552. (current->uid != server->m.mounted_uid))
  553. return -EACCES;
  554. {
  555. u_int32_t user;
  556. if (copy_from_user(&user, argp, sizeof(user)))
  557. return -EFAULT;
  558. /* 20 secs at most... */
  559. if (user > 20000)
  560. return -EINVAL;
  561. user = (user * HZ) / 1000;
  562. server->dentry_ttl = user;
  563. return 0;
  564. }
  565. case NCP_IOC_GETDENTRYTTL:
  566. {
  567. u_int32_t user = (server->dentry_ttl * 1000) / HZ;
  568. if (copy_to_user(argp, &user, sizeof(user)))
  569. return -EFAULT;
  570. return 0;
  571. }
  572. }
  573. /* #ifdef CONFIG_UID16 */
  574. /* NCP_IOC_GETMOUNTUID may be same as NCP_IOC_GETMOUNTUID2,
  575. so we have this out of switch */
  576. if (cmd == NCP_IOC_GETMOUNTUID) {
  577. __kernel_uid_t uid = 0;
  578. if ((file_permission(filp, MAY_READ) != 0)
  579. && (current->uid != server->m.mounted_uid)) {
  580. return -EACCES;
  581. }
  582. SET_UID(uid, server->m.mounted_uid);
  583. if (put_user(uid, (__kernel_uid_t __user *)argp))
  584. return -EFAULT;
  585. return 0;
  586. }
  587. /* #endif */
  588. return -EINVAL;
  589. }