@@ -111,7 +111,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type,
111111 }
112112
113113 /* find the target keyring (which must be writable) */
114- keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_WRITE );
114+ keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_NEED_WRITE );
115115 if (IS_ERR (keyring_ref )) {
116116 ret = PTR_ERR (keyring_ref );
117117 goto error3 ;
@@ -195,7 +195,7 @@ SYSCALL_DEFINE4(request_key, const char __user *, _type,
195195 dest_ref = NULL ;
196196 if (destringid ) {
197197 dest_ref = lookup_user_key (destringid , KEY_LOOKUP_CREATE ,
198- KEY_WRITE );
198+ KEY_NEED_WRITE );
199199 if (IS_ERR (dest_ref )) {
200200 ret = PTR_ERR (dest_ref );
201201 goto error3 ;
@@ -253,7 +253,7 @@ long keyctl_get_keyring_ID(key_serial_t id, int create)
253253 long ret ;
254254
255255 lflags = create ? KEY_LOOKUP_CREATE : 0 ;
256- key_ref = lookup_user_key (id , lflags , KEY_SEARCH );
256+ key_ref = lookup_user_key (id , lflags , KEY_NEED_SEARCH );
257257 if (IS_ERR (key_ref )) {
258258 ret = PTR_ERR (key_ref );
259259 goto error ;
@@ -334,7 +334,7 @@ long keyctl_update_key(key_serial_t id,
334334 }
335335
336336 /* find the target key (which must be writable) */
337- key_ref = lookup_user_key (id , 0 , KEY_WRITE );
337+ key_ref = lookup_user_key (id , 0 , KEY_NEED_WRITE );
338338 if (IS_ERR (key_ref )) {
339339 ret = PTR_ERR (key_ref );
340340 goto error2 ;
@@ -365,12 +365,12 @@ long keyctl_revoke_key(key_serial_t id)
365365 key_ref_t key_ref ;
366366 long ret ;
367367
368- key_ref = lookup_user_key (id , 0 , KEY_WRITE );
368+ key_ref = lookup_user_key (id , 0 , KEY_NEED_WRITE );
369369 if (IS_ERR (key_ref )) {
370370 ret = PTR_ERR (key_ref );
371371 if (ret != - EACCES )
372372 goto error ;
373- key_ref = lookup_user_key (id , 0 , KEY_SETATTR );
373+ key_ref = lookup_user_key (id , 0 , KEY_NEED_SETATTR );
374374 if (IS_ERR (key_ref )) {
375375 ret = PTR_ERR (key_ref );
376376 goto error ;
@@ -401,7 +401,7 @@ long keyctl_invalidate_key(key_serial_t id)
401401
402402 kenter ("%d" , id );
403403
404- key_ref = lookup_user_key (id , 0 , KEY_SEARCH );
404+ key_ref = lookup_user_key (id , 0 , KEY_NEED_SEARCH );
405405 if (IS_ERR (key_ref )) {
406406 ret = PTR_ERR (key_ref );
407407 goto error ;
@@ -428,7 +428,7 @@ long keyctl_keyring_clear(key_serial_t ringid)
428428 key_ref_t keyring_ref ;
429429 long ret ;
430430
431- keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_WRITE );
431+ keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_NEED_WRITE );
432432 if (IS_ERR (keyring_ref )) {
433433 ret = PTR_ERR (keyring_ref );
434434
@@ -470,13 +470,13 @@ long keyctl_keyring_link(key_serial_t id, key_serial_t ringid)
470470 key_ref_t keyring_ref , key_ref ;
471471 long ret ;
472472
473- keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_WRITE );
473+ keyring_ref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_NEED_WRITE );
474474 if (IS_ERR (keyring_ref )) {
475475 ret = PTR_ERR (keyring_ref );
476476 goto error ;
477477 }
478478
479- key_ref = lookup_user_key (id , KEY_LOOKUP_CREATE , KEY_LINK );
479+ key_ref = lookup_user_key (id , KEY_LOOKUP_CREATE , KEY_NEED_LINK );
480480 if (IS_ERR (key_ref )) {
481481 ret = PTR_ERR (key_ref );
482482 goto error2 ;
@@ -505,7 +505,7 @@ long keyctl_keyring_unlink(key_serial_t id, key_serial_t ringid)
505505 key_ref_t keyring_ref , key_ref ;
506506 long ret ;
507507
508- keyring_ref = lookup_user_key (ringid , 0 , KEY_WRITE );
508+ keyring_ref = lookup_user_key (ringid , 0 , KEY_NEED_WRITE );
509509 if (IS_ERR (keyring_ref )) {
510510 ret = PTR_ERR (keyring_ref );
511511 goto error ;
@@ -548,7 +548,7 @@ long keyctl_describe_key(key_serial_t keyid,
548548 char * tmpbuf ;
549549 long ret ;
550550
551- key_ref = lookup_user_key (keyid , KEY_LOOKUP_PARTIAL , KEY_VIEW );
551+ key_ref = lookup_user_key (keyid , KEY_LOOKUP_PARTIAL , KEY_NEED_VIEW );
552552 if (IS_ERR (key_ref )) {
553553 /* viewing a key under construction is permitted if we have the
554554 * authorisation token handy */
@@ -639,7 +639,7 @@ long keyctl_keyring_search(key_serial_t ringid,
639639 }
640640
641641 /* get the keyring at which to begin the search */
642- keyring_ref = lookup_user_key (ringid , 0 , KEY_SEARCH );
642+ keyring_ref = lookup_user_key (ringid , 0 , KEY_NEED_SEARCH );
643643 if (IS_ERR (keyring_ref )) {
644644 ret = PTR_ERR (keyring_ref );
645645 goto error2 ;
@@ -649,7 +649,7 @@ long keyctl_keyring_search(key_serial_t ringid,
649649 dest_ref = NULL ;
650650 if (destringid ) {
651651 dest_ref = lookup_user_key (destringid , KEY_LOOKUP_CREATE ,
652- KEY_WRITE );
652+ KEY_NEED_WRITE );
653653 if (IS_ERR (dest_ref )) {
654654 ret = PTR_ERR (dest_ref );
655655 goto error3 ;
@@ -676,7 +676,7 @@ long keyctl_keyring_search(key_serial_t ringid,
676676
677677 /* link the resulting key to the destination keyring if we can */
678678 if (dest_ref ) {
679- ret = key_permission (key_ref , KEY_LINK );
679+ ret = key_permission (key_ref , KEY_NEED_LINK );
680680 if (ret < 0 )
681681 goto error6 ;
682682
@@ -727,7 +727,7 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
727727 key = key_ref_to_ptr (key_ref );
728728
729729 /* see if we can read it directly */
730- ret = key_permission (key_ref , KEY_READ );
730+ ret = key_permission (key_ref , KEY_NEED_READ );
731731 if (ret == 0 )
732732 goto can_read_key ;
733733 if (ret != - EACCES )
@@ -799,7 +799,7 @@ long keyctl_chown_key(key_serial_t id, uid_t user, gid_t group)
799799 goto error ;
800800
801801 key_ref = lookup_user_key (id , KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL ,
802- KEY_SETATTR );
802+ KEY_NEED_SETATTR );
803803 if (IS_ERR (key_ref )) {
804804 ret = PTR_ERR (key_ref );
805805 goto error ;
@@ -905,7 +905,7 @@ long keyctl_setperm_key(key_serial_t id, key_perm_t perm)
905905 goto error ;
906906
907907 key_ref = lookup_user_key (id , KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL ,
908- KEY_SETATTR );
908+ KEY_NEED_SETATTR );
909909 if (IS_ERR (key_ref )) {
910910 ret = PTR_ERR (key_ref );
911911 goto error ;
@@ -947,7 +947,7 @@ static long get_instantiation_keyring(key_serial_t ringid,
947947
948948 /* if a specific keyring is nominated by ID, then use that */
949949 if (ringid > 0 ) {
950- dkref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_WRITE );
950+ dkref = lookup_user_key (ringid , KEY_LOOKUP_CREATE , KEY_NEED_WRITE );
951951 if (IS_ERR (dkref ))
952952 return PTR_ERR (dkref );
953953 * _dest_keyring = key_ref_to_ptr (dkref );
@@ -1315,7 +1315,7 @@ long keyctl_set_timeout(key_serial_t id, unsigned timeout)
13151315 long ret ;
13161316
13171317 key_ref = lookup_user_key (id , KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL ,
1318- KEY_SETATTR );
1318+ KEY_NEED_SETATTR );
13191319 if (IS_ERR (key_ref )) {
13201320 /* setting the timeout on a key under construction is permitted
13211321 * if we have the authorisation token handy */
@@ -1418,7 +1418,7 @@ long keyctl_get_security(key_serial_t keyid,
14181418 char * context ;
14191419 long ret ;
14201420
1421- key_ref = lookup_user_key (keyid , KEY_LOOKUP_PARTIAL , KEY_VIEW );
1421+ key_ref = lookup_user_key (keyid , KEY_LOOKUP_PARTIAL , KEY_NEED_VIEW );
14221422 if (IS_ERR (key_ref )) {
14231423 if (PTR_ERR (key_ref ) != - EACCES )
14241424 return PTR_ERR (key_ref );
@@ -1482,7 +1482,7 @@ long keyctl_session_to_parent(void)
14821482 struct cred * cred ;
14831483 int ret ;
14841484
1485- keyring_r = lookup_user_key (KEY_SPEC_SESSION_KEYRING , 0 , KEY_LINK );
1485+ keyring_r = lookup_user_key (KEY_SPEC_SESSION_KEYRING , 0 , KEY_NEED_LINK );
14861486 if (IS_ERR (keyring_r ))
14871487 return PTR_ERR (keyring_r );
14881488
0 commit comments