ioctl.c 16 KB

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