- To: Chris Mason <chris.mason@xxxxxxxxxxxx>
- Subject: Re: New Defects based on recent changes in Kernel code found by Coverity Scan
- From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jul 2012 12:44:26 -0700
- Cc: Scan Subscription <scan-subscription@xxxxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "linux-scsi@xxxxxxxxxxxxxxx" <linux-scsi@xxxxxxxxxxxxxxx>, "Chris L. Mason" <clmason@xxxxxxxxxxxx>, Bing Zhao <bzhao@xxxxxxxxxxx>, Robert Love <robert.w.love@xxxxxxxxx>, Andrew Vasquez <andrew.vasquez@xxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, "linux-ext4@xxxxxxxxxxxxxxx" <linux-ext4@xxxxxxxxxxxxxxx>, Mattia Dongili <malattia@xxxxxxxx>, Matthew Garrett <mjg@xxxxxxxxxx>
- In-reply-to: <20120705153316.GN14928@shiny>
On Thu, 5 Jul 2012 11:33:16 -0400 Chris Mason <chris.mason@xxxxxxxxxxxx> wrote:
> > > * CID 709112: Dereference after null check - fs/btrfs/ioctl.c, line: 1309 Comparing "device->fs_devices" to null implies that "device->fs_devices" might be null, and then it is deference
> > > fs/btrfs/ioctl.c:1309
> >
> > Chris.
>
> Thanks for forwarding this. But I'm a little confused, our line 1309 is
> this:
>
> if (device->fs_devices && device->fs_devices->seeding) {
>
> Is coverity telling me that I'm using fs_devices later on in the
> function without extra checks? Some functions we call do assume it
> isn't null, but the seeding devices are special snowflakes.
There were more details further down in the email:
> ____________________________________________________________________________________________________________
> CID 709112: Dereference after null check
>
> fs/btrfs/ioctl.c:1309
> 1256 static noinline int btrfs_ioctl_resize(struct btrfs_root *root,
> 1257 void __user *arg)
> 1258 {
> ...
> >>> At conditional (1): "device->fs_devices" taking the false branch.
> >>> CID 709112: Dereference after null check (FORWARD_NULL) Comparing "device->fs_devices" to null implies that "device->fs_devices" might be null.
> 1309 if (device->fs_devices && device->fs_devices->seeding) {
> 1310 printk(KERN_INFO "btrfs: resizer unable to apply on "
> 1311 "seeding device %llu\n", devid);
> 1312 ret = -EINVAL;
> 1313 goto out_free;
> 1314 }
> ...
> >>> Passing null variable "device->fs_devices" to function "btrfs_grow_device", which dereferences it.
> 1367 ret = btrfs_grow_device(trans, device, new_size);
> 1368 btrfs_commit_transaction(trans, root);
> 1369 } else if (new_size < old_size) {
> >>> Passing null variable "device->fs_devices" to function "btrfs_shrink_device", which dereferences it.
> 1370 ret = btrfs_shrink_device(device, new_size);
> 1371 }
> 1378 }
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[SCSI Target Devel]
[Linux SCSI Target Infrastructure]
[Kernel Newbies]
[Share Photos]
[IDE]
[Security]
[Git]
[Netfilter]
[Bugtraq]
[Photos]
[Yosemite]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Linux ATA RAID]
[Linux IIO]
[Samba]
[Video 4 Linux]
[Device Mapper]
[Linux Resources]