Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

locks: fix leaks on setlease errors

We're depending on setlease to free the passed-in lease on failure.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

J. Bruce Fields and committed by
Linus Torvalds
096657b6 0ceaf6c7

+7 -5
+7 -5
fs/locks.c
··· 1371 1371 struct inode *inode = dentry->d_inode; 1372 1372 int error, rdlease_count = 0, wrlease_count = 0; 1373 1373 1374 + lease = *flp; 1375 + 1376 + error = -EACCES; 1374 1377 if ((current_fsuid() != inode->i_uid) && !capable(CAP_LEASE)) 1375 - return -EACCES; 1378 + goto out; 1379 + error = -EINVAL; 1376 1380 if (!S_ISREG(inode->i_mode)) 1377 - return -EINVAL; 1381 + goto out; 1378 1382 error = security_file_lock(filp, arg); 1379 1383 if (error) 1380 - return error; 1384 + goto out; 1381 1385 1382 1386 time_out_leases(inode); 1383 1387 1384 1388 BUG_ON(!(*flp)->fl_lmops->fl_break); 1385 - 1386 - lease = *flp; 1387 1389 1388 1390 if (arg != F_UNLCK) { 1389 1391 error = -EAGAIN;