The return at line 747 may need an unlock.
julia
---------- Forwarded message ----------
Date: Sun, 3 Nov 2019 09:21:22 +0800
From: kbuild test robot <lkp@xxxxxxxxx>
To: kbuild@xxxxxxxxxxxx
Cc: Julia Lawall <julia.lawall@xxxxxxx>
Subject: [staging:staging-testing 275/291]
drivers/staging/exfat/exfat_super.c:747:5-11: preceding lock on line 707
CC: kbuild-all@xxxxxxxxxxxx
CC: devel@xxxxxxxxxxxxxxxxxxxx
TO: Davidlohr Bueso <dave@xxxxxxxxxxxx>
CC: "Greg Kroah-Hartman" <gregkh@xxxxxxxxxxxxxxxxxxx>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-testing
head: f6ea634f1c01cb75675481318930985d6073632a
commit: 3ae82f449cea00de5cd894feb8e9154b2da99b4e [275/291] drivers/staging/exfat: Replace binary semaphores for mutexes
:::::: branch date: 15 hours ago
:::::: commit date: 2 days ago
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Reported-by: Julia Lawall <julia.lawall@xxxxxxx>
>> drivers/staging/exfat/exfat_super.c:747:5-11: preceding lock on line 707
# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=3ae82f449cea00de5cd894feb8e9154b2da99b4e
git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
git remote update staging
git checkout 3ae82f449cea00de5cd894feb8e9154b2da99b4e
vim +747 drivers/staging/exfat/exfat_super.c
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 684
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 685 static int ffsReadFile(struct inode *inode, struct file_id_t *fid, void *buffer,
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 686 u64 count, u64 *rcount)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 687 {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 688 s32 offset, sec_offset, clu_offset;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 689 u32 clu;
076a8e2f769e87 Colin Ian King 2019-08-30 690 int ret = 0;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 691 sector_t LogSector;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 692 u64 oneblkread, read_bytes;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 693 struct buffer_head *tmp_bh = NULL;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 694 struct super_block *sb = inode->i_sb;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 695 struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 696 struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 697
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 698 /* check the validity of the given file id */
3b531807e605bf Valentin Vidic 2019-09-03 699 if (!fid)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 700 return FFS_INVALIDFID;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 701
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 702 /* check the validity of pointer parameters */
3b531807e605bf Valentin Vidic 2019-09-03 703 if (!buffer)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 704 return FFS_ERROR;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 705
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 706 /* acquire the lock for file system critical section */
3ae82f449cea00 Davidlohr Bueso 2019-10-30 @707 mutex_lock(&p_fs->v_mutex);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 708
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 709 /* check if the given file ID is opened */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 710 if (fid->type != TYPE_FILE) {
7ca8049f098070 Valdis Kletnieks 2019-10-24 711 ret = -EPERM;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 712 goto out;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 713 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 714
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 715 if (fid->rwoffset > fid->size)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 716 fid->rwoffset = fid->size;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 717
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 718 if (count > (fid->size - fid->rwoffset))
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 719 count = fid->size - fid->rwoffset;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 720
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 721 if (count == 0) {
3b531807e605bf Valentin Vidic 2019-09-03 722 if (rcount)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 723 *rcount = 0;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 724 ret = FFS_EOF;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 725 goto out;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 726 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 727
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 728 read_bytes = 0;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 729
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 730 while (count > 0) {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 731 clu_offset = (s32)(fid->rwoffset >> p_fs->cluster_size_bits);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 732 clu = fid->start_clu;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 733
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 734 if (fid->flags == 0x03) {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 735 clu += clu_offset;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 736 } else {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 737 /* hint information */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 738 if ((clu_offset > 0) && (fid->hint_last_off > 0) &&
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 739 (clu_offset >= fid->hint_last_off)) {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 740 clu_offset -= fid->hint_last_off;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 741 clu = fid->hint_last_clu;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 742 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 743
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 744 while (clu_offset > 0) {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 745 /* clu = FAT_read(sb, clu); */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 746 if (FAT_read(sb, clu, &clu) == -1)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 @747 return FFS_MEDIAERR;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 748
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 749 clu_offset--;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 750 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 751 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 752
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 753 /* hint information */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 754 fid->hint_last_off = (s32)(fid->rwoffset >>
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 755 p_fs->cluster_size_bits);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 756 fid->hint_last_clu = clu;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 757
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 758 /* byte offset in cluster */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 759 offset = (s32)(fid->rwoffset & (p_fs->cluster_size - 1));
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 760
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 761 /* sector offset in cluster */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 762 sec_offset = offset >> p_bd->sector_size_bits;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 763
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 764 /* byte offset in sector */
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 765 offset &= p_bd->sector_size_mask;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 766
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 767 LogSector = START_SECTOR(clu) + sec_offset;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 768
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 769 oneblkread = (u64)(p_bd->sector_size - offset);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 770 if (oneblkread > count)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 771 oneblkread = count;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 772
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 773 if ((offset == 0) && (oneblkread == p_bd->sector_size)) {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 774 if (sector_read(sb, LogSector, &tmp_bh, 1) !=
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 775 FFS_SUCCESS)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 776 goto err_out;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 777 memcpy((char *)buffer + read_bytes,
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 778 (char *)tmp_bh->b_data, (s32)oneblkread);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 779 } else {
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 780 if (sector_read(sb, LogSector, &tmp_bh, 1) !=
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 781 FFS_SUCCESS)
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 782 goto err_out;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 783 memcpy((char *)buffer + read_bytes,
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 784 (char *)tmp_bh->b_data + offset,
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 785 (s32)oneblkread);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 786 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 787 count -= oneblkread;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 788 read_bytes += oneblkread;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 789 fid->rwoffset += oneblkread;
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 790 }
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 791 brelse(tmp_bh);
c48c9f7ff32b8b Valdis Kletnieks 2019-08-28 792
:::::: The code at line 747 was first introduced by commit
:::::: c48c9f7ff32b8b3965a08e40eb6763682d905b5d staging: exfat: add exfat filesystem code to staging
:::::: TO: Valdis Klētnieks <valdis.kletnieks@xxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel