Skip to content

Commit a2a1c17

Browse files
tenortimbradfitz
authored andcommitted
syscall: add missing fs locking in Link, Rename on nacl
Per the comments at the head of fs_nacl.go, unexported methods expect the fs mutex to have been taken by the caller. This change brings Link and Rename into line with the other exported functions wrt fs locking. Fixes #22690 Change-Id: I46d08f7d227f23ff49bb0099d218214364a45e1a Reviewed-on: https://go-review.googlesource.com/79295 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 7eb7f8f commit a2a1c17

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/syscall/fs_nacl.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ func UtimesNano(path string, ts []Timespec) error {
625625

626626
func Link(path, link string) error {
627627
fsinit()
628+
fs.mu.Lock()
629+
defer fs.mu.Unlock()
628630
ip, _, err := fs.namei(path, false)
629631
if err != nil {
630632
return err
@@ -646,6 +648,8 @@ func Link(path, link string) error {
646648

647649
func Rename(from, to string) error {
648650
fsinit()
651+
fs.mu.Lock()
652+
defer fs.mu.Unlock()
649653
fdp, felem, err := fs.namei(from, true)
650654
if err != nil {
651655
return err

0 commit comments

Comments
 (0)